コード例 #1
0
    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;
            }
        }
    }
コード例 #2
0
 protected void gvList_RowDataBound(object sender, GridViewRowEventArgs e)
 {
     //PM_StdInsuranceCost_ID
     if (e.Row.RowType == DataControlRowType.DataRow)
     {
         LinkButton lb_InCity = e.Row.FindControl("lb_InCity") as LinkButton;
         int        insurance = (int)gvList.DataKeys[e.Row.RowIndex]["PM_StdInsuranceCost_ID"];
         IList <PM_StdInsuranceCostInCity> costs = PM_StdInsuranceCostInCityBLL.GetModelList("Insurance=" + insurance.ToString());
         if (costs.Count > 0)
         {
             string citys = "";
             foreach (PM_StdInsuranceCostInCity c in costs)
             {
                 if (citys != "")
                 {
                     citys = ",";
                 }
                 citys += new Addr_OrganizeCityBLL(c.City).Model.Name;
             }
             lb_InCity.Text = citys;
         }
         else
         {
             lb_InCity.Text = "(默认)";
         }
         lb_InCity.OnClientClick = "PopInCity(" + insurance + ")";
     }
 }
コード例 #3
0
    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();
            }
        }
    }