20210520
This commit is contained in:
@@ -62,36 +62,206 @@ namespace FineUIPro.Web.Person
|
||||
/// </summary>
|
||||
private void BindGrid()
|
||||
{
|
||||
string strSql = @"SELECT * FROM View_Person_PersonPlan WHERE Years=@years";
|
||||
List<SqlParameter> listStr = new List<SqlParameter>();
|
||||
listStr.Add(new SqlParameter("@years", DateTime.Now.Year));
|
||||
if (this.drpProjectId.SelectedValue != BLL.Const._Null)
|
||||
if (!this.ckDistinct.Checked)
|
||||
{
|
||||
strSql += " AND ProjectId=@projectId";
|
||||
listStr.Add(new SqlParameter("@projectId", this.drpProjectId.SelectedValue));
|
||||
string strSql = @"SELECT * FROM View_Person_PersonPlan WHERE Years=@years";
|
||||
List<SqlParameter> listStr = new List<SqlParameter>();
|
||||
listStr.Add(new SqlParameter("@years", DateTime.Now.Year));
|
||||
if (this.drpProjectId.SelectedValue != BLL.Const._Null)
|
||||
{
|
||||
strSql += " AND ProjectId=@projectId";
|
||||
listStr.Add(new SqlParameter("@projectId", this.drpProjectId.SelectedValue));
|
||||
}
|
||||
if (this.drpDepartId.SelectedValue != BLL.Const._Null)
|
||||
{
|
||||
strSql += " AND DepartId=@DepartId";
|
||||
listStr.Add(new SqlParameter("@DepartId", this.drpDepartId.SelectedValue));
|
||||
}
|
||||
if (!string.IsNullOrEmpty(this.txtMajor.Text.Trim()))
|
||||
{
|
||||
strSql += " AND Major LIKE @Major";
|
||||
listStr.Add(new SqlParameter("@Major", "%" + this.txtMajor.Text.Trim() + "%"));
|
||||
}
|
||||
if (this.drpPersonType.SelectedValue != BLL.Const._Null)
|
||||
{
|
||||
strSql += " AND PersonType=@PersonType";
|
||||
listStr.Add(new SqlParameter("@PersonType", this.drpPersonType.SelectedValue));
|
||||
}
|
||||
if (!string.IsNullOrEmpty(this.txtUserName.Text.Trim()))
|
||||
{
|
||||
strSql += " AND UserName LIKE @UserName";
|
||||
listStr.Add(new SqlParameter("@UserName", "%" + this.txtUserName.Text.Trim() + "%"));
|
||||
}
|
||||
if (this.drpMonth.SelectedValue != BLL.Const._Null)
|
||||
{
|
||||
this.Grid1.FindColumn("Month1").Hidden = true;
|
||||
this.Grid1.FindColumn("Month2").Hidden = true;
|
||||
this.Grid1.FindColumn("Month3").Hidden = true;
|
||||
this.Grid1.FindColumn("Month4").Hidden = true;
|
||||
this.Grid1.FindColumn("Month5").Hidden = true;
|
||||
this.Grid1.FindColumn("Month6").Hidden = true;
|
||||
this.Grid1.FindColumn("Month7").Hidden = true;
|
||||
this.Grid1.FindColumn("Month8").Hidden = true;
|
||||
this.Grid1.FindColumn("Month9").Hidden = true;
|
||||
this.Grid1.FindColumn("Month10").Hidden = true;
|
||||
this.Grid1.FindColumn("Month11").Hidden = true;
|
||||
this.Grid1.FindColumn("Month12").Hidden = true;
|
||||
|
||||
if (this.drpMonth.SelectedValue == "1")
|
||||
{
|
||||
this.Grid1.FindColumn("Month1").Hidden = false;
|
||||
}
|
||||
else if (this.drpMonth.SelectedValue == "2")
|
||||
{
|
||||
this.Grid1.FindColumn("Month2").Hidden = false;
|
||||
}
|
||||
else if (this.drpMonth.SelectedValue == "3")
|
||||
{
|
||||
this.Grid1.FindColumn("Month3").Hidden = false;
|
||||
}
|
||||
else if (this.drpMonth.SelectedValue == "4")
|
||||
{
|
||||
this.Grid1.FindColumn("Month4").Hidden = false;
|
||||
}
|
||||
else if (this.drpMonth.SelectedValue == "5")
|
||||
{
|
||||
this.Grid1.FindColumn("Month5").Hidden = false;
|
||||
}
|
||||
else if (this.drpMonth.SelectedValue == "6")
|
||||
{
|
||||
this.Grid1.FindColumn("Month6").Hidden = false;
|
||||
}
|
||||
else if (this.drpMonth.SelectedValue == "7")
|
||||
{
|
||||
this.Grid1.FindColumn("Month7").Hidden = false;
|
||||
}
|
||||
else if (this.drpMonth.SelectedValue == "8")
|
||||
{
|
||||
this.Grid1.FindColumn("Month8").Hidden = false;
|
||||
}
|
||||
else if (this.drpMonth.SelectedValue == "9")
|
||||
{
|
||||
this.Grid1.FindColumn("Month9").Hidden = false;
|
||||
}
|
||||
else if (this.drpMonth.SelectedValue == "10")
|
||||
{
|
||||
this.Grid1.FindColumn("Month10").Hidden = false;
|
||||
}
|
||||
else if (this.drpMonth.SelectedValue == "11")
|
||||
{
|
||||
this.Grid1.FindColumn("Month11").Hidden = false;
|
||||
}
|
||||
else if (this.drpMonth.SelectedValue == "12")
|
||||
{
|
||||
this.Grid1.FindColumn("Month12").Hidden = false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
this.Grid1.FindColumn("Month1").Hidden = false;
|
||||
this.Grid1.FindColumn("Month2").Hidden = false;
|
||||
this.Grid1.FindColumn("Month3").Hidden = false;
|
||||
this.Grid1.FindColumn("Month4").Hidden = false;
|
||||
this.Grid1.FindColumn("Month5").Hidden = false;
|
||||
this.Grid1.FindColumn("Month6").Hidden = false;
|
||||
this.Grid1.FindColumn("Month7").Hidden = false;
|
||||
this.Grid1.FindColumn("Month8").Hidden = false;
|
||||
this.Grid1.FindColumn("Month9").Hidden = false;
|
||||
this.Grid1.FindColumn("Month10").Hidden = false;
|
||||
this.Grid1.FindColumn("Month11").Hidden = false;
|
||||
this.Grid1.FindColumn("Month12").Hidden = false;
|
||||
}
|
||||
this.Grid1.FindColumn("ProjectName").Hidden = false;
|
||||
this.Grid1.FindColumn("Remark").Hidden = false;
|
||||
SqlParameter[] parameter = listStr.ToArray();
|
||||
DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
|
||||
Grid1.RecordCount = tb.Rows.Count;
|
||||
var table = this.GetPagedDataTable(Grid1, tb);
|
||||
Grid1.DataSource = table;
|
||||
Grid1.DataBind();
|
||||
}
|
||||
if (this.drpDepartId.SelectedValue != BLL.Const._Null)
|
||||
{
|
||||
strSql += " AND DepartId=@DepartId";
|
||||
listStr.Add(new SqlParameter("@DepartId", this.drpDepartId.SelectedValue));
|
||||
}
|
||||
if (!string.IsNullOrEmpty(this.txtMajor.Text.Trim()))
|
||||
{
|
||||
strSql += " AND Major LIKE @Major";
|
||||
listStr.Add(new SqlParameter("@Major", "%" + this.txtMajor.Text.Trim() + "%"));
|
||||
}
|
||||
if (this.drpPersonType.SelectedValue != BLL.Const._Null)
|
||||
{
|
||||
strSql += " AND PersonType=@PersonType";
|
||||
listStr.Add(new SqlParameter("@PersonType", this.drpPersonType.SelectedValue));
|
||||
}
|
||||
if (!string.IsNullOrEmpty(this.txtUserName.Text.Trim()))
|
||||
{
|
||||
strSql += " AND UserName LIKE @UserName";
|
||||
listStr.Add(new SqlParameter("@UserName", "%" + this.txtUserName.Text.Trim() + "%"));
|
||||
}
|
||||
if (this.drpMonth.SelectedValue != BLL.Const._Null)
|
||||
else //去重复筛选
|
||||
{
|
||||
string strSql = @"SELECT distinct DepartName+UserName as PersonPlanId, DepartName,UserName,Major,PersonTypeName,'' as ProjectName,Remark FROM View_Person_PersonPlan WHERE Years=@years";
|
||||
List<SqlParameter> listStr = new List<SqlParameter>();
|
||||
listStr.Add(new SqlParameter("@years", DateTime.Now.Year));
|
||||
if (this.drpProjectId.SelectedValue != BLL.Const._Null)
|
||||
{
|
||||
strSql += " AND ProjectId=@projectId";
|
||||
listStr.Add(new SqlParameter("@projectId", this.drpProjectId.SelectedValue));
|
||||
}
|
||||
if (this.drpDepartId.SelectedValue != BLL.Const._Null)
|
||||
{
|
||||
strSql += " AND DepartId=@DepartId";
|
||||
listStr.Add(new SqlParameter("@DepartId", this.drpDepartId.SelectedValue));
|
||||
}
|
||||
if (!string.IsNullOrEmpty(this.txtMajor.Text.Trim()))
|
||||
{
|
||||
strSql += " AND Major LIKE @Major";
|
||||
listStr.Add(new SqlParameter("@Major", "%" + this.txtMajor.Text.Trim() + "%"));
|
||||
}
|
||||
if (this.drpPersonType.SelectedValue != BLL.Const._Null)
|
||||
{
|
||||
strSql += " AND PersonType=@PersonType";
|
||||
listStr.Add(new SqlParameter("@PersonType", this.drpPersonType.SelectedValue));
|
||||
}
|
||||
if (!string.IsNullOrEmpty(this.txtUserName.Text.Trim()))
|
||||
{
|
||||
strSql += " AND UserName LIKE @UserName";
|
||||
listStr.Add(new SqlParameter("@UserName", "%" + this.txtUserName.Text.Trim() + "%"));
|
||||
}
|
||||
if (this.drpMonth.SelectedValue != BLL.Const._Null)
|
||||
{
|
||||
if (this.drpMonth.SelectedValue == "1")
|
||||
{
|
||||
strSql += " AND Month1=1";
|
||||
}
|
||||
else if (this.drpMonth.SelectedValue == "2")
|
||||
{
|
||||
strSql += " AND Month2=1";
|
||||
}
|
||||
else if (this.drpMonth.SelectedValue == "3")
|
||||
{
|
||||
strSql += " AND Month3=1";
|
||||
}
|
||||
else if (this.drpMonth.SelectedValue == "4")
|
||||
{
|
||||
strSql += " AND Month4=1";
|
||||
}
|
||||
else if (this.drpMonth.SelectedValue == "5")
|
||||
{
|
||||
strSql += " AND Month5=1";
|
||||
}
|
||||
else if (this.drpMonth.SelectedValue == "6")
|
||||
{
|
||||
strSql += " AND Month6=1";
|
||||
}
|
||||
else if (this.drpMonth.SelectedValue == "7")
|
||||
{
|
||||
strSql += " AND Month7=1";
|
||||
}
|
||||
else if (this.drpMonth.SelectedValue == "8")
|
||||
{
|
||||
strSql += " AND Month8=1";
|
||||
}
|
||||
else if (this.drpMonth.SelectedValue == "9")
|
||||
{
|
||||
strSql += " AND Month9=1";
|
||||
}
|
||||
else if (this.drpMonth.SelectedValue == "10")
|
||||
{
|
||||
strSql += " AND Month10=1";
|
||||
}
|
||||
else if (this.drpMonth.SelectedValue == "11")
|
||||
{
|
||||
strSql += " AND Month11=1";
|
||||
}
|
||||
else if (this.drpMonth.SelectedValue == "12")
|
||||
{
|
||||
strSql += " AND Month12=1";
|
||||
}
|
||||
}
|
||||
this.Grid1.FindColumn("ProjectName").Hidden = true;
|
||||
this.Grid1.FindColumn("Month1").Hidden = true;
|
||||
this.Grid1.FindColumn("Month2").Hidden = true;
|
||||
this.Grid1.FindColumn("Month3").Hidden = true;
|
||||
@@ -104,77 +274,14 @@ namespace FineUIPro.Web.Person
|
||||
this.Grid1.FindColumn("Month10").Hidden = true;
|
||||
this.Grid1.FindColumn("Month11").Hidden = true;
|
||||
this.Grid1.FindColumn("Month12").Hidden = true;
|
||||
|
||||
if (this.drpMonth.SelectedValue=="1")
|
||||
{
|
||||
this.Grid1.FindColumn("Month1").Hidden = false;
|
||||
}
|
||||
else if (this.drpMonth.SelectedValue=="2")
|
||||
{
|
||||
this.Grid1.FindColumn("Month2").Hidden = false;
|
||||
}
|
||||
else if (this.drpMonth.SelectedValue == "3")
|
||||
{
|
||||
this.Grid1.FindColumn("Month3").Hidden = false;
|
||||
}
|
||||
else if (this.drpMonth.SelectedValue == "4")
|
||||
{
|
||||
this.Grid1.FindColumn("Month4").Hidden = false;
|
||||
}
|
||||
else if (this.drpMonth.SelectedValue == "5")
|
||||
{
|
||||
this.Grid1.FindColumn("Month5").Hidden = false;
|
||||
}
|
||||
else if (this.drpMonth.SelectedValue == "6")
|
||||
{
|
||||
this.Grid1.FindColumn("Month6").Hidden = false;
|
||||
}
|
||||
else if (this.drpMonth.SelectedValue == "7")
|
||||
{
|
||||
this.Grid1.FindColumn("Month7").Hidden = false;
|
||||
}
|
||||
else if (this.drpMonth.SelectedValue == "8")
|
||||
{
|
||||
this.Grid1.FindColumn("Month8").Hidden = false;
|
||||
}
|
||||
else if (this.drpMonth.SelectedValue == "9")
|
||||
{
|
||||
this.Grid1.FindColumn("Month9").Hidden = false;
|
||||
}
|
||||
else if (this.drpMonth.SelectedValue == "10")
|
||||
{
|
||||
this.Grid1.FindColumn("Month10").Hidden = false;
|
||||
}
|
||||
else if (this.drpMonth.SelectedValue == "11")
|
||||
{
|
||||
this.Grid1.FindColumn("Month11").Hidden = false;
|
||||
}
|
||||
else if (this.drpMonth.SelectedValue == "12")
|
||||
{
|
||||
this.Grid1.FindColumn("Month12").Hidden = false;
|
||||
}
|
||||
this.Grid1.FindColumn("Remark").Hidden = true;
|
||||
SqlParameter[] parameter = listStr.ToArray();
|
||||
DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
|
||||
Grid1.RecordCount = tb.Rows.Count;
|
||||
var table = this.GetPagedDataTable(Grid1, tb);
|
||||
Grid1.DataSource = table;
|
||||
Grid1.DataBind();
|
||||
}
|
||||
else
|
||||
{
|
||||
this.Grid1.FindColumn("Month1").Hidden = false;
|
||||
this.Grid1.FindColumn("Month2").Hidden = false;
|
||||
this.Grid1.FindColumn("Month3").Hidden = false;
|
||||
this.Grid1.FindColumn("Month4").Hidden = false;
|
||||
this.Grid1.FindColumn("Month5").Hidden = false;
|
||||
this.Grid1.FindColumn("Month6").Hidden = false;
|
||||
this.Grid1.FindColumn("Month7").Hidden = false;
|
||||
this.Grid1.FindColumn("Month8").Hidden = false;
|
||||
this.Grid1.FindColumn("Month9").Hidden = false;
|
||||
this.Grid1.FindColumn("Month10").Hidden = false;
|
||||
this.Grid1.FindColumn("Month11").Hidden = false;
|
||||
this.Grid1.FindColumn("Month12").Hidden = false;
|
||||
}
|
||||
SqlParameter[] parameter = listStr.ToArray();
|
||||
DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
|
||||
Grid1.RecordCount = tb.Rows.Count;
|
||||
var table = this.GetPagedDataTable(Grid1, tb);
|
||||
Grid1.DataSource = table;
|
||||
Grid1.DataBind();
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
Reference in New Issue
Block a user