protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { ViewState["Type"] = Request.QueryString["Type"] == null ? 0 : int.Parse(Request.QueryString["Type"]); //客户类型,1:公司仓库 2:经销商 3:终端门店 #region 设置页面Title if ((int)ViewState["Type"] == 1) lb_PageTitle.Text = "办事处出货查询"; else if ((int)ViewState["Type"] == 2) lb_PageTitle.Text = "经销商出货查询"; else if ((int)ViewState["Type"] == 3) lb_PageTitle.Text = "零售商销量查询"; else if ((int)ViewState["Type"] == 4) lb_PageTitle.Text = "办事处进货查询"; #endregion AdvancedSearch1.ExtCondition = "SVM_SalesVolume.Type=" + ViewState["Type"].ToString(); #region 判断当前可查询的范围 Org_StaffBLL staff = new Org_StaffBLL((int)Session["UserID"], true); if (staff.Model.OrganizeCity > 1) { Addr_OrganizeCityBLL orgcity = new Addr_OrganizeCityBLL(staff.Model.OrganizeCity, true); string orgcitys = orgcity.GetAllChildNodeIDs(); if (orgcitys != "") orgcitys += ","; orgcitys += staff.Model.OrganizeCity.ToString(); AdvancedSearch1.ExtCondition += " AND SVM_SalesVolume.OrganizeCity IN (" + orgcitys + ")"; } #endregion } }
public void BindData() { string condition = ""; DateTime dtBegin = DateTime.Parse(this.tbx_begin.Text); DateTime dtEnd = DateTime.Parse(this.tbx_end.Text).AddDays(1); condition = "HR_ZhaoPinApply.InsertTime BETWEEN '" + dtBegin.ToString("yyyy-MM-dd") + "' AND '" + dtEnd.ToString("yyyy-MM-dd") + "' "; 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; condition += " AND HR_ZhaoPinApply.OrganizeCity IN (" + orgcitys + ")"; } if (tr_Position.SelectValue != "0") { condition += " AND HR_ZhaoPinApply.sqgw =" + tr_Position.SelectValue; } //Response.Write(condition); gv_List.ConditionString = condition; gv_List.BindGrid(); }
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_Add_Click(object sender, EventArgs e) { if ((int)ViewState["PriceID"] > 0) { if (tr_OrganizeCity.SelectValue != "0" && tr_OrganizeCity.SelectValue != tr_OrganizeCity.RootValue) { PDT_StandardPriceBLL bll = new PDT_StandardPriceBLL((int)ViewState["PriceID"]); Addr_OrganizeCityBLL selectedcity = new Addr_OrganizeCityBLL(int.Parse(tr_OrganizeCity.SelectValue)); string[] allparent = selectedcity.GetAllSuperNodeIDs().Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries); foreach (PDT_StandardPrice_ApplyCity city in bll.ApplyCityItems) { if (selectedcity.Model.ID == city.OrganizeCity) { MessageBox.Show(this, "对不起,该区域已在适用区域内,请勿重复添加!"); return; } if (allparent.Contains(city.OrganizeCity.ToString())) { MessageBox.Show(this, "对不起,要新增的区域的上级【" + TreeTableBLL.GetFullPathName("MCS_SYS.dbo.Addr_OrganizeCity", city.OrganizeCity) + "】已在适用区域内!"); return; } } PDT_StandardPrice_ApplyCity c = new PDT_StandardPrice_ApplyCity(); c.OrganizeCity = int.Parse(tr_OrganizeCity.SelectValue); bll.AddApplyCity(c); BindCheckBoxList(); } } }
private void BindGrid() { string condition = " 1=1 "; #region 组织查询条件 if (string.IsNullOrEmpty(tr_OrganizeCity.SelectValue) && tr_OrganizeCity.SelectValue != "0") { //管理片区及所有下属管理片区 Addr_OrganizeCityBLL orgcity = new Addr_OrganizeCityBLL(int.Parse(tr_OrganizeCity.SelectValue)); string orgcitys = orgcity.GetAllChildNodeIDs(); if (orgcitys != "") orgcitys += ","; orgcitys += tr_OrganizeCity.SelectValue; condition += " AND ORD_OrderDelivery.OrganizeCity IN (" + orgcitys + ")"; } //会计月条件 condition += " AND ORD_OrderDelivery.AccountMonth = " + ddl_Month.SelectedValue; //申请单号 if (tbx_SheetCode.Text != "") { condition += " AND ORD_OrderDelivery.SheetCode like '%" + tbx_SheetCode.Text + "%'"; } //审批状态 if (ddl_State.SelectedValue != "0") { condition += " AND ORD_OrderDelivery.State = " + ddl_State.SelectedValue; } #endregion // gv_List.ConditionString = condition; gv_List.BindGrid(); }
protected void bt_Refresh_Click(object sender, EventArgs e) { string orgcitys = ""; if (tr_OrganizeCity.SelectValue != "0") { Addr_OrganizeCityBLL orgcity = new Addr_OrganizeCityBLL(int.Parse(tr_OrganizeCity.SelectValue), true); orgcitys = orgcity.GetAllChildNodeIDs(); if (orgcitys != "") orgcitys += ","; orgcitys += tr_OrganizeCity.SelectValue; } else { MessageBox.Show(this, "请选择要查询的管理片区!"); return; } ReportParameter[] _parms = { new ReportParameter("OrganizeCitys", orgcitys), new ReportParameter("BeginMonth", ddl_BeginMonth.SelectedValue), new ReportParameter("EndMonth", ddl_EndMonth.SelectedValue) }; ReportViewer1.ServerReport.ReportServerCredentials = new MCSReportServerCredentials(); ReportViewer1.ServerReport.ReportPath = ViewState["ReportPath"].ToString(); ReportViewer1.ServerReport.ReportServerUrl = new Uri(ViewState["ReportServerUrl"].ToString()); ReportViewer1.ServerReport.SetParameters(_parms); // ReportViewer1.ServerReport.Refresh(); }
private void BindGrid() { string condition = "1=1"; #region 组织查询条件 if (chb_ToOrganizecityChild.Checked) { Addr_OrganizeCityBLL orgcity = new Addr_OrganizeCityBLL(int.Parse(tr_OrganizeCity.SelectValue)); string orgcitys = orgcity.GetAllChildNodeIDs(); if (orgcitys != "") orgcitys += ","; orgcitys += tr_OrganizeCity.SelectValue; condition += " AND PDT_StandardPrice.OrganizeCity IN (" + orgcitys + ")"; } else { condition += " AND PDT_StandardPrice.OrganizeCity=" + tr_OrganizeCity.SelectValue; } #endregion //if (MCSTabControl1.SelectedIndex == 0) //{ // condition += " AND PDT_StandardPrice.ActiveFlag=1 AND PDT_StandardPrice.ApproveFlag=1"; //} //else //{ // condition += " AND (PDT_StandardPrice.ActiveFlag=2 OR PDT_StandardPrice.ApproveFlag=2)"; //} condition += " AND PDT_StandardPrice.ActiveFlag=1 AND PDT_StandardPrice.ApproveFlag=1"; gv_List.ConditionString = condition; gv_List.BindGrid(); }
private 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; condition += " AND FNA_StaffSalary.OrganizeCity IN (" + orgcitys + ")"; } //会计月条件 condition += " AND FNA_StaffSalary.AccountMonth Between " + ddl_BeginMonth.SelectedValue; condition += " AND " + ddl_EndMonth.SelectedValue; //审批状态 if (ddl_State.SelectedValue != "0") { condition += " AND FNA_StaffSalary.State = " + ddl_State.SelectedValue; } #endregion gv_List.ConditionString = condition; gv_List.BindGrid(); }
protected void btn_Save_Click(object sender, EventArgs e) { if ((int)ViewState["ID"] == 1) return; Addr_OrganizeCityBLL _bll; if ((int)ViewState["ID"] == 0) { _bll = new Addr_OrganizeCityBLL(); } else { _bll = new Addr_OrganizeCityBLL((int)ViewState["ID"]); } _bll.Model.Name = tbx_Name.Text; _bll.Model.SuperID = int.Parse(tree_SuperID.SelectValue); _bll.Model.Code = tbx_Code.Text; _bll.Model.Level = new Addr_OrganizeCityBLL(_bll.Model.SuperID).Model.Level + 1; if (select_Manager.SelectValue != "") _bll.Model.Manager = int.Parse(select_Manager.SelectValue); if (DictionaryBLL.GetDicCollections("Addr_OrganizeCityLevel")[_bll.Model.Level.ToString()] == null) { lbl_AlertInfo.Text = "添加城市失败,等级超出范围"; return; } _bll.Model["ManageRegion"] = tbx_ManageRegion.Text; if ((int)ViewState["ID"] == 0) { if (_bll.Add() < 0) { lbl_AlertInfo.Text = "添加城市失败。"; return; } } else { if (_bll.Model.SuperID == _bll.Model.ID) return; int ret = _bll.Update(); switch (ret) { case -1: lbl_AlertInfo.Text = "更新城市失败,城市名称已存在"; return; case -2: lbl_AlertInfo.Text = "更新城市失败,不能将当前城市设置为上级城市"; return; case -3: lbl_AlertInfo.Text = "更新城市失败,不能将当前城市的子城市设置为上级城市"; return; } } DataCache.RemoveCache("Cache-TreeTableBLL-GetAllNode-MCS_SYS.dbo.Addr_OrganizeCity"); Response.Redirect("OrganizeCityManage.aspx?SuperID=" + _bll.Model.SuperID.ToString()); }
protected void btn_Delete_Click(object sender, EventArgs e) { Addr_OrganizeCityBLL _bll = new Addr_OrganizeCityBLL(int.Parse(lbl_ID.Text)); if (_bll.Delete() < 0) { lbl_AlertInfo.Text = "该片区包含下级片区,请勿删除"; return; } lbl_AlertInfo.Text = ""; Response.Redirect("OrganizeCityManage.aspx?SuperID=" + _bll.Model.SuperID.ToString()); }
protected void bt_Generate_Click(object sender, EventArgs e) { int month = int.Parse(ddl_Month.SelectedValue); int organizecity = 0; int client = 0; int.TryParse(tr_OrganizeCity.SelectValue, out organizecity); int.TryParse(select_Client.SelectValue, out client); if (organizecity == 0) { MessageBox.Show(this, "请正确选择管理片区"); return; } if (client == 0) { MessageBox.Show(this, "请正确选择经销商"); return; } #region 判断指定区域下是否还有门店销量未审核 string citys = new Addr_OrganizeCityBLL(organizecity).GetAllChildNodeIDs(); if (citys == "") citys = organizecity.ToString(); else citys += "," + organizecity.ToString(); string condition = "Type=3 AND Supplier=" + client.ToString() + " AND AccountMonth=" + month.ToString() + " AND OrganizeCity IN (" + citys + ") AND ApproveFlag=2 AND Flag=1 AND EXISTS (SELECT 1 FROM MCS_CM.dbo.CM_Client WHERE ClientType=3 AND CM_Client.ID=SVM_SalesVolume.Client)"; int counts = SVM_SalesVolumeBLL.GetModelList(condition).Count; if (counts > 0) { MessageBox.Show(this, "对不起,您区域还有" + counts.ToString() + "条门店销量未审核"); return; } #endregion int FeeType = 0; FeeType = ConfigHelper.GetConfigInt("ContractFeeType-FL"); int id = CM_ContractBLL.CreateFLFeeApply(organizecity, month, client, (int)Session["UserID"], FeeType); if (id > 0) MessageBox.ShowAndRedirect(this, "返利费用申请单生成成功!", "FeeApplyDetail3.aspx?ID=" + id.ToString()); else if (id == 0) MessageBox.Show(this, "对不起,目前尚无返利合同需要申请费用!"); else if (id == -1) MessageBox.Show(this, "对不起,无返利费用生成!请检查是否有返利店有销量,或是之前已经生成该月的返利费用!"); else MessageBox.Show(this, "对不起,返利合同费用申请单生成失败!错误码:" + id.ToString()); }
protected void tr_OrganizeCity_Selected(object sender, MCSControls.MCSWebControls.SelectedEventArgs e) { int c = 0; if (int.TryParse(tr_OrganizeCity.SelectValue, out c)) { Addr_OrganizeCity city = new Addr_OrganizeCityBLL(c).Model; if (city.Level == 5) ddl_CityLevel.SelectedValue = "5"; else if (city.Level > 2) ddl_CityLevel.SelectedValue = "4"; else ddl_CityLevel.SelectedValue = "2"; } }
protected void BtnSave_Click(object sender, EventArgs e) { Addr_OrganizeCity mcity = new Addr_OrganizeCityBLL(int.Parse(tr_OrganizeCity.SelectValue)).Model; if (MCSTabControl1.SelectedTabItem.Value == "1" && mcity != null && mcity.Level != ConfigHelper.GetConfigInt("OrganizePartCity-CityLevel")) { MessageBox.Show(this, "请选择营业部再调整!"); return; } if (MCSTabControl1.SelectedTabItem.Value == "2" && mcity != null && mcity.Level != ConfigHelper.GetConfigInt("OrganizeCity-CityLevel")) { MessageBox.Show(this, "请选择办事处再调整!"); return; } FNA_StaffSalaryDataObjectBetaBLL bll = new FNA_StaffSalaryDataObjectBetaBLL(); if (!CheckSalesTargetAdujst()) { return; } foreach (GridViewRow row in gv_List.Rows) { int id = (int)gv_List.DataKeys[row.RowIndex]["FNA_StaffSalaryDataObjectBeta_ID"]; TextBox txt_SalesTargetAdjust = gv_List.Rows[row.RowIndex].FindControl("tbx_SalesTargetAdujst") == null ? null : (TextBox)gv_List.Rows[row.RowIndex].FindControl("tbx_SalesTargetAdujst"); TextBox txt_SalesTargetAdjustRate = gv_List.Rows[row.RowIndex].FindControl("tbx_SalesTargetAdujstRate") == null ? null : (TextBox)gv_List.Rows[row.RowIndex].FindControl("tbx_SalesTargetAdujstRate"); decimal SalesTargetAdujst = 0, SalesTargetAdujstRate = 0; TextBox tbx_Remark = gv_List.Rows[row.RowIndex].FindControl("tbx_Remark") == null ? null : (TextBox)gv_List.Rows[row.RowIndex].FindControl("tbx_Remark"); DropDownList ddl_Flag = row.FindControl("ddl_Flag") == null ? null : (DropDownList)row.FindControl("ddl_Flag"); if (txt_SalesTargetAdjust != null && txt_SalesTargetAdjustRate != null && decimal.TryParse(txt_SalesTargetAdjust.Text.Trim(), out SalesTargetAdujst) && decimal.TryParse(txt_SalesTargetAdjustRate.Text.Trim(), out SalesTargetAdujstRate)) { bll = new FNA_StaffSalaryDataObjectBetaBLL(id); decimal oldAdujstRate = bll.Model.Data08; bll.Model.SalesTargetAdjust = SalesTargetAdujst; bll.Model.Data08 = SalesTargetAdujstRate; bll.Model.UpdateStaff = (int)Session["UserID"]; bll.Model.UpdateTime = DateTime.Now; bll.Model["Remark"] = tbx_Remark.Text.Trim(); bll.Model.Flag = int.Parse(ddl_Flag.SelectedValue); bll.Update(); if (bll.Model.ApproveFlag == 2 && oldAdujstRate != SalesTargetAdujstRate) { FNA_StaffSalaryDataObjectBetaBLL.Adjust(bll.Model.AccountMonth, SalesTargetAdujst, bll.Model.Staff); } } } BindGrid(); }
protected void bt_Refresh_Click(object sender, EventArgs e) { string orgcitys = ""; if (tr_OrganizeCity.SelectValue != "0") { Addr_OrganizeCityBLL orgcity = new Addr_OrganizeCityBLL(int.Parse(tr_OrganizeCity.SelectValue), true); orgcitys = orgcity.GetAllChildNodeIDs(); if (orgcitys != "") orgcitys += ","; orgcitys += tr_OrganizeCity.SelectValue; } else { MessageBox.Show(this, "请选择要查询的管理片区!"); return; } ReportViewer1.ServerReport.ReportServerCredentials = new MCSReportServerCredentials(); ReportViewer1.ServerReport.ReportPath = ViewState["ReportPath"].ToString(); ReportViewer1.ServerReport.ReportServerUrl = new Uri(ViewState["ReportServerUrl"].ToString()); if (ReportViewer1.ServerReport.GetParameters().Count == 3) { int staff = 0; int position = new Org_StaffBLL((int)Session["UserID"]).Model.Position; string remark = new Org_PositionBLL(position).Model.Remark; if (remark != null && remark.Contains("OnlyViewSelfReport")) { staff = (int)Session["UserID"]; } ReportParameter[] _parms = { new ReportParameter("OrganizeCitys", orgcitys), new ReportParameter("Month", ddl_Month.SelectedValue), new ReportParameter("Staff",staff.ToString()) }; ReportViewer1.ServerReport.SetParameters(_parms); } else { ReportParameter[] _parms = { new ReportParameter("OrganizeCitys", orgcitys), new ReportParameter("Month", ddl_Month.SelectedValue) }; ReportViewer1.ServerReport.SetParameters(_parms); } }
public void BindDate() { string ConditionStr = ""; string orgcitys = ""; #region 判断当前可查询的范围 if (tr_OrganizeCity.SelectValue != "1") { Addr_OrganizeCityBLL orgcity = new Addr_OrganizeCityBLL(int.Parse(tr_OrganizeCity.SelectValue)); orgcitys = orgcity.GetAllChildNodeIDs(); if (orgcitys != "") orgcitys += ","; orgcitys += tr_OrganizeCity.SelectValue; if (orgcitys != "") ConditionStr += " MCS_Promotor.dbo.PM_SalaryLevel.OrganizeCity IN (" + orgcitys + ")"; } #endregion gv_List.ConditionString = ConditionStr; gv_List.BindGrid(); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { #region 判断当前可查询的范围 Org_StaffBLL staff = new Org_StaffBLL((int)Session["UserID"], true); if (staff.Model.OrganizeCity >1) { Addr_OrganizeCityBLL orgcity = new Addr_OrganizeCityBLL(staff.Model.OrganizeCity, true); string orgcitys = orgcity.GetAllChildNodeIDs(); if (orgcitys != "") orgcitys += ","; orgcitys += staff.Model.OrganizeCity.ToString(); as_uc_Journal.ExtCondition = " MCS_OA.dbo.JN_Journal.OrganizeCity IN (" + orgcitys + ") order by MCS_OA.dbo.JN_Journal.InsertTime desc"; } #endregion as_uc_Journal.DataKeyNames = new string[] { "JN_Journal_ID" }; } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { #region 判断当前可查询的范围 Org_StaffBLL staff = new Org_StaffBLL((int)Session["UserID"], true); if (staff.Model.OrganizeCity > 1 && staff.GetStaffOrganizeCity().Select("ID = 1").Length==0) { Addr_OrganizeCityBLL orgcity = new Addr_OrganizeCityBLL(staff.Model.OrganizeCity, true); string orgcitys = orgcity.GetAllChildNodeIDs(); if (orgcitys != "") orgcitys += ","; orgcitys += staff.Model.OrganizeCity.ToString(); AdvancedSearch1.ExtCondition = " MCS_CM.dbo.CM_Client.OrganizeCity IN (" + orgcitys + ") AND MCS_CM.dbo.CM_Client.ClientType=3"; } #endregion AdvancedSearch1.DataKeyNames = new string[] { "CM_Client_ID" }; } }
private void BindDropDown() { #region 绑定用户可管辖的片区 Org_StaffBLL staff = new Org_StaffBLL((int)Session["UserID"]); tr_OrganizeCity.DataSource = staff.GetStaffOrganizeCity(); if (tr_OrganizeCity.DataSource.Select("ID = 1").Length > 0) { tr_OrganizeCity.RootValue = "0"; tr_OrganizeCity.SelectValue = "1"; } else { tr_OrganizeCity.RootValue = new Addr_OrganizeCityBLL(staff.Model.OrganizeCity).Model.SuperID.ToString(); tr_OrganizeCity.SelectValue = staff.Model.OrganizeCity.ToString(); } #endregion //if (tr_OrganizeCity.SelectValue != "1") //{ // select_Client.PageUrl = "../CM/PopSearch/Search_SelectClient.aspx?ClientType=2&OrganizeCity=" + tr_OrganizeCity.SelectValue; //} //else //{ // select_Client.PageUrl = "../CM/PopSearch/Search_SelectClient.aspx?ClientType=2"; //} Addr_OrganizeCityBLL city = new Addr_OrganizeCityBLL(int.Parse(tr_OrganizeCity.SelectValue)); ddl_Level.DataSource = DictionaryBLL.GetDicCollections("Addr_OrganizeCityLevel").Where(p => int.Parse(p.Key) > city.Model.Level && int.Parse(p.Key) <= 4).ToList().OrderBy(p => p.Key); ddl_Level.DataBind(); ddl_Level.Items.Insert(0, new ListItem("本级", "0")); ddl_Brand.DataSource = PDT_BrandBLL.GetModelList("(IsOpponent IN (1) OR ID IN (4,5))"); ddl_Brand.DataBind(); ddl_Brand.Items.Insert(0, new ListItem("请选择", "0")); ddl_BeginMonth.DataSource = AC_AccountMonthBLL.GetModelList("Year>=" + (DateTime.Now.Year - 2).ToString()); ddl_BeginMonth.DataBind(); ddl_GiftCostClassify.DataSource = DictionaryBLL.GetDicCollections("ORD_GiftClassify"); ddl_GiftCostClassify.DataBind(); ddl_GiftCostClassify.Items.Insert(0, new ListItem("请选择", "0")); }
private void BindGrid() { string condition = " CarNo LIKE '%" + tbx_CarNo.Text + "%' "; #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 != "") condition += " AND Car_CarList.OrganizeCity IN (" + orgcitys + ") "; } #endregion gv_List.ConditionString = condition; gv_List.BindGrid(); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { #region 判断当前可查询的范围 Org_StaffBLL staff = new Org_StaffBLL((int)Session["UserID"], true); if (staff.Model.OrganizeCity > 1 && staff.GetStaffOrganizeCity().Select("ID = 1").Length == 0) { Addr_OrganizeCityBLL orgcity = new Addr_OrganizeCityBLL(staff.Model.OrganizeCity, true); string orgcitys = orgcity.GetAllChildNodeIDs(); if (orgcitys != "") orgcitys += ","; orgcitys += staff.Model.OrganizeCity.ToString(); as_uc_promotor.ExtCondition = " MCS_Promotor.dbo.PM_Promotor.OrganizeCity IN (" + orgcitys + ")"; } #endregion as_uc_promotor.DataKeyNames = new string[] { "PM_Promotor_ID" }; } }
private void BindGrid() { string ConditionStr = " 1 = 1 "; #region 判断当前可查询管理片区的范围 string orgcitys = ""; if (tr_OrganizeCity.SelectValue != "0" && tr_OrganizeCity.SelectValue != "1") { 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 dbo.CM_PropertyInTelephone.OrganizeCity IN (" + orgcitys + ")"; } #endregion gv_List.ConditionString = ConditionStr; gv_List.BindGrid(); }
private void BindGrid() { string ConditionStr = " FNA_BudgetTransferApply.AccountMonth = " + ddl_Month.SelectedValue; #region 判断当前可查询管理片区的范围 string orgcitys = ""; if (tr_OrganizeCity.SelectValue != "0" && tr_OrganizeCity.SelectValue != "1") { 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 FNA_BudgetTransferApply.ToOrganizeCity IN (" + orgcitys + ")"; } #endregion gv_List.ConditionString = ConditionStr; gv_List.BindGrid(); }
private void BindGrid() { string condition = " PM_Promotor.ID IN (SELECT TOP 1000 ID FROM MCS_Promotor.dbo.PM_Promotor WHERE 1 = 1"; if (tbx_Condition.Text != string.Empty) { condition += " And " + ddl_SearchType.SelectedValue + " Like '%" + this.tbx_Condition.Text.Trim() + "%'"; } string orgcitys = ""; #region 判断当前可查询的范围 if (tr_OrganizeCity.SelectValue != "1") { Addr_OrganizeCityBLL orgcity = new Addr_OrganizeCityBLL(int.Parse(tr_OrganizeCity.SelectValue)); orgcitys = orgcity.GetAllChildNodeIDs(); if (orgcitys != "") { orgcitys += ","; } orgcitys += tr_OrganizeCity.SelectValue; //if (condition != "") condition += " AND "; condition += " AND PM_Promotor.OrganizeCity IN (" + orgcitys + ")"; } #endregion if (ddl_ApproveFlag.SelectedValue != "0") { condition += " And PM_Promotor.ApproveFlag =" + ddl_ApproveFlag.SelectedValue; } if (ddl_Dimission.SelectedValue != "0") { condition += " And PM_Promotor.Dimission =" + ddl_Dimission.SelectedValue; } condition += ")"; gv_List.ConditionString = condition; gv_List.BindGrid(); }
protected void bt_Add_Click(object sender, EventArgs e) { IList <CM_RebateRule_ApplyCity> ApplyCitys = CM_RebateRule_ApplyCityBLL.GetModelList("RebateRule=" + ViewState["ID"].ToString()); int city = 0; if (int.TryParse(tr_OrganizeCity.SelectValue, out city) && city > 0) { if (ApplyCitys.FirstOrDefault(p => p.OrganizeCity == city) != null) { MessageBox.Show(this, "对不起,该区域已属于该返利方案,请勿重复添加!"); return; } Addr_OrganizeCityBLL c = new Addr_OrganizeCityBLL(city); foreach (DataRow row in c.GetFullPath().Rows) { if (ApplyCitys.FirstOrDefault(p => p.OrganizeCity == (int)row["ID"]) != null) { MessageBox.Show(this, "对不起,该区域的上级区域" + new Addr_OrganizeCityBLL((int)row["ID"]).Model.Name + "已属于该返利方案,请勿重复添加!"); return; } } foreach (DataRow row in c.GetAllChildNode().Rows) { if (ApplyCitys.FirstOrDefault(p => p.OrganizeCity == (int)row["ID"]) != null) { MessageBox.Show(this, "对不起,该区域的下级区域" + new Addr_OrganizeCityBLL((int)row["ID"]).Model.Name + "已属于该返利方案,请勿重复添加!"); return; } } CM_RebateRule_ApplyCityBLL bll = new CM_RebateRule_ApplyCityBLL(); bll.Model.RebateRule = (int)ViewState["ID"]; bll.Model.OrganizeCity = city; bll.Add(); } BindGrid(); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { ViewState["ClientType"] = Request.QueryString["ClientType"] == null ? 2 : int.Parse(Request.QueryString["ClientType"]); //客户类型,1:公司仓库 2:经销商 3:终端门店 #region 设置页面Title if ((int)ViewState["ClientType"] == 1) { lb_PageTitle.Text = "公司库存查询"; } else if ((int)ViewState["ClientType"] == 2) { lb_PageTitle.Text = "经销商库存查询"; } else if ((int)ViewState["ClientType"] == 3) { lb_PageTitle.Text = "零售商库存查询"; } #endregion AdvancedSearch1.ExtCondition = "CM_Client.ClientType=" + ViewState["ClientType"].ToString(); #region 判断当前可查询的范围 Org_StaffBLL staff = new Org_StaffBLL((int)Session["UserID"], true); if (staff.Model.OrganizeCity > 1) { Addr_OrganizeCityBLL orgcity = new Addr_OrganizeCityBLL(staff.Model.OrganizeCity, true); string orgcitys = orgcity.GetAllChildNodeIDs(); if (orgcitys != "") { orgcitys += ","; } orgcitys += staff.Model.OrganizeCity.ToString(); AdvancedSearch1.ExtCondition += " AND [MCS_SVM].[dbo].[SVM_Inventory].OrganizeCity IN (" + orgcitys + ")"; } #endregion } }
private void BindGrid() { string promotors = ""; AC_AccountMonth month = new AC_AccountMonthBLL(int.Parse(ddl_AccountMonth.SelectedValue)).Model; int monthdays = month.EndDate.Subtract(month.BeginDate).Days + 1; lbl_message.Text = "注意:所选会计月天数为:" + monthdays.ToString() + "天,实际工作天数不能大于会计月天数"; ViewState["monthdays"] = monthdays; string condition = "PM_SalaryDataObject.AccountMonth=" + ddl_AccountMonth.SelectedValue; 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; condition += " AND MCS_Promotor.dbo.PM_Promotor.OrganizeCity in(" + orgcitys + ") "; } if (select_promotor.SelectValue != "") { condition += " AND MCS_Promotor.dbo.PM_Promotor.ID=" + select_promotor.SelectValue; } if (ddl_ApproveFlag.SelectedValue != "0") { condition += " AND PM_SalaryDataObject.ApproveFlag=" + ddl_ApproveFlag.SelectedValue; } if (select_Client.SelectValue != "") { DataTable tb_promotor = PM_PromotorBLL.GetByDIClient(int.Parse(tr_OrganizeCity.SelectValue), int.Parse(select_Client.SelectValue), month.ID); foreach (DataRow row in tb_promotor.Rows) { promotors += row["Promotor"].ToString() + ","; } if (promotors != "") promotors = " AND PM_SalaryDataObject.Promotor IN (" + promotors.Substring(0, promotors.Length - 1) + ")"; else promotors = " AND 1 = 2"; } gv_List.ConditionString = condition + promotors; gv_List.BindGrid(); chkHeader.Checked = false; }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { BindDropDown(); if (Request.QueryString["OrganizeCity"] == null) { MessageBox.ShowAndClose(this, "参数错误!"); return; } else { ViewState["OrganizeCity"] = int.Parse(Request.QueryString["OrganizeCity"]); Addr_OrganizeCityBLL organizecity = new Addr_OrganizeCityBLL((int)ViewState["OrganizeCity"]); if (organizecity.Model == null) { MessageBox.ShowAndClose(this, "参数错误!"); return; } else if (organizecity.GetAllChildNode().Rows.Count != 0) { MessageBox.ShowAndClose(this, "要加入的管理片区必须是最低一层的架构单元!"); return; } else { lb_OrganizeCityName.Text = organizecity.Model.Name; IList<Addr_OfficialCity> lists = Addr_OfficialCityBLL.GetModelList("Name like '%" + organizecity.Model.Name + "%'"); if (lists.Count > 0) { tr_OfficialCity.SelectValue = lists[0].ID.ToString(); tr_OfficialCity_Selected(null, null); } } } } }
protected void tr_OrganizeCity_Selected(object sender, MCSControls.MCSWebControls.SelectedEventArgs e) { int c = 0; if (int.TryParse(tr_OrganizeCity.SelectValue, out c)) { Addr_OrganizeCity city = new Addr_OrganizeCityBLL(c).Model; if (city.Level == 5) { ddl_CityLevel.SelectedValue = "5"; } else if (city.Level > 2) { ddl_CityLevel.SelectedValue = "4"; } else { ddl_CityLevel.SelectedValue = "2"; } } }
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)); }
void tr_OrganizeCity_Selected(object sender, SelectedEventArgs e) { if (tr_OrganizeCity == null) { return; } int city = 0; int.TryParse(tr_OrganizeCity.SelectValue, out city); if (city > 0) { DropDownList ddl_VisitRoute = (DropDownList)pl_detail.FindControl("CM_ClientManufactInfo_VisitRoute"); if (ddl_VisitRoute != null) { ddl_VisitRoute.DataValueField = "ID"; ddl_VisitRoute.DataTextField = "Name"; ddl_VisitRoute.DataSource = VST_RouteBLL.GetByOrganizeCity(city); ddl_VisitRoute.DataBind(); ddl_VisitRoute.Items.Insert(0, new ListItem("请选择...", "0")); } #region 设置营业所编码 Addr_OrganizeCity citymodel = new Addr_OrganizeCityBLL(city).Model; TextBox tbx_OUTLOC = (TextBox)pl_detail.FindControl("CM_ClientManufactInfo_OUTLOC"); if (citymodel != null && tbx_OUTLOC != null) { tbx_OUTLOC.Text = citymodel.Code; } citymodel = new Addr_OrganizeCityBLL(citymodel.SuperID).Model; TextBox tbx_SALGRP = (TextBox)pl_detail.FindControl("CM_ClientManufactInfo_SALGRP"); if (citymodel != null && tbx_SALGRP != null) { tbx_SALGRP.Text = citymodel.Code; } #endregion } }
protected void bt_Add_Click(object sender, EventArgs e) { IList<CM_RebateRule_ApplyCity> ApplyCitys = CM_RebateRule_ApplyCityBLL.GetModelList("RebateRule=" + ViewState["ID"].ToString()); int city = 0; if (int.TryParse(tr_OrganizeCity.SelectValue, out city) && city > 0) { if (ApplyCitys.FirstOrDefault(p => p.OrganizeCity == city) != null) { MessageBox.Show(this, "对不起,该区域已属于该返利方案,请勿重复添加!"); return; } Addr_OrganizeCityBLL c = new Addr_OrganizeCityBLL(city); foreach (DataRow row in c.GetFullPath().Rows) { if (ApplyCitys.FirstOrDefault(p => p.OrganizeCity == (int)row["ID"]) != null) { MessageBox.Show(this, "对不起,该区域的上级区域" + new Addr_OrganizeCityBLL((int)row["ID"]).Model.Name + "已属于该返利方案,请勿重复添加!"); return; } } foreach (DataRow row in c.GetAllChildNode().Rows) { if (ApplyCitys.FirstOrDefault(p => p.OrganizeCity == (int)row["ID"]) != null) { MessageBox.Show(this, "对不起,该区域的下级区域" + new Addr_OrganizeCityBLL((int)row["ID"]).Model.Name + "已属于该返利方案,请勿重复添加!"); return; } } CM_RebateRule_ApplyCityBLL bll = new CM_RebateRule_ApplyCityBLL(); bll.Model.RebateRule = (int)ViewState["ID"]; bll.Model.OrganizeCity = city; bll.Add(); } BindGrid(); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { BindDropDown(); if (Request.QueryString["OrganizeCity"] == null) { MessageBox.ShowAndClose(this, "参数错误!"); return; } else { ViewState["OrganizeCity"] = int.Parse(Request.QueryString["OrganizeCity"]); Addr_OrganizeCityBLL organizecity = new Addr_OrganizeCityBLL((int)ViewState["OrganizeCity"]); if (organizecity.Model == null) { MessageBox.ShowAndClose(this, "参数错误!"); return; } else if (organizecity.GetAllChildNode().Rows.Count != 0) { MessageBox.ShowAndClose(this, "要加入的管理片区必须是最低一层的架构单元!"); return; } else { lb_OrganizeCityName.Text = organizecity.Model.Name; IList <Addr_OfficialCity> lists = Addr_OfficialCityBLL.GetModelList("Name like '%" + organizecity.Model.Name + "%'"); if (lists.Count > 0) { tr_OfficialCity.SelectValue = lists[0].ID.ToString(); tr_OfficialCity_Selected(null, null); } } } } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { #region 判断当前可查询的范围 Org_StaffBLL staff = new Org_StaffBLL((int)Session["UserID"], true); if (staff.Model.OrganizeCity > 1) { Addr_OrganizeCityBLL orgcity = new Addr_OrganizeCityBLL(staff.Model.OrganizeCity, true); string orgcitys = orgcity.GetAllChildNodeIDs(); if (orgcitys != "") { orgcitys += ","; } orgcitys += staff.Model.OrganizeCity.ToString(); as_uc_Journal.ExtCondition = " MCS_OA.dbo.JN_Journal.OrganizeCity IN (" + orgcitys + ") order by MCS_OA.dbo.JN_Journal.InsertTime desc"; } #endregion as_uc_Journal.DataKeyNames = new string[] { "JN_Journal_ID" }; } }
private void BindGrid() { int month = 0, organizecity = 0, staff = 0; DateTime trackdate = DateTime.Today; if (int.TryParse(tr_OrganizeCity.SelectValue, out organizecity) && DateTime.TryParse(tbx_TrackDate.Text, out trackdate)) { month = AC_AccountMonthBLL.GetMonthByDate(trackdate); string condition = "TrackDate = '" + trackdate.ToString("yyyy-MM-dd") + "'"; int.TryParse(select_Staff.SelectValue, out staff); if (staff > 0) { condition += " AND Staff = " + staff.ToString(); } if (organizecity > 1) { //管理片区及所有下属管理片区 Addr_OrganizeCityBLL orgcity = new Addr_OrganizeCityBLL(int.Parse(tr_OrganizeCity.SelectValue)); string orgcitys = orgcity.GetAllChildNodeIDs(); if (orgcitys != "") { orgcitys += ","; } orgcitys += tr_OrganizeCity.SelectValue; condition += " AND OrganizeCity IN (" + orgcitys + ")"; } if (ddl_IsSubmit.SelectedValue != "0") { condition += " AND MCS_SYS.dbo.UF_Spilt(ExtPropertys,'|',5)='" + ddl_IsSubmit.SelectedItem.Text + "'"; } IList <TC_TrackCard> list = TC_TrackCardBLL.GetModelList(condition); gv_List.BindGrid <TC_TrackCard>(list); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { #region 判断当前可查询的范围 Org_StaffBLL staff = new Org_StaffBLL((int)Session["UserID"], true); if (staff.Model.OrganizeCity > 1 && staff.GetStaffOrganizeCity().Select("ID = 1").Length == 0) { Addr_OrganizeCityBLL orgcity = new Addr_OrganizeCityBLL(staff.Model.OrganizeCity, true); string orgcitys = orgcity.GetAllChildNodeIDs(); if (orgcitys != "") { orgcitys += ","; } orgcitys += staff.Model.OrganizeCity.ToString(); AdvancedSearch1.ExtCondition = " MCS_CM.dbo.CM_Client.OrganizeCity IN (" + orgcitys + ") AND MCS_CM.dbo.CM_Client.ClientType=6"; } #endregion AdvancedSearch1.DataKeyNames = new string[] { "CM_Client_ID" }; } }
private void BindDropDown() { chk_Citylist.DataSource = Addr_OrganizeCityBLL.GetModelList("Level=" + ConfigHelper.GetConfigString("OrganizePartCity-CityLevel")); chk_Citylist.DataBind(); if ((int)ViewState["Type"] == 2) { MCSTabControl1.SelectedIndex = 2; tb_step1.Visible = MCSTabControl1.SelectedIndex == 0; } IList <PDT_Brand> _brandList = PDT_BrandBLL.GetModelList("IsOpponent=1"); ddl_Brand.DataTextField = "Name"; ddl_Brand.DataValueField = "ID"; ddl_Brand.DataSource = _brandList; ddl_Brand.DataBind(); ddl_Brand.Items.Insert(0, new ListItem("全部", "0")); //CheckOrganizeCity(); ddl_AccountMonth.DataSource = AC_AccountMonthBLL.GetModelList(""); ddl_AccountMonth.DataBind(); ddl_AccountMonth.SelectedValue = (AC_AccountMonthBLL.GetCurrentMonth() - 1).ToString(); }
private void BindTree(TreeNodeCollection TNC, int SuperID) { Addr_OrganizeCityBLL _bll = new Addr_OrganizeCityBLL(); IList <Addr_OrganizeCity> _modellist = _bll._GetModelList("SuperID=" + SuperID.ToString()); foreach (Addr_OrganizeCity _model in _modellist) { TreeNode tn = new TreeNode(); tn.Text = ""; if (_model.Code != "") { tn.Text = "(" + _model.Code + ")"; } tn.Text += _model.Name; tn.Value = _model.ID.ToString(); TNC.Add(tn); if (_model.ID == 1) { BindTree(tn.ChildNodes, _model.ID); } } }
private void BindGrid() { string condition = " 1 = 1 "; //管理片区及所有下属管理片区 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 (rbl_Flag.SelectedValue == "0") condition += " AND FNA_BudgetTransfer.FromOrganizeCity IN (" + orgcitys + ")"; else condition += " AND FNA_BudgetTransfer.ToOrganizeCity IN (" + orgcitys + ")"; } condition += " AND FNA_BudgetTransfer.InsertTime Between '" + tbx_BeginDate.Text + "' AND DateAdd(day,1,'" + tbx_EndDate.Text + "')"; gv_List.ConditionString = condition; gv_List.BindGrid(); }
private void BindGrid() { AC_AccountMonth month = new AC_AccountMonthBLL(int.Parse(ddl_AccountMonth.SelectedValue)).Model; int monthdays = month.EndDate.Subtract(month.BeginDate).Days + 1; ViewState["monthdays"] = monthdays; string condition = "FNA_StaffSalaryDataObject.AccountMonth=" + ddl_AccountMonth.SelectedValue; 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; condition += " AND MCS_SYS.dbo.Org_Staff.OrganizeCity in(" + orgcitys + ") "; } if (select_Staff.SelectValue != "") { condition += " AND MCS_SYS.dbo.Org_Staff.ID=" + select_Staff.SelectValue; } if (rbl_ApproveFlag.SelectedValue != "0") { condition += " AND FNA_StaffSalaryDataObject.SubmitFlag=" + rbl_ApproveFlag.SelectedValue; } if (MCSTabControl1.SelectedIndex == 0) { condition += " AND FNA_StaffSalaryDataObject.Position=210"; } else { condition += " AND FNA_StaffSalaryDataObject.Position!=210"; } gv_List.ConditionString = condition + " ORDER BY MCS_SYS.dbo.UF_GetSuperOrganizeCityByLevel02(Org_Staff.OrganizeCity,3),MCS_SYS.dbo.UF_GetSuperOrganizeCityByLevel02(Org_Staff.OrganizeCity,4)"; gv_List.BindGrid(); }
private void BindGrid() { string ConditionString = " ORD_OrderLimitFactor.AccountMonth=" + ddl_AccountMonth.SelectedValue; if (select_client.SelectValue != "") { ConditionString += " AND ORD_OrderLimitFactor.Client=" + select_client.SelectValue; } if (ddl_Classify.SelectedValue != "0") { ConditionString += " AND MCS_Pub.dbo.PDT_Product.Classify=" + ddl_Classify.SelectedValue; } if (ddl_Brand.SelectedValue != "0") { ConditionString += " AND MCS_Pub.dbo.PDT_Product.Brand=" + ddl_Brand.SelectedValue; } if (select_Product.SelectValue != "") { ConditionString += " AND ORD_OrderLimitFactor.Product=" + select_Product.SelectValue; } 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; if (orgcitys != "") { ConditionString += " AND CM_Client.OrganizeCity IN (" + orgcitys + ")"; } } gv_List.ConditionString = ConditionString; gv_List.BindGrid(); }
private void BindGrid() { string condition = "SVM_ClientSalesTarget.AccountMonth=" + ddl_AccountMonth.SelectedValue; #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; condition += " AND SVM_ClientSalesTarget.OrganizeCity IN (" + orgcitys + ")"; } if (select_client.SelectValue != "") { condition += " AND SVM_ClientSalesTarget.Client=" + select_client.SelectValue; } #endregion gv_List.ConditionString = condition; gv_List.BindGrid(); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { #region 判断当前可查询的范围 Org_StaffBLL staff = new Org_StaffBLL((int)Session["UserID"], true); if (staff.Model.OrganizeCity > 1 && staff.GetStaffOrganizeCity().Select("ID = 1").Length == 0) { Addr_OrganizeCityBLL orgcity = new Addr_OrganizeCityBLL(staff.Model.OrganizeCity, true); string orgcitys = orgcity.GetAllChildNodeIDs(); if (orgcitys != "") { orgcitys += ","; } orgcitys += staff.Model.OrganizeCity.ToString(); as_uc_promotor.ExtCondition = " MCS_Promotor.dbo.PM_Promotor.OrganizeCity IN (" + orgcitys + ")"; } #endregion as_uc_promotor.DataKeyNames = new string[] { "PM_Promotor_ID" }; } }
protected void bt_Insert2_Click(object sender, EventArgs e) { string organizeCityID = this.tr_ToOrganizeCity.SelectValue; if (organizeCityID != null && organizeCityID != "" && organizeCityID != "1") { Addr_OrganizeCityBLL _organizeCitybll = new Addr_OrganizeCityBLL(int.Parse(organizeCityID)); lb_CityChild.Items.Add(new ListItem(_organizeCitybll.Model.Name, organizeCityID.ToString())); if (this.chb_ToOganizeCityChild.Checked) { string[] childList = StringSplit(_organizeCitybll.GetAllChildNodeIDs()); foreach (string child in childList) { if (lb_CityChild.Items.FindByValue(child) == null) { _organizeCitybll = new Addr_OrganizeCityBLL(int.Parse(child)); lb_CityChild.Items.Add(new ListItem(_organizeCitybll.Model.Name, child)); } } } } }
protected void bt_Add_Click(object sender, EventArgs e) { if ((int)ViewState["Insurance"] > 0) { if (tr_OrganizeCity.SelectValue != "0" && tr_OrganizeCity.SelectValue != tr_OrganizeCity.RootValue) { PM_StdInsuranceCostBLL bll = new PM_StdInsuranceCostBLL((int)ViewState["Insurance"]); Addr_OrganizeCityBLL selectedcity = new Addr_OrganizeCityBLL(int.Parse(tr_OrganizeCity.SelectValue)); string[] allparent = selectedcity.GetAllSuperNodeIDs().Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries); IList<PM_StdInsuranceCostInCity> pms = PM_StdInsuranceCostInCityBLL.GetModelList("Insurance=" + (int)ViewState["Insurance"]); foreach (PM_StdInsuranceCostInCity p in pms) { if (selectedcity.Model.ID == p.City) { MessageBox.Show(this, "对不起,该区域已在适用区域内,请勿重复添加!"); return; } if (allparent.Contains(p.City.ToString())) { MessageBox.Show(this, "对不起,要新增的区域的上级【" + TreeTableBLL.GetFullPathName("MCS_SYS.dbo.Addr_OrganizeCity", p.City) + "】已在适用区域内!"); return; } } PM_StdInsuranceCostInCityBLL c = new PM_StdInsuranceCostInCityBLL(); c.Model.City = int.Parse(tr_OrganizeCity.SelectValue); c.Model.Insurance = bll.Model.ID; c.Model.InsertStaff = (int)Session["UserID"]; c.Model.InsertTime = DateTime.Now; c.Add(); BindCheckBoxList(); } } }
private void BindGrid() { string ConditionStr = " MCS_CM.dbo.CM_Client.ClientType = 1 "; if (tbx_Condition.Text.Trim() != "") { ConditionStr += " AND " + ddl_SearchType.SelectedValue + " LIKE '%" + this.tbx_Condition.Text.Trim() + "%'"; } string orgcitys = ""; #region 判断当前可查询的范围 if (tr_OrganizeCity.SelectValue != "1") { 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 MCS_CM.dbo.CM_Client.OrganizeCity IN (" + orgcitys + ")"; } } #endregion if (ViewState["PageIndex"] != null) { gv_List.PageIndex = Int32.Parse(ViewState["PageIndex"].ToString()); } ConditionStr += "Order by MCS_CM.dbo.CM_Client.Code"; gv_List.ConditionString = ConditionStr; gv_List.BindGrid(); }
//为控件ddl_RMSAccountEnabled赋值 //protected void ddl_RMSAccountEnabled_Select() //{ // DropDownList ddl_IsRMSClient = pl_detail.FindControl("CM_Client_IsRMSClient") as DropDownList; // DropDownList ddl_RMSAccountEnabled = pl_detail.FindControl("CM_Client_RMSAccountEnabled") as DropDownList; // TextBox tb_RMSCloseDate = pl_detail.FindControl("CM_Client_RMSCloseDate") as TextBox; // //请选择和已关闭状态下,积分状态启用否选项都为“否” // if (ddl_IsRMSClient.SelectedValue == "3")//准备启动 // { // ddl_RMSAccountEnabled.SelectedValue = "1"; // } // else if (ddl_IsRMSClient.SelectedValue == "2") // { // ddl_RMSAccountEnabled.SelectedValue = "2"; // } //} //protected void ddl_IsRMSClient_SelectedIndexChanged(object sender, EventArgs e) //{ // this.ddl_RMSAccountEnabled_Select(); //} private void tbx_FullName_TextChanged(object sender, EventArgs e) { Org_Staff staff = new Org_StaffBLL((int)Session["UserID"]).Model; string orgcitys = ""; string ConditionStr = "FullName like '%" + ((TextBox)sender).Text.Trim() + "%'"; string clients = ""; #region 判断当前可查询的范围 if (staff.OrganizeCity != 1) { Addr_OrganizeCityBLL orgcity = new Addr_OrganizeCityBLL(staff.OrganizeCity, true); orgcitys = orgcity.GetAllChildNodeIDs(); if (orgcitys != "") { orgcitys += ","; } orgcitys += staff.OrganizeCity; if (orgcitys != "") { ConditionStr += " AND CM_Client.OrganizeCity IN (" + orgcitys + ")"; } } #endregion if (ViewState["ClientID"] != null) { ConditionStr = ConditionStr + " AND ID!=" + ViewState["ClientID"].ToString(); } IList <CM_Client> clientList = CM_ClientBLL.GetModelList(ConditionStr); foreach (CM_Client client in clientList) { clients += client.FullName + "、"; } if (!string.IsNullOrEmpty(clients)) { MessageBox.Show(this, "该门店名称与已有【" + clients.Substring(0, clients.Length - 1) + "】出现相同或相似,请确认是有重复!"); } }
protected void bt_Add_Click(object sender, EventArgs e) { if ((int)ViewState["Insurance"] > 0) { if (tr_OrganizeCity.SelectValue != "0" && tr_OrganizeCity.SelectValue != tr_OrganizeCity.RootValue) { PM_StdInsuranceCostBLL bll = new PM_StdInsuranceCostBLL((int)ViewState["Insurance"]); Addr_OrganizeCityBLL selectedcity = new Addr_OrganizeCityBLL(int.Parse(tr_OrganizeCity.SelectValue)); string[] allparent = selectedcity.GetAllSuperNodeIDs().Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries); IList <PM_StdInsuranceCostInCity> pms = PM_StdInsuranceCostInCityBLL.GetModelList("Insurance=" + (int)ViewState["Insurance"]); foreach (PM_StdInsuranceCostInCity p in pms) { if (selectedcity.Model.ID == p.City) { MessageBox.Show(this, "对不起,该区域已在适用区域内,请勿重复添加!"); return; } if (allparent.Contains(p.City.ToString())) { MessageBox.Show(this, "对不起,要新增的区域的上级【" + TreeTableBLL.GetFullPathName("MCS_SYS.dbo.Addr_OrganizeCity", p.City) + "】已在适用区域内!"); return; } } PM_StdInsuranceCostInCityBLL c = new PM_StdInsuranceCostInCityBLL(); c.Model.City = int.Parse(tr_OrganizeCity.SelectValue); c.Model.Insurance = bll.Model.ID; c.Model.InsertStaff = (int)Session["UserID"]; c.Model.InsertTime = DateTime.Now; c.Add(); BindCheckBoxList(); } } }
private void BindGrid() { string condition = " 1=1 "; #region 组织查询条件 if (string.IsNullOrEmpty(tr_OrganizeCity.SelectValue) && tr_OrganizeCity.SelectValue != "0") { //管理片区及所有下属管理片区 Addr_OrganizeCityBLL orgcity = new Addr_OrganizeCityBLL(int.Parse(tr_OrganizeCity.SelectValue)); string orgcitys = orgcity.GetAllChildNodeIDs(); if (orgcitys != "") { orgcitys += ","; } orgcitys += tr_OrganizeCity.SelectValue; condition += " AND ORD_OrderDelivery.OrganizeCity IN (" + orgcitys + ")"; } //会计月条件 condition += " AND ORD_OrderDelivery.AccountMonth = " + ddl_Month.SelectedValue; //申请单号 if (tbx_SheetCode.Text != "") { condition += " AND ORD_OrderDelivery.SheetCode like '%" + tbx_SheetCode.Text + "%'"; } //审批状态 if (ddl_State.SelectedValue != "0") { condition += " AND ORD_OrderDelivery.State = " + ddl_State.SelectedValue; } #endregion // gv_List.ConditionString = condition; gv_List.BindGrid(); }
protected void tr_OrganizeCity_Selected(object sender, MCSControls.MCSWebControls.SelectedEventArgs e) { if (tr_OrganizeCity.SelectValue != "0") { Addr_OrganizeCity city = new Addr_OrganizeCityBLL((int.Parse(tr_OrganizeCity.SelectValue))).Model; ddl_Level.DataSource = DictionaryBLL.GetDicCollections("Addr_OrganizeCityLevel").Where(p => int.Parse(p.Key) >= city.Level).ToList().OrderBy(p => p.Key); ddl_Level.DataBind(); if (ddl_Level.Items.Count == 0) { ddl_Level.Items.Add(new ListItem("本级", city.Level.ToString())); } int level = city.Level + 1; if (city.Level == 3) { level = city.Level + 2; } if (ddl_Level.Items.FindByValue(level.ToString()) != null) { ddl_Level.SelectedValue = level.ToString(); } } }
private 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; condition += " AND CM_Client.OrganizeCity IN (" + orgcitys + ")"; } if (cbx_Valid.Checked) { condition += " AND getdate() between PDT_ProductPrice.BeginDate and PDT_ProductPrice.EndDate "; } if (select_Client.SelectValue != "") { condition += " AND PDT_ProductPrice.Client = " + select_Client.SelectValue; } else { condition += " AND CM_Client.ClientType=" + ViewState["ClientType"].ToString(); } #endregion gv_List.ConditionString = condition; gv_List.BindGrid(); }
protected void tr_OfficialCity_Selected(object sender, MCSControls.MCSWebControls.SelectedEventArgs e) { cbl_OfficialList.Items.Clear(); DataTable dt = TreeTableBLL.GetAllChildByNodes("MCS_SYS.dbo.Addr_OfficialCity", "ID", "SuperID", tr_OfficialCity.SelectValue); for (int i = 0; i < dt.Rows.Count; i++) { Addr_OfficialCityBLL city = new Addr_OfficialCityBLL((int)dt.Rows[i]["ID"]); if (city.Model.Level == 3) { string fullname = TreeTableBLL.GetFullPathName("MCS_SYS.dbo.Addr_OfficialCity", city.Model.ID); ListItem item = new ListItem(fullname, city.Model.ID.ToString()); IList<Addr_OfficialCityInOrganizeCity> organizecitys = Addr_OfficialCityInOrganizeCityBLL.GetModelList("OfficialCity=" + city.Model.ID.ToString()); if (organizecitys.Count > 0) { Addr_OrganizeCity organizecity = new Addr_OrganizeCityBLL(organizecitys[0].OrganizeCity).Model; if (organizecity != null) { item.Text += "; 已归属于片区:【" + organizecity.Name + "】"; } item.Enabled = false; } cbl_OfficialList.Items.Add(item); } } }
protected void bt_SyncManager_Click(object sender, EventArgs e) { Addr_OrganizeCityBLL.SyncManager(); MessageBox.Show(this, "同步结束!"); }
private void BindGrid() { int month = int.Parse(ddl_Month.SelectedValue); int organizecity = int.Parse(tr_OrganizeCity.SelectValue); int level = int.Parse(ddl_Level.SelectedValue); int state = int.Parse(ddl_State.SelectedValue); int flag = int.Parse(ddl_Flag.SelectedValue); #region 判断是否可以审批通过 string[] allowdays = Addr_OrganizeCityParamBLL.GetValueByType(1, 7).Replace(" ", "").Split(new char[] { ',', ',', ';', ';' }); string date = DateTime.Now.Day.ToString(); if (allowdays.Contains(date)) { bt_Approve.Enabled = false; bt_Approve.ToolTip = "每月21-25号不可对进销存审批通过!"; } #endregion if (new Addr_OrganizeCityBLL(organizecity).Model.Level >= 2 && month == AC_AccountMonthBLL.GetMonthByDate(DateTime.Today.AddDays(-10))) { if ((int)ViewState["ClientType"] == 3 && (int)ViewState["Type"] == 2) { DataTable dtFillDataProgress = Org_StaffBLL.GetFillDataProgress((int)Session["UserID"], true); DataRow[] rows; if (flag == 1) rows = dtFillDataProgress.Select("ItemCode='006'"); else rows = dtFillDataProgress.Select("ItemCode='012'"); if (rows.Length > 0) { int ItemTargetCount = (int)rows[0]["ItemTargetCount"]; int ItemCompleteCount = (int)rows[0]["ItemCompleteCount"]; if (ItemTargetCount > ItemCompleteCount) { MessageBox.Show(this, "对不起,还有" + (ItemTargetCount - ItemCompleteCount).ToString() + "家门店销量尚未录入,无法提交或审核!具体请查看桌面填报进度表."); bt_Approve.Enabled = false; bt_Submit.Enabled = false; } } } } if (MCSTabControl1.SelectedIndex == 0) { DataTable dt_summary = SVM_SalesVolumeBLL.GetSummaryTotal(organizecity, month, (int)ViewState["ClientType"], flag, level, state, (int)ViewState["Type"], (int)Session["UserID"]); dt_summary = MatrixTable.Matrix(dt_summary, new string[] { "管理片区名称" }, new string[] { "品牌", "段位" }, "金额", true, true); gv_Summary.DataSource = dt_summary; gv_Summary.DataBind(); MatrixTable.GridViewMatric(gv_Summary); if (dt_summary.Columns.Count >= 24) gv_Summary.Width = new Unit(dt_summary.Columns.Count * 60); else gv_Summary.Width = new Unit(100, UnitType.Percentage); } else if (MCSTabControl1.SelectedIndex == 1) { if (organizecity == 1 || new Addr_OrganizeCityBLL(organizecity).Model.Level < 2) { MessageBox.Show(this, "按客户及SKU查询时,不能按总部及大区级别查询!"); return; } DataTable dt_summary = SVM_SalesVolumeBLL.GetSummaryTotal2(organizecity, month, (int)ViewState["ClientType"], flag, state, (int)ViewState["Type"], (int)Session["UserID"]); dt_summary = MatrixTable.Matrix(dt_summary, new string[] { "管理片区名称", "客户名称", "责任业代" }, new string[] { "品牌", "产品名称" }, "数量", true, true); gv_Summary.DataSource = dt_summary; gv_Summary.DataBind(); MatrixTable.GridViewMatric(gv_Summary); if (dt_summary.Columns.Count >= 24) gv_Summary.Width = new Unit(dt_summary.Columns.Count * 60); else gv_Summary.Width = new Unit(100, UnitType.Percentage); } else { string condition = " SVM_SalesVolume.AccountMonth=" + ddl_Month.SelectedValue; IList<CM_Client> cmlist = new List<CM_Client>(); if (organizecity > 1) { Addr_OrganizeCityBLL orgcity = new Addr_OrganizeCityBLL(organizecity); string orgcitys = orgcity.GetAllChildNodeIDs(); if (orgcitys != "") orgcitys += ","; orgcitys += tr_OrganizeCity.SelectValue; cmlist = CM_ClientBLL.GetModelList("OrganizeCity IN (" + orgcitys + ") AND ActiveFlag=1 AND CM_Client.ClientType=" + ViewState["ClientType"].ToString()); if (CM_ClientBLL.GetModelList("OrganizeCity IN (" + orgcitys + ") AND ActiveFlag=1 AND CM_Client.ClientType=" + ViewState["ClientType"].ToString()).Count != 0) { condition += " AND SVM_SalesVolume.OrganizeCity IN (" + orgcitys + ")"; } } condition += ddl_Flag.SelectedValue == "1" ? " AND SVM_SalesVolume.Flag<6" : " AND SVM_SalesVolume.Flag>6"; AC_AccountMonthBLL _monthbll = new AC_AccountMonthBLL(month); if (ViewState["ClientType"] != null) { switch ((int)ViewState["ClientType"]) { case 2: if ((int)ViewState["Type"] == 1) { condition += " AND SVM_SalesVolume.Client IN( Select ID FROM MCS_CM.dbo.CM_Client Where ClientType=2 AND MCS_SYS.dbo.UF_Spilt2('MCS_CM.dbo.CM_Client',CM_Client.ExtPropertys,'DIClassify')='2'"; } else { condition += " AND SVM_SalesVolume.Supplier IN( Select ID FROM MCS_CM.dbo.CM_Client Where ClientType=2"; } break; case 3: condition += (int)ViewState["Type"] == 1 ? " AND SVM_SalesVolume.Client IN" : " AND SVM_SalesVolume.Supplier IN"; condition += "( Select ID FROM MCS_CM.dbo.CM_Client Where ClientType=3 "; break; } if (cmlist.Count == 0) { condition += " AND CM_Client.ClientManager=" + Session["UserID"].ToString(); } condition += " AND ApproveFlag=1 AND OpenTime<='" + _monthbll.Model.EndDate + "'AND ISNULL(CloseTime,GETDATE())>='" + _monthbll.Model.BeginDate + "')"; } switch (ddl_State.SelectedValue) { case "1": condition += "AND SVM_SalesVolume.ApproveFlag=2 AND MCS_SYS.dbo.UF_Spilt2('MCS_SVM.dbo.SVM_SalesVolume',SVM_SalesVolume.ExtPropertys,'SubmitFlag')='2'"; break; case "2": condition += "AND SVM_SalesVolume.ApproveFlag=2 AND MCS_SYS.dbo.UF_Spilt2('MCS_SVM.dbo.SVM_SalesVolume',SVM_SalesVolume.ExtPropertys,'SubmitFlag')='1'"; break; case "3": condition += " AND SVM_SalesVolume.ApproveFlag=1"; break; } gv_List.ConditionString = condition; gv_List.BindGrid(); } }
protected void tr_OrganizeCity_Selected(object sender, MCSControls.MCSWebControls.SelectedEventArgs e) { if (tr_OrganizeCity.SelectValue != "0") { Addr_OrganizeCity city = new Addr_OrganizeCityBLL((int.Parse(tr_OrganizeCity.SelectValue))).Model; ddl_Level.DataSource = DictionaryBLL.GetDicCollections("Addr_OrganizeCityLevel").Where(p => int.Parse(p.Key) >= city.Level).ToList().OrderBy(p => p.Key); ddl_Level.DataBind(); if (ddl_Level.Items.Count == 0) { ddl_Level.Items.Add(new ListItem("本级", city.Level.ToString())); } int level = city.Level + 1; if (city.Level == 3) level = city.Level + 2; if (ddl_Level.Items.FindByValue(level.ToString()) != null) ddl_Level.SelectedValue = level.ToString(); } }
private void BindGrid() { gv_List.Columns[2].Visible = true; gv_List.Columns[3].Visible = true; gv_List.Columns[4].Visible = true; int month = int.Parse(ddl_Month.SelectedValue); int organizecity = int.Parse(tr_OrganizeCity.SelectValue); int level = int.Parse(ddl_Level.SelectedValue); int productType = int.Parse(ddl_ProductType.SelectedValue); int brand = int.Parse(ddl_Brand.SelectedValue); int classify = int.Parse(ddl_Classify.SelectedValue); int product = select_Product.SelectValue == ""?0:int.Parse(select_Product.SelectValue); int state = int.Parse(ddl_State.SelectedValue); if (level > 10) { gv_List.Columns[3].Visible = false; gv_List.Columns[4].Visible = false; } if (level == 30) { gv_List.Columns[2].Visible = false; } if (MCSTabControl1.SelectedIndex == 0) { #region 显示汇总单数据源 DataTable dtSummary = ORD_OrderApplyBLL.GetSummaryTotal(month, organizecity, level, productType, brand, classify, product, state); if (dtSummary.Rows.Count == 0) { gv_List.DataBind(); return; } DataRow dtrow = dtSummary.NewRow(); dtrow["Level"] = "合计"; dtrow["ProductID"] = 0; dtrow["Weight"] = dtSummary.Compute("Sum(Weight)", "true"); dtrow["Price"] = dtSummary.Compute("Sum(Price)", "true"); dtrow["Quantity"] = dtSummary.Compute("Sum(Quantity)", "true"); dtSummary.Rows.Add(dtrow); gv_List.DataSource = dtSummary; gv_List.DataBind(); #endregion } else { string condition = " ORD_OrderApply.Type =1 AND ORD_OrderApply.AccountMonth = " + ddl_Month.SelectedValue; #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; condition += " AND ORD_OrderApply.OrganizeCity IN (" + orgcitys + ")"; } if (ddl_ProductType.SelectedValue != "0") { condition += " AND MCS_SYS.dbo.UF_Spilt(ORD_OrderApply.ExtPropertys,'|',4)=" + ddl_ProductType.SelectedValue; } if (ddl_Brand.SelectedValue != "0") { condition += " AND MCS_SYS.dbo.UF_Spilt(ORD_OrderApply.ExtPropertys,'|',5)=" + ddl_Brand.SelectedValue; } //审批状态 if (ddl_State.SelectedValue != "0") { condition += " AND ORD_OrderApply.State = " + ddl_State.SelectedValue; } #endregion gv_ListDetail.ConditionString = condition; gv_ListDetail.BindGrid(); } }
private void BindData() { Org_StaffBLL bll = new Org_StaffBLL((int)ViewState["ID"]); panel1.BindData(bll.Model); Header.Attributes["WebPageSubCode"] = "Modify"; gv_List.DataSource = bll.GetUserList(); gv_List.DataBind(); UploadFile1.RelateID = (int)ViewState["ID"]; UploadFile1.BindGrid(); Org_Staff m = bll.Model; if (m.ApproveFlag == 1) { if (m.Dimission == 1) { bt_AddApply.Visible = false; } bt_Approve.Visible = false; TextBox tbx_BeginWorkTime = (TextBox)panel1.FindControl("Org_Staff_BeginWorkTime"); // if (tbx_BeginWorkTime != null) tbx_BeginWorkTime.Enabled = false;//03-17暂停使用,便于维护资料 if (m.Dimission == 2) { TextBox tbx_EndWorkTime = (TextBox)panel1.FindControl("Org_Staff_EndWorkTime"); if (tbx_EndWorkTime != null) tbx_EndWorkTime.Enabled = false; } } if (m["State"] == "2") { //审批中 bt_AddApply.Visible = false; bt_OK.Visible = false; bt_CreateUser.Visible = false; bt_TaskDetail.Visible = true; bt_RevocationApply.Visible = false; } if (bll.Model.OrganizeCity > 1) { #region 绑定兼管片区 IList<Addr_OrganizeCity> staffincity = bll.StaffInOrganizeCity_GetOrganizeCitys(); Addr_OrganizeCity currentcity = new Addr_OrganizeCityBLL(bll.Model.OrganizeCity).Model; if (currentcity != null) { Addr_OrganizeCity parent = new Addr_OrganizeCityBLL(currentcity.SuperID).Model; if (parent != null) { IList<Addr_OrganizeCity> lists = Addr_OrganizeCityBLL.GetModelList("SuperID = " + parent.ID.ToString() + " AND ID <> " + bll.Model.OrganizeCity.ToString()); if (lists.Count > 0) { foreach (Addr_OrganizeCity city in lists) { if (staffincity.FirstOrDefault(p => p.ID == city.ID) == null) ddl_StaffInOrganizeCity.Items.Add(new ListItem(parent.Name + "->" + city.Name + "(" + city.Code + ")", city.ID.ToString())); } } Org_StaffBLL staff = new Org_StaffBLL((int)Session["UserID"]); Org_Position position = new Org_PositionBLL(staff.Model.Position).Model; if (currentcity.Level > 1 && position != null &&( position.IsHeadOffice == "Y" || position.Remark == "OfficeHR")) { int grandpacityid = new Addr_OrganizeCityBLL(currentcity.SuperID).Model.SuperID; string condition = "SuperID = " + grandpacityid.ToString() + " AND ID <> " + currentcity.SuperID.ToString(); if (currentcity.Level < ConfigHelper.GetConfigInt("OrganizeCity-CityLevel")) { condition = "SuperID != " +parent.ID.ToString() + " AND Level=" + (currentcity.Level-1).ToString() + " AND ID <> " + currentcity.SuperID.ToString(); } IList<Addr_OrganizeCity> bobos = Addr_OrganizeCityBLL.GetModelList(condition); foreach (Addr_OrganizeCity bobo in bobos) { IList<Addr_OrganizeCity> tangxongs = Addr_OrganizeCityBLL.GetModelList("SuperID = " + bobo.ID.ToString()); foreach (Addr_OrganizeCity city in tangxongs) { if (staffincity.FirstOrDefault(p => p.ID == city.ID) == null) ddl_StaffInOrganizeCity.Items.Add(new ListItem(bobo.Name + "->" + city.Name + "(" + city.Code + ")", city.ID.ToString())); } } } } ddl_StaffInOrganizeCity.Items.Insert(0, new ListItem("请选择...", "0")); } if (ddl_StaffInOrganizeCity.Items.Count == 0) bt_Add_StaffInOrganizeCity.Enabled = false; #endregion gv_StaffInOrganizeCity.BindGrid<Addr_OrganizeCity>(bll.StaffInOrganizeCity_GetOrganizeCitys()); } else { tr_StaffInOrganizeCity.Visible = false; } bt_OK.Text = "保 存"; bt_OK.ForeColor = System.Drawing.Color.Red; //if (new Org_StaffBLL((int)Session["UserID"]).Model.ID != 1) //{ // ((MCSTreeControl)panel1.FindControl("Org_Staff_Position")).Enabled = false; //} int budget = Org_StaffNumberLimitBLL.CheckOverBudget(m.OrganizeCity, m.Position); if (budget == 0) lb_OverBudgetInfo.Text = "当前城市该职位人员数量已等于预定的预算人数,请注意!"; else if (budget < 0) lb_OverBudgetInfo.Text = "当前城市该职位人员数量已超过预定的预算人数 " + (0 - budget).ToString() + "人,请注意!"; }
private void BindGrid() { string condition = ""; if (MCSTabControl1.SelectedIndex == 0) { tb_condition.Visible = false; bt_Add.Enabled = false; bt_Remove.Enabled = true; gv_List.Visible = true; gv_WorkPlanDetailList.Visible = false; condition = "FNA_EvectionRoute.WriteOffID=" + ViewState["WriteOffID"].ToString(); gv_List.ConditionString = condition; gv_List.BindGrid(); } else if (MCSTabControl1.SelectedIndex == 1) { tb_condition.Visible = true; bt_Add.Enabled = true; bt_Remove.Enabled = false; gv_List.Visible = true; gv_WorkPlanDetailList.Visible = false; condition = "FNA_EvectionRoute.BeginDate BETWEEN '" + tbx_begin.Text + "' AND '" + tbx_end.Text + " 23:59' "; condition += " AND FNA_EvectionRoute.WriteOffID IS NULL AND FNA_EvectionRoute.InsertStaff=" + Session["UserID"].ToString(); #region 组织查询条件 if (select_Staff.SelectValue != "") { condition += "AND FNA_EvectionRoute.RelateStaff = " + select_Staff.SelectValue; } else 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; condition += " AND FNA_EvectionRoute.RelateStaff IN (SELECT MCS_SYS.dbo.Org_Staff WHERE OrganizeCity IN (" + orgcitys + "))"; } #endregion gv_List.ConditionString = condition; gv_List.BindGrid(); } else { tb_condition.Visible = true; bt_Add.Enabled = false; bt_Remove.Enabled = false; gv_List.Visible = false; gv_WorkPlanDetailList.Visible = true; condition = "JN_WorkingPlan.State=3 AND JN_WorkingPlan.Staff=" + select_Staff.SelectValue + " AND JN_WorkingPlanDetail.BeginTime<'" + tbx_end.Text + "' AND JN_WorkingPlanDetail.EndTime>='" + tbx_begin.Text + "' AND (MCS_SYS.dbo.UF_Spilt(JN_WorkingPlanDetail.ExtPropertys,'|',1)>'0' OR MCS_SYS.dbo.UF_Spilt(JN_WorkingPlanDetail.ExtPropertys,'|',2)>'0')"; gv_WorkPlanDetailList.ConditionString = condition; gv_WorkPlanDetailList.BindGrid(); } }
private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e) { HSSFWorkbook hssfworkbook; FileStream file = new FileStream(fileName, FileMode.Open, FileAccess.ReadWrite); PDT_Product product; hssfworkbook = new HSSFWorkbook(file); ISheet sheet = hssfworkbook.GetSheetAt(0); System.Collections.IEnumerator rows = sheet.GetRowEnumerator(); int i = 0, count = getRowsCount() - 1; try { IRow headerRow = sheet.GetRow(0); if (headerRow.GetCell(0).ToString() != "营业部" || headerRow.GetCell(1).ToString() != "办事处ID" || headerRow.GetCell(2).ToString() != "办事处" || headerRow.GetCell(3).ToString() != "归属月份" || headerRow.GetCell(4).ToString() != "办事处月度费率目标" || headerRow.GetCell(5).ToString() != "办事处上月发生费用") { MessageBox.Show("工作表表头(1~6列)错误!\r\n"); return; } int month = 0; rows.MoveNext(); while (rows.MoveNext()) { i++; ((BackgroundWorker)sender).ReportProgress(i * 100 / count, i); HSSFRow row = (HSSFRow)rows.Current; if (row.GetCell(0) == null || row.GetCell(0).ToString() == "") { break; } int cloumn = 4; int cityid = 0; if (!int.TryParse(row.GetCell(1).ToString(), out cityid)) { errormessage += "办事处:" + row.GetCell(2).ToString() + "ID错误;\r\n"; row.GetCell(6).SetCellValue(errormessage); continue; } Addr_OrganizeCity _city = new Addr_OrganizeCityBLL(cityid).Model; if (_city == null || _city.Name != row.GetCell(2).ToString()) { errormessage += "办事处ID号:" + cityid.ToString() + "与办事处名称不匹配!\r\n"; row.GetCell(6).SetCellValue(errormessage); continue; } ICell cell = row.GetCell(3); if (month == 0 && headerRow.GetCell(3).ToString() == "归属月份") { //ICellStyle cellStyle = cell.CellStyle; //IDataFormat format = hssfworkbook.CreateDataFormat(); //cellStyle.DataFormat = format.GetFormat("yyyy-MM"); //cell.CellStyle = cellStyle; IList <AC_AccountMonth> _monthlist = AC_AccountMonthBLL.GetModelList("Name='" + cell.ToString() + "'"); if (_monthlist.Count > 0) { month = _monthlist[0].ID; } else { errormessage += "会计月错误;\r\n"; row.GetCell(6).SetCellValue(errormessage); continue; } } SVM_OrganizeTargetBLL bll = null; IList <SVM_OrganizeTarget> _targetlist = SVM_OrganizeTargetBLL.GetModelList("OrganizeCity=" + cityid.ToString() + "AND AccountMonth=" + month.ToString()); if (_targetlist.Count > 0) { if (_targetlist.FirstOrDefault <SVM_OrganizeTarget>(p => (p.ApproveFlag == 1)) != null) { errormessage += "办事处:" + row.GetCell(2).ToString() + "当月的重点品项已审核,不可再次导入!\r\n"; row.GetCell(6).SetCellValue(errormessage); continue; } if (_targetlist.Count == 1) { bll = new SVM_OrganizeTargetBLL(_targetlist[0].ID); } } if (bll == null) { bll = new SVM_OrganizeTargetBLL { Model = { OrganizeCity = cityid, AccountMonth = month, ApproveFlag = 2 } }; } decimal amount = 0M; if (row.GetCell(cloumn) != null && decimal.TryParse(row.GetCell(cloumn).ToString(), out amount)) { bll.Model.FeeRateTarget = amount; } else if (row.GetCell(cloumn) != null && row.GetCell(cloumn).CellType != CellType.BLANK) { errormessage += "ID号:" + cityid.ToString() + "," + _city.Name + "办事处月度费率目标:" + headerRow.GetCell(cloumn).ToString() + "金额填写错误\r\n"; row.GetCell(6).SetCellValue(errormessage); } amount = 0M; if (row.GetCell(++cloumn) != null && decimal.TryParse(row.GetCell(cloumn).ToString(), out amount)) { bll.Model["ActFee"] = amount.ToString(); decimal actSales = 0; if (decimal.TryParse(bll.Model["ActSales"], out actSales) && actSales != 0) { bll.Model.FeeYieldRate = amount * 100 / actSales; } else { bll.Model.FeeYieldRate = 0; } } else if (row.GetCell(cloumn) != null && row.GetCell(cloumn).CellType != CellType.BLANK) { errormessage += "ID号:" + cityid.ToString() + "," + _city.Name + "办事处上月发生费用:" + headerRow.GetCell(cloumn).ToString() + "金额填写错误\r\n"; row.GetCell(6).SetCellValue(errormessage); } #region 更新销量至数据库 if (bll.Model.ID > 0) { bll.Update(); improtmessage += "ID号:" + cityid.ToString() + "," + _city.Name + " 的办事处费率被成功更新!\r\n"; } else { bll.Add(); improtmessage += "ID号:" + cityid.ToString() + "," + _city.Name + " 的办事处费率已成功导入!\r\n"; } row.GetCell(6).SetCellValue("导入成功"); #endregion } } catch (System.Exception ex) { MessageBox.Show(ex.Message); } finally { FileStream writefile = new FileStream(fileName, FileMode.Open, FileAccess.ReadWrite); hssfworkbook.Write(writefile); writefile.Close(); sheet = null; } }
private void BindGrid() { int month = int.Parse(ddl_Month.SelectedValue); int organizecity = int.Parse(tr_OrganizeCity.SelectValue); int level = int.Parse(ddl_Level.SelectedValue); int state = int.Parse(ddl_State.SelectedValue); int iscxp = int.Parse(ddl_IsCXP.SelectedValue); if (new Addr_OrganizeCityBLL(organizecity).Model.Level >= 2 && month == AC_AccountMonthBLL.GetMonthByDate(DateTime.Today.AddDays(-10))) { if ((int)ViewState["ClientType"] == 3) { DataTable dtFillDataProgress = Org_StaffBLL.GetFillDataProgress((int)Session["UserID"], true); DataRow[] rows; if (iscxp == 1) { rows = dtFillDataProgress.Select("ItemCode='013'"); } else { rows = dtFillDataProgress.Select("ItemCode='007'"); } if (rows.Length > 0) { int ItemTargetCount = (int)rows[0]["ItemTargetCount"]; int ItemCompleteCount = (int)rows[0]["ItemCompleteCount"]; if (ItemTargetCount > ItemCompleteCount) { MessageBox.Show(this, "对不起,还有" + (ItemTargetCount - ItemCompleteCount).ToString() + "家门店库存尚未录入,无法提交或审核!具体请查看桌面填报进度表."); bt_Approve.Enabled = false; bt_Submit.Enabled = false; } } } } if (MCSTabControl1.SelectedIndex == 0) { DataTable dt_summary = SVM_InventoryBLL.GetSummaryTotal(organizecity, month, (int)ViewState["ClientType"], level, state, iscxp, (int)Session["UserID"]); dt_summary = MatrixTable.Matrix(dt_summary, new string[] { "管理片区名称" }, new string[] { "品牌", "段位" }, "金额", true, true); gv_Summary.DataSource = dt_summary; gv_Summary.DataBind(); MatrixTable.GridViewMatric(gv_Summary); if (dt_summary.Columns.Count >= 24) { gv_Summary.Width = new Unit(dt_summary.Columns.Count * 60); } else { gv_Summary.Width = new Unit(100, UnitType.Percentage); } } else { 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 (CM_ClientBLL.GetModelList("OrganizeCity IN (" + orgcitys + ") AND ActiveFlag=1 AND CM_Client.ClientType=" + ViewState["ClientType"].ToString()).Count != 0) { condition += " AND SVM_Inventory.OrganizeCity IN (" + orgcitys + ")"; } else { condition += " AND CM_Client.ClientManager=" + Session["UserID"].ToString(); } } condition += " AND MCS_SYS.dbo.UF_Spilt2('MCS_SVM.dbo.SVM_Inventory',SVM_Inventory.ExtPropertys,'IsCXP')=" + ddl_IsCXP.SelectedValue; //会计月条件 condition += " AND SVM_Inventory.AccountMonth =" + ddl_Month.SelectedValue; condition += " AND CM_Client.ClientType=" + ViewState["ClientType"].ToString(); switch (ddl_State.SelectedValue) { case "1": condition += " AND SVM_Inventory.ApproveFlag=2 AND MCS_SYS.dbo.UF_Spilt2('MCS_SVM.dbo.SVM_Inventory',SVM_Inventory.ExtPropertys,'SubmitFlag')='2'"; break; case "2": condition += " AND SVM_Inventory.ApproveFlag=2 AND MCS_SYS.dbo.UF_Spilt2('MCS_SVM.dbo.SVM_Inventory',SVM_Inventory.ExtPropertys,'SubmitFlag')='1'"; break; case "3": condition += " AND SVM_Inventory.ApproveFlag=1"; break; } #endregion gv_List.ConditionString = condition; gv_List.BindGrid(); } }
private void BindData(int ID) { ViewState["ID"] = ID; Addr_OrganizeCityBLL _bll = new Addr_OrganizeCityBLL(ID); lbl_ID.Text = _bll.Model.ID.ToString(); tbx_Name.Text = _bll.Model.Name; if (_bll.Model.SuperID != 0) { tree_SuperID.SelectValue = _bll.Model.SuperID.ToString(); } tbx_Code.Text = _bll.Model.Code; if (_bll.Model.Manager != 0) { select_Manager.SelectValue = _bll.Model.Manager.ToString(); select_Manager.SelectText = new Org_StaffBLL(_bll.Model.Manager).Model.RealName; } else { select_Manager.SelectValue = ""; select_Manager.SelectText = ""; } if (_bll.Model.Level != 0) { lbl_LevelName.Text = DictionaryBLL.GetDicCollections("Addr_OrganizeCityLevel")[_bll.Model.Level.ToString()].Name; } tbx_ManageRegion.Text = _bll.Model["ManageRegion"]; if (ID == 1) { btn_Save.Visible = false; btn_Delete.Visible = false; } else { btn_Save.Visible = true; btn_Delete.Visible = true; } bt_AddSub.Visible = true; MessageBox.ShowConfirm(btn_Delete, "数据删除将不可恢复,确定删除么?"); btn_Delete.Visible = Addr_OrganizeCityBLL.GetModelList("SuperID=" + ViewState["ID"].ToString()).Count == 0; lbl_AlertInfo.Text = ""; #region 绑定已关联的行政区县列表 if (_bll.Model.Level.ToString() == ConfigHelper.GetConfigString("OrganizeCity-CityLevel")) { tb_OfficialCityInOrganizeCity.Visible = true; cb_CheckAll.Checked = false; cbl_OfficialList.Items.Clear(); IList <Addr_OfficialCityInOrganizeCity> lists = Addr_OfficialCityInOrganizeCityBLL.GetModelList("OrganizeCity = " + ID.ToString()); foreach (Addr_OfficialCityInOrganizeCity e in lists) { Addr_OfficialCityBLL city = new Addr_OfficialCityBLL(e.OfficialCity); string fullname = TreeTableBLL.GetFullPathName("MCS_SYS.dbo.Addr_OfficialCity", city.Model.ID); ListItem item = new ListItem(fullname, e.ID.ToString()); cbl_OfficialList.Items.Add(item); } bt_AddOfficialCity.OnClientClick = "PopAddOfficialCity(" + ID.ToString() + ")"; } else { tb_OfficialCityInOrganizeCity.Visible = false; } #endregion }