private void BindCheckBoxList() { if ((int)ViewState["Insurance"] > 0) { cbl_ApplyCity.Items.Clear(); PM_StdInsuranceCostBLL bll = new PM_StdInsuranceCostBLL((int)ViewState["Insurance"]); IList <PM_StdInsuranceCostInCity> pms = PM_StdInsuranceCostInCityBLL.GetModelList("Insurance=" + (int)ViewState["Insurance"]); foreach (PM_StdInsuranceCostInCity p in pms) { string cityname = TreeTableBLL.GetFullPathName("MCS_SYS.dbo.Addr_OrganizeCity", p.City); cbl_ApplyCity.Items.Add(new ListItem(cityname, p.ID.ToString())); } tr_OrganizeCity.DataSource = TreeTableBLL.GetAllChildNodeByNodes("MCS_SYS.dbo.Addr_OrganizeCity", "ID", "SuperID", "1"); tr_OrganizeCity.RootValue = "1"; tr_OrganizeCity.SelectValue = tr_OrganizeCity.RootValue; if (bll.Model.ApproveFlag == 1) { bt_Add.Visible = false; bt_Delete.Visible = false; tr_OrganizeCity.Enabled = false; } } }
protected void btn_Search_Click(object sender, EventArgs e) { if (select_Client.SelectValue == "" || select_Client.SelectValue == "0") { int level = int.Parse(ddl_Level.SelectedValue); string citys = ""; DataTable dt = TreeTableBLL.GetAllChildNodeByNodes("MCS_SYS.dbo.Addr_OrganizeCity", "ID", "SuperID", tr_OrganizeCity.SelectValue); if (level > 0) { foreach (DataRow row in dt.Select("Level=" + level)) { citys += row["ID"] + ","; } citys = citys.Substring(0, citys.Length - 1); } else { citys = tr_OrganizeCity.SelectValue; } ListTable <PDT_ClassifyGiftCostRate> _details = new ListTable <PDT_ClassifyGiftCostRate> (PDT_ClassifyGiftCostRateBLL.GetModelList("OrganizeCity in (" + citys + ") "), "ID"); ViewState["Details"] = _details; } else { ListTable <PDT_ClassifyGiftCostRate> _details = new ListTable <PDT_ClassifyGiftCostRate> (PDT_ClassifyGiftCostRateBLL.GetModelList("Client=" + select_Client.SelectValue), "ID"); ViewState["Details"] = _details; } BindGrid(); }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { ViewState["Client"] = Request.QueryString["Client"] == null ? 0 : int.Parse(Request.QueryString["Client"]); ViewState["OrganizeCity"] = Request.QueryString["OrganizeCity"] == null ? 0 : int.Parse(Request.QueryString["OrganizeCity"]); BindDropDown(); if ((int)ViewState["Client"] != 0) { select_Client.SelectValue = ViewState["Client"].ToString(); select_Client.SelectText = new CM_ClientBLL((int)ViewState["Client"]).Model.FullName; } else if ((int)ViewState["OrganizeCity"] != 0) { tr_OrganizeCity.SelectValue = ViewState["OrganizeCity"].ToString(); } if (select_Client.SelectValue == "" || select_Client.SelectValue == "0") { int level = int.Parse(ddl_Level.SelectedValue); string citys = ""; Addr_OrganizeCityBLL orgcity = new Addr_OrganizeCityBLL(int.Parse(tr_OrganizeCity.SelectValue)); DataTable dt = TreeTableBLL.GetAllChildNodeByNodes("MCS_SYS.dbo.Addr_OrganizeCity", "ID", "SuperID", tr_OrganizeCity.SelectValue); if (level > 0) { foreach (DataRow row in dt.Select("Level=" + level)) { citys += row["ID"] + ","; } citys = citys.Substring(0, citys.Length - 1); } else { citys = tr_OrganizeCity.SelectValue; } ListTable <PDT_ClassifyGiftCostRate> _details = new ListTable <PDT_ClassifyGiftCostRate> (PDT_ClassifyGiftCostRateBLL.GetModelList("OrganizeCity in (" + citys + ") "), "ID"); ViewState["Details"] = _details; } else { ListTable <PDT_ClassifyGiftCostRate> _details = new ListTable <PDT_ClassifyGiftCostRate> (PDT_ClassifyGiftCostRateBLL.GetModelList("Client=" + select_Client.SelectValue), "ID"); ViewState["Details"] = _details; } ViewState["MAXID"] = ((ListTable <PDT_ClassifyGiftCostRate>)ViewState["Details"]).GetListItem().Count > 0 ? ((ListTable <PDT_ClassifyGiftCostRate>)ViewState["Details"]).GetListItem().Max(p => p.ID) : 0; BindGrid(); } }
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 int forwarddays = ConfigHelper.GetConfigInt("FeeApplyForwardDays"); ddl_Month.DataSource = AC_AccountMonthBLL.GetModelList("BeginDate<='" + DateTime.Today.AddDays(forwarddays).ToString("yyyy-MM-dd") + "' AND Year>=" + (DateTime.Today.Year - 1).ToString()); ddl_Month.DataBind(); ddl_Month.SelectedValue = AC_AccountMonthBLL.GetMonthByDate(DateTime.Now.AddDays(forwarddays)).ToString(); ddl_FeeType.DataSource = DictionaryBLL.GetDicCollections("FNA_FeeType").OrderBy(p => p.Value.Name); ddl_FeeType.DataBind(); ddl_FeeType.Items.Insert(0, new ListItem("全部", "0")); ddl_State.DataSource = DictionaryBLL.GetDicCollections("FNA_FeeApplyState"); ddl_State.DataBind(); ddl_State.Items.Insert(0, new ListItem("全部", "0")); AC_AccountTitle title = new AC_AccountTitleBLL(int.Parse(ViewState["AccountTitle"].ToString())).Model; if (title != null) { DataTable dt = TreeTableBLL.GetAllChildNodeByNodes("MCS_Pub.dbo.AC_AccountTitle", "ID", "SuperID", title.ID.ToString()); DataRow dr = dt.NewRow(); dr["ID"] = title.ID; dr["SuperID"] = 1; dr["Name"] = title.Name; dt.Rows.Add(dr); tr_AccountTitle.DataSource = dt; tr_AccountTitle.SelectValue = title.ID.ToString(); tr_AccountTitle.RootValue = "1"; } }