191 lines
7.0 KiB
C#
191 lines
7.0 KiB
C#
using BLL;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Data;
|
|
using System.Data.SqlClient;
|
|
using System.Linq;
|
|
using System.Web;
|
|
using System.Web.UI;
|
|
using System.Web.UI.WebControls;
|
|
|
|
namespace FineUIPro.Web.CQMS.QualityActivity.QCManage
|
|
{
|
|
public partial class QCStatics : PageBase
|
|
{
|
|
/// <summary>
|
|
/// 项目id
|
|
/// </summary>
|
|
public string ProjectId
|
|
{
|
|
get
|
|
{
|
|
return (string)ViewState["ProjectId"];
|
|
}
|
|
set
|
|
{
|
|
ViewState["ProjectId"] = value;
|
|
}
|
|
}
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
{
|
|
if (!IsPostBack)
|
|
{
|
|
//this.ProjectId = this.CurrUser.LoginProjectId;
|
|
//if (!string.IsNullOrEmpty(Request.Params["projectId"]) && Request.Params["projectId"] != this.CurrUser.LoginProjectId)
|
|
//{
|
|
// this.ProjectId = Request.Params["projectId"];
|
|
//}
|
|
|
|
//this.ucTree.UnitId = this.CurrUser.UnitId;
|
|
//this.ucTree.ProjectId = this.ProjectId;
|
|
//if (!string.IsNullOrEmpty(this.CurrUser.LoginProjectId))
|
|
//{
|
|
// this.panelLeftRegion.Hidden = true;
|
|
////权限按钮方法
|
|
//this.GetButtonPower();
|
|
//}
|
|
BLL.ProjectService.InitAllProjectDropDownList(this.drpProjectId, true);
|
|
BLL.UnitService.InitProjectUnitDropDownList(this.drpUnitId, this.CurrUser.LoginProjectId, true);
|
|
|
|
if (!string.IsNullOrEmpty(this.CurrUser.LoginProjectId))
|
|
{
|
|
this.drpProjectId.Hidden = true;
|
|
this.Grid1.Columns[1].Hidden = true;
|
|
}
|
|
else
|
|
{
|
|
this.drpProjectId.Hidden = false;
|
|
this.Grid1.Columns[1].Hidden = false;
|
|
}
|
|
BindGrid();
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// 公司级树加载
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
//protected void changeTree(object sender, EventArgs e)
|
|
//{
|
|
//this.ProjectId = this.ucTree.ProjectId;
|
|
//this.GetButtonPower();
|
|
//if (string.IsNullOrEmpty(this.CurrUser.LoginProjectId))
|
|
//{
|
|
//}
|
|
// this.BindGrid();
|
|
//}
|
|
/// <summary>
|
|
/// 绑定数据
|
|
/// </summary>
|
|
//private DataTable tb = null;
|
|
|
|
public void BindGrid()
|
|
{
|
|
//List<SqlParameter> listStr = new List<SqlParameter>
|
|
//{
|
|
//};
|
|
//if (!string.IsNullOrEmpty(this.CurrUser.LoginProjectId))
|
|
//{
|
|
// listStr.Add(new SqlParameter("@projectId", this.CurrUser.LoginProjectId));
|
|
//}
|
|
//else
|
|
//{
|
|
// if (this.drpProjectId.SelectedValue != BLL.Const._Null && !string.IsNullOrEmpty(this.drpProjectId.SelectedValue))
|
|
// {
|
|
// listStr.Add(new SqlParameter("@projectId", this.drpProjectId.SelectedValue));
|
|
// }
|
|
// else
|
|
// {
|
|
// listStr.Add(new SqlParameter("@projectId", null));
|
|
// }
|
|
//}
|
|
//SqlParameter[] parameter = listStr.ToArray();
|
|
//tb = SQLHelper.GetDataTableRunProc("Sp_QCStatics", parameter);
|
|
//this.Grid1.RecordCount = tb.Rows.Count;
|
|
//var table = this.GetPagedDataTable(Grid1, tb);
|
|
//Grid1.DataSource = table;
|
|
//Grid1.DataBind();
|
|
string strSql = @"select C.*,p.UserName,u.UnitName,pro.ProjectName,(case C.AwardLevel when '1' then '国家' when '2' then '省部' when '3' then '企业' end) as AwardLevelName
|
|
from [dbo].[QCManage_QCGroupRegistration] C
|
|
left join Sys_User p on p.UserId=C.CompileMan
|
|
left join Base_Unit u on u.UnitId = c.UnitId
|
|
left join Base_Project pro on pro.ProjectId = C.ProjectId
|
|
where 1=1 ";
|
|
List<SqlParameter> listStr = new List<SqlParameter>();
|
|
if (!string.IsNullOrEmpty(this.CurrUser.LoginProjectId))
|
|
{
|
|
strSql += " AND C.ProjectId = @ProjectId";
|
|
listStr.Add(new SqlParameter("@ProjectId", this.CurrUser.LoginProjectId));
|
|
}
|
|
else
|
|
{
|
|
if (this.drpProjectId.SelectedValue != BLL.Const._Null && !string.IsNullOrEmpty(this.drpProjectId.SelectedValue))
|
|
{
|
|
strSql += " AND C.ProjectId = @ProjectId";
|
|
listStr.Add(new SqlParameter("@ProjectId", this.drpProjectId.SelectedValue));
|
|
}
|
|
}
|
|
if (this.drpUnitId.SelectedValue != BLL.Const._Null && !string.IsNullOrEmpty(this.drpUnitId.SelectedValue))
|
|
{
|
|
strSql += " AND C.UnitId = @UnitId";
|
|
listStr.Add(new SqlParameter("@UnitId", this.drpUnitId.SelectedValue));
|
|
}
|
|
|
|
SqlParameter[] parameter = listStr.ToArray();
|
|
DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
|
|
Grid1.RecordCount = tb.Rows.Count;
|
|
//tb = GetFilteredTable(Grid1.FilteredData, tb);
|
|
var table = this.GetPagedDataTable(Grid1, tb);
|
|
|
|
Grid1.DataSource = table;
|
|
Grid1.DataBind();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 分页显示条数下拉框
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void ddlPageSize_SelectedIndexChanged(object sender, EventArgs e)
|
|
{
|
|
Grid1.PageSize = Convert.ToInt32(ddlPageSize.SelectedValue);
|
|
BindGrid();
|
|
}
|
|
|
|
//分页
|
|
protected void Grid1_PageIndexChange(object sender, GridPageEventArgs e)
|
|
{
|
|
BindGrid();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 统计按钮
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void BtnAnalyse_Click(object sender, EventArgs e)
|
|
{
|
|
BindGrid();
|
|
}
|
|
|
|
protected void Grid1_RowCommand(object sender, GridCommandEventArgs e)
|
|
{
|
|
object[] keys = Grid1.DataKeys[e.RowIndex];
|
|
string fileId = string.Empty;
|
|
if (keys == null)
|
|
{
|
|
return;
|
|
}
|
|
else
|
|
{
|
|
fileId = keys[0].ToString();
|
|
}
|
|
if (e.CommandName.Equals("download"))
|
|
{
|
|
string menuId = Const.ProjectQCGroupRegistrationListMenuId;
|
|
PageContext.RegisterStartupScript(WindowAtt.GetShowReference(
|
|
String.Format("../../../AttachFile/webuploader.aspx?type=-1&source=1&toKeyId={0}&path=FileUpload/QCGroupRegistration&menuId={1}", fileId, menuId)));
|
|
}
|
|
}
|
|
}
|
|
} |