Exemplo n.º 1
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();
            }
        }
    }
    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();
            }
        }
    }