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 btnDelete_Click(object sender, EventArgs e) { insuranceCost = new PM_StdInsuranceCostBLL(); if (gvList.SelectedIndex != -1) { insuranceCost.Delete((int)gvList.SelectedDataKey[0]); } btnDelete.Text = "删 除"; BindGrid(); gvList.SelectedIndex = -1; dvBasePay.Visible = false; btn_Add.Visible = true; }
protected void btnSave_Click(object sender, EventArgs e) { insuranceCost = new PM_StdInsuranceCostBLL(); dvBasePay.GetData(insuranceCost.Model); if (gvList.SelectedIndex != -1) { insuranceCost.Model.ID = (int)gvList.SelectedDataKey[0]; insuranceCost.Update(); } else BindData(insuranceCost.Add()); dvBasePay.Visible = false; btn_Add.Visible = true; gvList.SelectedIndex = -1; btnDelete.Text = "删 除"; BindGrid(); }
protected void btnSave_Click(object sender, EventArgs e) { insuranceCost = new PM_StdInsuranceCostBLL(); dvBasePay.GetData(insuranceCost.Model); if (gvList.SelectedIndex != -1) { insuranceCost.Model.ID = (int)gvList.SelectedDataKey[0]; insuranceCost.Update(); } else { BindData(insuranceCost.Add()); } dvBasePay.Visible = false; btn_Add.Visible = true; gvList.SelectedIndex = -1; btnDelete.Text = "删 除"; BindGrid(); }
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(); } } }
private void BindData(int pid) { insuranceCost = new PM_StdInsuranceCostBLL(pid); dvBasePay.BindData(insuranceCost.Model); }
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; } } }