public void BindGrid() { string condition = " 1 = 1 "; #region 判断当前可查询的范围 if (tr_OrganizeCity.SelectValue != "1") { Addr_OrganizeCityBLL orgcity = new Addr_OrganizeCityBLL(int.Parse(tr_OrganizeCity.SelectValue)); string orgcitys = orgcity.GetAllChildNodeIDs(); if (orgcitys != "") orgcitys += ","; orgcitys += tr_OrganizeCity.SelectValue; if (orgcitys != "") condition += " AND OrganizeCity IN (" + orgcitys + ")"; } if (tr_Position.SelectValue != "1") { Org_PositionBLL org_position = new Org_PositionBLL(int.Parse(tr_Position.SelectValue)); string positions = org_position.GetAllChildPosition(); if (positions != "") positions += ","; positions += tr_Position.SelectValue; if (positions != "") condition += " AND Position IN (" + positions + ")"; } #endregion gv_List.BindGrid(Org_StaffNumberLimitBLL.GetModelList(condition)); }
//protected void tbx_Name_TextChanged(object sender, EventArgs e) //{ //} protected void bt_serch_Click(object sender, EventArgs e) { if (tr_Position.SelectedValue != "0") { string positions = ""; if (cb_IncludeChild.Checked) { Org_PositionBLL pos = new Org_PositionBLL(int.Parse(tr_Position.SelectedValue)); positions = pos.GetAllChildPosition(); if (positions != "") { positions += ","; } positions += tr_Position.SelectedValue; } else { positions = tr_Position.SelectedValue; } DataTable dt = Org_StaffBLL.GetRealNameAndUserNameByPosition(positions); dt.DefaultView.RowFilter = " RealName like '%" + tbx_Name.Text + "%' "; listAccount.Items.Clear(); for (int i = 0; i < dt.DefaultView.Count; i++) { listAccount.Items.Add(new ListItem((string)dt.DefaultView[i]["UserName"] + "[" + (string)dt.DefaultView[i]["RealName"] + "]", (string)dt.DefaultView[i]["UserName"])); } } }
protected void tr_Position_Selected(object sender, MCSControls.MCSWebControls.SelectedEventArgs e) { if (tr_Position.SelectedValue != "0") { string positions = ""; if (cb_IncludeChild.Checked) { Org_PositionBLL pos = new Org_PositionBLL(int.Parse(tr_Position.SelectedValue)); positions = pos.GetAllChildPosition(); if (positions != "") positions += ","; positions += tr_Position.SelectedValue; } else positions = tr_Position.SelectedValue; DataTable dt = Org_StaffBLL.GetRealNameAndUserNameByPosition(positions); listAccount.Items.Clear(); foreach (DataRow row in dt.Rows) { listAccount.Items.Add(new ListItem((string)row["UserName"] + "[" + (string)row["RealName"] + "]", (string)row["UserName"])); } } }
private void BindGrid() { string condition = "1=1"; #region 根据职位的范围查询 if (tr_Position.SelectValue != tr_Position.RootValue && tr_Position.SelectValue != "0") { if (chb_ToPositionChild.Checked) { #region 绑定子职位 Org_PositionBLL _bll = new Org_PositionBLL(int.Parse(tr_Position.SelectValue)); string ids = ""; ids = _bll.GetAllChildPosition(); #endregion if (ids != "") condition += " and RelatePosition in(" + tr_Position.SelectValue + "," + ids + ")"; else condition += " and RelatePosition =" + tr_Position.SelectValue; } else { condition += " and RelatePosition =" + tr_Position.SelectValue; } } #endregion if (ddl_ApproveFlag.SelectedValue != "0") { condition += " AND ApproveFlag="+ddl_ApproveFlag.SelectedValue; } gv_List.ConditionString = condition; gv_List.BindGrid(); }
//protected void tbx_Name_TextChanged(object sender, EventArgs e) //{ //} protected void bt_serch_Click(object sender, EventArgs e) { if (tr_Position.SelectedValue != "0") { string positions = ""; if (cb_IncludeChild.Checked) { Org_PositionBLL pos = new Org_PositionBLL(int.Parse(tr_Position.SelectedValue)); positions = pos.GetAllChildPosition(); if (positions != "") positions += ","; positions += tr_Position.SelectedValue; } else positions = tr_Position.SelectedValue; DataTable dt = Org_StaffBLL.GetRealNameAndUserNameByPosition(positions); dt.DefaultView.RowFilter = " RealName like '%" + tbx_Name.Text + "%' "; listAccount.Items.Clear(); for (int i = 0; i < dt.DefaultView.Count; i++) { listAccount.Items.Add(new ListItem((string)dt.DefaultView[i]["UserName"] + "[" + (string)dt.DefaultView[i]["RealName"] + "]", (string)dt.DefaultView[i]["UserName"])); } } }
private void BindStaffList() { listAccount.Items.Clear(); if (ddl_Position.SelectedValue != "0" || (ddl_Position.SelectedValue == "0" && tbx_Name.Text.Trim() != "")) { string positions = ""; if (ddl_Position.SelectedValue == "0") { Org_PositionBLL pos = new Org_PositionBLL(1); positions = pos.GetAllChildPosition() + ",1"; } else { if (cb_IncludeChild.Checked) { Org_PositionBLL pos = new Org_PositionBLL(int.Parse(ddl_Position.SelectedValue)); positions = pos.GetAllChildPosition(); if (positions != "") positions += ","; positions += ddl_Position.SelectedValue; } else positions = ddl_Position.SelectedValue; } DataTable dt = Org_StaffBLL.GetRealNameAndUserNameByPosition(positions); dt.DefaultView.RowFilter = " RealName like '%" + tbx_Name.Text + "%' "; for (int i = 0; i < dt.DefaultView.Count; i++) { listAccount.Items.Add(new ListItem((string)dt.DefaultView[i]["RealName"], (string)dt.DefaultView[i]["UserName"])); } } }
protected void tr_Position_Selected(object sender, MCSControls.MCSWebControls.SelectedEventArgs e) { if (tr_Position.SelectValue != "0") { string positions = ""; if (cb_IncludeChild.Checked) { Org_PositionBLL pos = new Org_PositionBLL(int.Parse(tr_Position.SelectValue)); positions = pos.GetAllChildPosition(); if (positions != "") { positions += ","; } positions += tr_Position.SelectValue; } else { positions = tr_Position.SelectValue; } DataTable dt = Org_StaffBLL.GetRealNameAndUserNameByPosition(positions); listAccount.Items.Clear(); foreach (DataRow row in dt.Rows) { listAccount.Items.Add(new ListItem((string)row["UserName"] + "[" + (string)row["RealName"] + "]", (string)row["UserName"])); } } }
private void BindStaffList() { listAccount.Items.Clear(); if (ddl_Position.SelectedValue != "0" || (ddl_Position.SelectedValue == "0" && tbx_Name.Text.Trim() != "")) { string positions = ""; if (ddl_Position.SelectedValue == "0") { Org_PositionBLL pos = new Org_PositionBLL(1); positions = pos.GetAllChildPosition() + ",1"; } else { if (cb_IncludeChild.Checked) { Org_PositionBLL pos = new Org_PositionBLL(int.Parse(ddl_Position.SelectedValue)); positions = pos.GetAllChildPosition(); if (positions != "") { positions += ","; } positions += ddl_Position.SelectedValue; } else { positions = ddl_Position.SelectedValue; } } DataTable dt = Org_StaffBLL.GetRealNameAndUserNameByPosition(positions); dt.DefaultView.RowFilter = " RealName like '%" + tbx_Name.Text + "%' "; for (int i = 0; i < dt.DefaultView.Count; i++) { listAccount.Items.Add(new ListItem((string)dt.DefaultView[i]["RealName"], (string)dt.DefaultView[i]["UserName"])); } } }
public void BindGrid() { string condition = " 1 = 1 "; #region 判断当前可查询的范围 if (tr_OrganizeCity.SelectValue != "1") { Addr_OrganizeCityBLL orgcity = new Addr_OrganizeCityBLL(int.Parse(tr_OrganizeCity.SelectValue)); string orgcitys = orgcity.GetAllChildNodeIDs(); if (orgcitys != "") { orgcitys += ","; } orgcitys += tr_OrganizeCity.SelectValue; if (orgcitys != "") { condition += " AND OrganizeCity IN (" + orgcitys + ")"; } } if (tr_Position.SelectValue != "1") { Org_PositionBLL org_position = new Org_PositionBLL(int.Parse(tr_Position.SelectValue)); string positions = org_position.GetAllChildPosition(); if (positions != "") { positions += ","; } positions += tr_Position.SelectValue; if (positions != "") { condition += " AND Position IN (" + positions + ")"; } } #endregion gv_List.BindGrid(Org_StaffNumberLimitBLL.GetModelList(condition)); }
protected void bt_Insert1_Click(object sender, EventArgs e) { string positionID = tr_ToPosition.SelectValue; if (positionID != null && positionID != "" && positionID != "1") { Org_PositionBLL _positionbll = new Org_PositionBLL(int.Parse(positionID)); lb_PositionChild.Items.Add(new ListItem(_positionbll.Model.Name, positionID.ToString())); if (this.chb_ToPositionChild.Checked) { string[] childList = StringSplit(_positionbll.GetAllChildPosition()); foreach (string child in childList) { if (lb_PositionChild.Items.FindByValue(child) == null) { _positionbll = new Org_PositionBLL(int.Parse(child)); lb_PositionChild.Items.Add(new ListItem(_positionbll.Model.Name, child)); } } } } }
private void BindGrid() { string condition = "1=1"; #region 根据职位的范围查询 if (tr_Position.SelectValue != tr_Position.RootValue && tr_Position.SelectValue != "0") { if (chb_ToPositionChild.Checked) { #region 绑定子职位 Org_PositionBLL _bll = new Org_PositionBLL(int.Parse(tr_Position.SelectValue)); string ids = ""; ids = _bll.GetAllChildPosition(); #endregion if (ids != "") { condition += " and RelatePosition in(" + tr_Position.SelectValue + "," + ids + ")"; } else { condition += " and RelatePosition =" + tr_Position.SelectValue; } } else { condition += " and RelatePosition =" + tr_Position.SelectValue; } } #endregion if (ddl_ApproveFlag.SelectedValue != "0") { condition += " AND ApproveFlag=" + ddl_ApproveFlag.SelectedValue; } gv_List.ConditionString = condition; gv_List.BindGrid(); }
private void BindGrid() { string condition = " Org_Staff.Dimission=" + ViewState["Dimission"].ToString(); #region 根据职位的范围查询 if (tr_Position.SelectValue != tr_Position.RootValue && tr_Position.SelectValue != "0") { if (chb_ToPositionChild.Checked) { #region 绑定子职位 Org_PositionBLL _bll = new Org_PositionBLL(int.Parse(tr_Position.SelectValue)); string ids = ""; ids = _bll.GetAllChildPosition(); #endregion if (ids != "") condition += " and Org_Staff.Position in(" + tr_Position.SelectValue + "," + ids + ")"; else condition += " and Org_Staff.Position =" + tr_Position.SelectValue; } else { condition += " and Org_Staff.Position =" + tr_Position.SelectValue; } } #endregion #region 判断当前可查询的范围 if (tr_OrganizeCity.SelectValue != "1") { Addr_OrganizeCityBLL orgcity = new Addr_OrganizeCityBLL(int.Parse(tr_OrganizeCity.SelectValue)); string orgcitys = orgcity.GetAllChildNodeIDs(); if (orgcitys != "") orgcitys += ","; orgcitys += tr_OrganizeCity.SelectValue; if (orgcitys != "") condition += " AND Org_Staff.OrganizeCity IN (" + orgcitys + ")"; } #endregion if (ddl_ApproveFlag.SelectedValue != "0") { condition += " And Org_Staff.ApproveFlag =" + ddl_ApproveFlag.SelectedValue; } if ((int)Session["OwnerType"] != 1) { condition += " AND Org_Staff.OwnerType=" + Session["OwnerType"].ToString(); } if (!Right_Assign_BLL.GetAccessRight(Session["UserName"].ToString(), 1302, "SearchDI")) { //查询经销商用户 condition += " AND Org_Staff.OwnerType!=3"; } ud_grid.ConditionString = condition; if (ViewState["ConditionString"] != null) ud_grid.ConditionString += " AND " + ViewState["ConditionString"].ToString(); ud_grid.BindGrid(); }
private void BindGrid() { string condition = " Dimission=1 AND ApproveFlag=1 "; //仅仅查询在职的 if (tbx_Condition.Text != string.Empty) { condition += " AND " + ddl_SearchType.SelectedValue + " Like '%" + this.tbx_Condition.Text.Trim() + "%'"; } if (tr_Position.SelectValue != "0") { if (cb_IncludeChild.Checked || tr_Position.SelectValue == tr_Position.RootValue) { string positions = ""; Org_PositionBLL pos = new Org_PositionBLL(int.Parse(tr_Position.SelectValue)); positions = pos.GetAllChildPosition(); if (tr_Position.SelectValue != tr_Position.RootValue) { if (positions != "") { positions += ","; } positions += tr_Position.SelectValue; } condition += " AND Org_Staff.Position IN (" + positions + ")"; } else { condition += " AND Org_Staff.Position = " + tr_Position.SelectValue; } } #region 判断当前可查询的范围 if (tr_OrganizeCity.SelectValue != "0" && tr_OrganizeCity.SelectValue != "1") { string orgcitys = ""; Addr_OrganizeCityBLL orgcity = new Addr_OrganizeCityBLL(int.Parse(tr_OrganizeCity.SelectValue)); orgcitys = orgcity.GetAllChildNodeIDs(); if (orgcitys != "") { orgcitys += ","; } orgcitys += tr_OrganizeCity.SelectValue; condition += " AND (Org_Staff.OrganizeCity IN (" + orgcitys + ") OR Org_Staff.ID IN (SELECT Staff FROM MCS_SYS.dbo.Org_Staff_StaffInOrganizeCity WHERE OrganizeCity IN (" + orgcitys + ")) )"; } #endregion if (Request.QueryString["ExtCondition"] != null) { condition += " AND (" + Request.QueryString["ExtCondition"] + ")"; } #region 将指定区域的上级经理加入人员选择窗口中 if (Request.QueryString["IncludeSuperManager"] != null && Request.QueryString["OrganizeCity"] != null) { int supercitymanager = 0; Addr_OrganizeCity city1 = new Addr_OrganizeCityBLL(int.Parse(Request.QueryString["OrganizeCity"])).Model; if (city1 != null) { Addr_OrganizeCity city2 = new Addr_OrganizeCityBLL(city1.SuperID).Model; if (city2 != null) { supercitymanager = city2.Manager; } } if (supercitymanager != 0) { condition += " OR Org_Staff.ID=" + supercitymanager.ToString(); } } #endregion gv_List.ConditionString = condition; gv_List.BindGrid(); }
private void BindGrid() { string ConditionStr = "JN_WorkingPlan.BeginDate Between '" + tbx_begindate.Text + "' AND '" + tbx_enddate.Text + " 23:59' "; switch (MCSTabControl1.SelectedTabItem.Value) { case "0": ConditionStr += " AND JN_WorkingPlan.Staff=" + Session["UserID"].ToString(); gv_List.OrderFields = "JN_WorkingPlan_ID"; gv_List.ConditionString = ConditionStr; gv_List.BindGrid(); break; case "1": if (tbx_StaffName.Text != "") { ConditionStr += "AND Org_Staff.RealName LIKE '%" + tbx_StaffName.Text + "%'"; } #region 只显示当前员工的所有下级职位的员工计划 if (tr_Position.SelectValue != "0") { if (cb_IncludeChild.Checked || tr_Position.SelectValue == tr_Position.RootValue) { Org_PositionBLL p = new Org_PositionBLL(int.Parse(tr_Position.SelectValue)); string positions = p.GetAllChildPosition(); if (tr_Position.SelectValue != tr_Position.RootValue) { if (positions != "") { positions += ","; } positions += tr_Position.SelectValue; } ConditionStr += " AND Org_Staff.Position IN (" + positions + ")"; } else { ConditionStr += " AND Org_Staff.Position = " + tr_Position.SelectValue; } } #endregion #region 判断当前可查询的管理片区范围 if (tr_OrganizeCity.SelectValue != "1") { string orgcitys = ""; Addr_OrganizeCityBLL orgcity = new Addr_OrganizeCityBLL(int.Parse(tr_OrganizeCity.SelectValue), true); orgcitys = orgcity.GetAllChildNodeIDs(); if (orgcitys != "") { orgcitys += ","; } orgcitys += tr_OrganizeCity.SelectValue; if (orgcitys != "") { ConditionStr += " AND JN_WorkingPlan.OrganizeCity IN (" + orgcitys + ") "; } } #endregion gv_List.OrderFields = "JN_WorkingPlan_ID"; gv_List.ConditionString = ConditionStr; gv_List.BindGrid(); break; case "2": DateTime dt_begin = DateTime.Parse(tbx_begindate.Text); DateTime dt_end = DateTime.Parse(tbx_enddate.Text); DataTable dtSummary = JN_WorkingPlanBLL.GetSummary(dt_begin, dt_end, int.Parse(tr_OrganizeCity.SelectValue), int.Parse(tr_Position.SelectValue), tbx_StaffName.Text.Trim(), cb_IncludeChild.Checked ? 1 : 0); if (dtSummary.Rows.Count == 0) { gv_planList.DataBind(); return; } dtSummary = MatrixTable.Matrix(dtSummary, new string[] { "营业部", "办事处", "Staff", "员工姓名", "工号", "职位", "出差天数", "负责客户数", "拜访客户数→计划", "拜访客户数→实际", "差旅费→计划", "差旅费→实际差旅费", "差旅费→实际用车费" }, new string[] { "WorkingClassify" }, "WorkCounts", true, false); dtSummary.Rows[dtSummary.Rows.Count - 1]["出差天数"] = dtSummary.Compute("SUM(出差天数)", "true"); dtSummary.Rows[dtSummary.Rows.Count - 1]["负责客户数"] = dtSummary.Compute("SUM(负责客户数)", "true"); dtSummary.Rows[dtSummary.Rows.Count - 1]["拜访客户数→计划"] = dtSummary.Compute("SUM(拜访客户数→计划)", "true"); dtSummary.Rows[dtSummary.Rows.Count - 1]["拜访客户数→实际"] = dtSummary.Compute("SUM(拜访客户数→实际)", "true"); dtSummary.Rows[dtSummary.Rows.Count - 1]["差旅费→计划"] = dtSummary.Compute("SUM(差旅费→计划)", "true"); dtSummary.Rows[dtSummary.Rows.Count - 1]["差旅费→实际差旅费"] = dtSummary.Compute("SUM(差旅费→实际差旅费)", "true"); dtSummary.Rows[dtSummary.Rows.Count - 1]["差旅费→实际用车费"] = dtSummary.Compute("SUM(差旅费→实际用车费)", "true"); gv_planList.DataSource = dtSummary; gv_planList.DataBind(); MatrixTable.GridViewMatric(gv_planList); gv_planList.Rows[gv_planList.Rows.Count - 1].Cells[0].Text = ""; break; } }
private void BindGrid() { DateTime dt_begin = DateTime.Parse(tbx_begindate.Text); DateTime dt_end = DateTime.Parse(tbx_enddate.Text); string ConditionStr = "JN_Journal.BeginTime <= '" + dt_end.ToString("yyyy-MM-dd") + "' And JN_Journal.EndTime >='" + dt_begin.ToString("yyyy-MM-dd") + "'"; if (ddl_JournalType.SelectedValue != "0") { ConditionStr += " AND JN_Journal.JournalType=" + ddl_JournalType.SelectedValue; } if (MCSTabControl1.SelectedTabItem.Value == "0") { ConditionStr += " AND JN_Journal.Staff=" + Session["UserID"].ToString(); } else { if (tbx_StaffName.Text != "") { ConditionStr += "AND Org_Staff.RealName LIKE '%" + tbx_StaffName.Text + "%'"; } #region 只显示当前员工的所有下级职位的员工计划 if (tr_Position.SelectValue != "0") { if (cb_IncludeChild.Checked || tr_Position.SelectValue == tr_Position.RootValue) { Org_PositionBLL p = new Org_PositionBLL(int.Parse(tr_Position.SelectValue)); string positions = p.GetAllChildPosition(); if (tr_Position.SelectValue != tr_Position.RootValue) { if (positions != "") { positions += ","; } positions += tr_Position.SelectValue; } ConditionStr += " AND Org_Staff.Position IN (" + positions + ")"; } else { ConditionStr += " AND Org_Staff.Position = " + tr_Position.SelectValue; } } #endregion #region 判断当前可查询的管理片区范围 if (tr_OrganizeCity.SelectValue != "1") { string orgcitys = ""; Addr_OrganizeCityBLL orgcity = new Addr_OrganizeCityBLL(int.Parse(tr_OrganizeCity.SelectValue), true); orgcitys = orgcity.GetAllChildNodeIDs(); if (orgcitys != "") { orgcitys += ","; } orgcitys += tr_OrganizeCity.SelectValue; if (orgcitys != "") { ConditionStr += " AND JN_Journal.OrganizeCity IN (" + orgcitys + ") "; } } #endregion } gv_List.OrderFields = "JN_Journal_BeginTime"; gv_List.ConditionString = ConditionStr; gv_List.BindGrid(); }
private void BindGrid() { DateTime dt_begin = DateTime.Parse(tbx_begindate.Text); DateTime dt_end = DateTime.Parse(tbx_enddate.Text); string ConditionStr = "JN_Journal.BeginTime <= '" + dt_end.ToString("yyyy-MM-dd") + "' And JN_Journal.EndTime >='" + dt_begin.ToString("yyyy-MM-dd") + "'"; if (ddl_JournalType.SelectedValue != "0") { ConditionStr += " AND JN_Journal.JournalType=" + ddl_JournalType.SelectedValue; } if (MCSTabControl1.SelectedTabItem.Value == "0") { ConditionStr += " AND JN_Journal.Staff=" + Session["UserID"].ToString(); } else { if (tbx_StaffName.Text != "") ConditionStr += "AND Org_Staff.RealName LIKE '%" + tbx_StaffName.Text + "%'"; #region 只显示当前员工的所有下级职位的员工计划 if (tr_Position.SelectValue != "0") { if (cb_IncludeChild.Checked || tr_Position.SelectValue == tr_Position.RootValue) { Org_PositionBLL p = new Org_PositionBLL(int.Parse(tr_Position.SelectValue)); string positions = p.GetAllChildPosition(); if (tr_Position.SelectValue != tr_Position.RootValue) { if (positions != "") positions += ","; positions += tr_Position.SelectValue; } ConditionStr += " AND Org_Staff.Position IN (" + positions + ")"; } else ConditionStr += " AND Org_Staff.Position = " + tr_Position.SelectValue; } #endregion #region 判断当前可查询的管理片区范围 if (tr_OrganizeCity.SelectValue != "1") { string orgcitys = ""; Addr_OrganizeCityBLL orgcity = new Addr_OrganizeCityBLL(int.Parse(tr_OrganizeCity.SelectValue), true); orgcitys = orgcity.GetAllChildNodeIDs(); if (orgcitys != "") orgcitys += ","; orgcitys += tr_OrganizeCity.SelectValue; if (orgcitys != "") ConditionStr += " AND JN_Journal.OrganizeCity IN (" + orgcitys + ") "; } #endregion } gv_List.OrderFields = "JN_Journal_BeginTime"; gv_List.ConditionString = ConditionStr; gv_List.BindGrid(); }
private void BindGrid() { string condition = " Dimission=1 AND ApproveFlag=1 "; //仅仅查询在职的 if (tbx_Condition.Text != string.Empty) { condition += " AND " + ddl_SearchType.SelectedValue + " Like '%" + this.tbx_Condition.Text.Trim() + "%'"; } if (tr_Position.SelectValue != "0") { if (cb_IncludeChild.Checked || tr_Position.SelectValue == tr_Position.RootValue) { string positions = ""; Org_PositionBLL pos = new Org_PositionBLL(int.Parse(tr_Position.SelectValue)); positions = pos.GetAllChildPosition(); if (tr_Position.SelectValue != tr_Position.RootValue) { if (positions != "") positions += ","; positions += tr_Position.SelectValue; } condition += " AND Org_Staff.Position IN (" + positions + ")"; } else condition += " AND Org_Staff.Position = " + tr_Position.SelectValue; } #region 判断当前可查询的范围 if (tr_OrganizeCity.SelectValue != "0" && tr_OrganizeCity.SelectValue != "1") { string orgcitys = ""; Addr_OrganizeCityBLL orgcity = new Addr_OrganizeCityBLL(int.Parse(tr_OrganizeCity.SelectValue)); orgcitys = orgcity.GetAllChildNodeIDs(); if (orgcitys != "") orgcitys += ","; orgcitys += tr_OrganizeCity.SelectValue; condition += " AND (Org_Staff.OrganizeCity IN (" + orgcitys + ") OR Org_Staff.ID IN (SELECT Staff FROM MCS_SYS.dbo.Org_Staff_StaffInOrganizeCity WHERE OrganizeCity IN (" + orgcitys + ")) )"; } #endregion if (Request.QueryString["ExtCondition"] != null) { condition += " AND (" + Request.QueryString["ExtCondition"] + ")"; } #region 将指定区域的上级经理加入人员选择窗口中 if (Request.QueryString["IncludeSuperManager"] != null && Request.QueryString["OrganizeCity"] != null) { int supercitymanager = 0; Addr_OrganizeCity city1 = new Addr_OrganizeCityBLL(int.Parse(Request.QueryString["OrganizeCity"])).Model; if (city1 != null) { Addr_OrganizeCity city2 = new Addr_OrganizeCityBLL(city1.SuperID).Model; if (city2 != null) supercitymanager = city2.Manager; } if (supercitymanager != 0) { condition += " OR Org_Staff.ID=" + supercitymanager.ToString(); } } #endregion gv_List.ConditionString = condition; gv_List.BindGrid(); }
private void BindGrid() { string ConditionStr = "JN_WorkingPlan.BeginDate Between '" + tbx_begindate.Text + "' AND '" + tbx_enddate.Text + " 23:59' "; switch (MCSTabControl1.SelectedTabItem.Value) { case "0": ConditionStr += " AND JN_WorkingPlan.Staff=" + Session["UserID"].ToString(); gv_List.OrderFields = "JN_WorkingPlan_ID"; gv_List.ConditionString = ConditionStr; gv_List.BindGrid(); break; case "1": if (tbx_StaffName.Text != "") ConditionStr += "AND Org_Staff.RealName LIKE '%" + tbx_StaffName.Text + "%'"; #region 只显示当前员工的所有下级职位的员工计划 if (tr_Position.SelectValue != "0") { if (cb_IncludeChild.Checked || tr_Position.SelectValue == tr_Position.RootValue) { Org_PositionBLL p = new Org_PositionBLL(int.Parse(tr_Position.SelectValue)); string positions = p.GetAllChildPosition(); if (tr_Position.SelectValue != tr_Position.RootValue) { if (positions != "") positions += ","; positions += tr_Position.SelectValue; } ConditionStr += " AND Org_Staff.Position IN (" + positions + ")"; } else ConditionStr += " AND Org_Staff.Position = " + tr_Position.SelectValue; } #endregion #region 判断当前可查询的管理片区范围 if (tr_OrganizeCity.SelectValue != "1") { string orgcitys = ""; Addr_OrganizeCityBLL orgcity = new Addr_OrganizeCityBLL(int.Parse(tr_OrganizeCity.SelectValue), true); orgcitys = orgcity.GetAllChildNodeIDs(); if (orgcitys != "") orgcitys += ","; orgcitys += tr_OrganizeCity.SelectValue; if (orgcitys != "") ConditionStr += " AND JN_WorkingPlan.OrganizeCity IN (" + orgcitys + ") "; } #endregion gv_List.OrderFields = "JN_WorkingPlan_ID"; gv_List.ConditionString = ConditionStr; gv_List.BindGrid(); break; case "2": DateTime dt_begin = DateTime.Parse(tbx_begindate.Text); DateTime dt_end = DateTime.Parse(tbx_enddate.Text); DataTable dtSummary = JN_WorkingPlanBLL.GetSummary(dt_begin, dt_end, int.Parse(tr_OrganizeCity.SelectValue), int.Parse(tr_Position.SelectValue), tbx_StaffName.Text.Trim(), cb_IncludeChild.Checked ? 1 : 0); if (dtSummary.Rows.Count == 0) { gv_planList.DataBind(); return; } dtSummary = MatrixTable.Matrix(dtSummary, new string[] { "营业部", "办事处", "Staff", "员工姓名", "工号", "职位", "出差天数", "负责客户数", "拜访客户数→计划", "拜访客户数→实际", "差旅费→计划", "差旅费→实际差旅费", "差旅费→实际用车费" }, new string[] { "WorkingClassify" }, "WorkCounts", true, false); dtSummary.Rows[dtSummary.Rows.Count - 1]["出差天数"] = dtSummary.Compute("SUM(出差天数)", "true"); dtSummary.Rows[dtSummary.Rows.Count - 1]["负责客户数"] = dtSummary.Compute("SUM(负责客户数)", "true"); dtSummary.Rows[dtSummary.Rows.Count - 1]["拜访客户数→计划"] = dtSummary.Compute("SUM(拜访客户数→计划)", "true"); dtSummary.Rows[dtSummary.Rows.Count - 1]["拜访客户数→实际"] = dtSummary.Compute("SUM(拜访客户数→实际)", "true"); dtSummary.Rows[dtSummary.Rows.Count - 1]["差旅费→计划"] = dtSummary.Compute("SUM(差旅费→计划)", "true"); dtSummary.Rows[dtSummary.Rows.Count - 1]["差旅费→实际差旅费"] = dtSummary.Compute("SUM(差旅费→实际差旅费)", "true"); dtSummary.Rows[dtSummary.Rows.Count - 1]["差旅费→实际用车费"] = dtSummary.Compute("SUM(差旅费→实际用车费)", "true"); gv_planList.DataSource = dtSummary; gv_planList.DataBind(); MatrixTable.GridViewMatric(gv_planList); gv_planList.Rows[gv_planList.Rows.Count - 1].Cells[0].Text = ""; break; } }
private void BindGrid() { string condition = " Org_Staff.Dimission=" + ViewState["Dimission"].ToString(); #region 根据职位的范围查询 if (tr_Position.SelectValue != tr_Position.RootValue && tr_Position.SelectValue != "0") { if (chb_ToPositionChild.Checked) { #region 绑定子职位 Org_PositionBLL _bll = new Org_PositionBLL(int.Parse(tr_Position.SelectValue)); string ids = ""; ids = _bll.GetAllChildPosition(); #endregion if (ids != "") { condition += " and Org_Staff.Position in(" + tr_Position.SelectValue + "," + ids + ")"; } else { condition += " and Org_Staff.Position =" + tr_Position.SelectValue; } } else { condition += " and Org_Staff.Position =" + tr_Position.SelectValue; } } #endregion #region 判断当前可查询的范围 if (tr_OrganizeCity.SelectValue != "1") { Addr_OrganizeCityBLL orgcity = new Addr_OrganizeCityBLL(int.Parse(tr_OrganizeCity.SelectValue)); string orgcitys = orgcity.GetAllChildNodeIDs(); if (orgcitys != "") { orgcitys += ","; } orgcitys += tr_OrganizeCity.SelectValue; if (orgcitys != "") { condition += " AND Org_Staff.OrganizeCity IN (" + orgcitys + ")"; } } #endregion if (ddl_ApproveFlag.SelectedValue != "0") { condition += " And Org_Staff.ApproveFlag =" + ddl_ApproveFlag.SelectedValue; } ud_grid.ConditionString = condition; if (ViewState["ConditionString"] != null) { ud_grid.ConditionString += " AND " + ViewState["ConditionString"].ToString(); } ud_grid.BindGrid(); }