private void BindOfficialPopulation() { if ((int)ViewState["ID"] > 0) { Addr_OfficialCityPopulationBLL populationBindBll = new Addr_OfficialCityPopulationBLL((int)ViewState["ID"]); Addr_OfficialCityBLL bll = new Addr_OfficialCityBLL((int)ViewState["ID"]); DataTable officialDatatable = bll.GetAllChildNode(); if (officialDatatable.Rows.Count <= 0) { pl_Details.Visible = true; btn_SavePopulation.Visible = true; if (populationBindBll.Model == null) { populationBindBll = new Addr_OfficialCityPopulationBLL(); populationBindBll.Model.ID = bll.Model.ID; } pl_Details.BindData(populationBindBll.Model); } else { pl_Details.Visible = false; btn_SavePopulation.Visible = false; } } else { pl_Details.Visible = false; btn_SavePopulation.Visible = false; } }
protected void btn_SavePopulation_Click(object sender, EventArgs e) { Addr_OfficialCityPopulationBLL _populationBll = null; Addr_OfficialCityBLL _bll; int result = 0; if ((int)ViewState["ID"] > 0) { _bll = new Addr_OfficialCityBLL((int)ViewState["ID"]); DataTable officialPopulation = _bll.GetAllChildNode(); if (officialPopulation.Rows.Count <= 0) { _populationBll = new Addr_OfficialCityPopulationBLL((int)ViewState["ID"]); if (_populationBll.Model == null) { _populationBll = new Addr_OfficialCityPopulationBLL(); pl_Details.GetData(_populationBll.Model); _populationBll.Model.ID = (int)ViewState["ID"]; result = _populationBll.Add(); if (result < 0) { lbl_AlertInfo.Text = "人口信息添加失败"; } } else { pl_Details.GetData(_populationBll.Model); result = _populationBll.Update(); if (result < 0) { lbl_AlertInfo.Text = "人口信息修改失败"; } } } } }
protected void btn_SavePopulation_Click(object sender, EventArgs e) { Addr_OfficialCityPopulationBLL _populationBll = null; Addr_OfficialCityBLL _bll; int result = 0; if ((int)ViewState["ID"] > 0) { _bll = new Addr_OfficialCityBLL((int)ViewState["ID"]); DataTable officialPopulation = _bll.GetAllChildNode(); if (officialPopulation.Rows.Count <= 0) { _populationBll = new Addr_OfficialCityPopulationBLL((int)ViewState["ID"]); if (_populationBll.Model == null) { _populationBll = new Addr_OfficialCityPopulationBLL(); pl_Details.GetData(_populationBll.Model); _populationBll.Model.ID = (int)ViewState["ID"]; result = _populationBll.Add(); if (result < 0) { lbl_AlertInfo.Text = "人口信息添加失败"; } } else { pl_Details.GetData(_populationBll.Model); result = _populationBll.Update(); if (result < 0) { lbl_AlertInfo.Text = "人口信息修改失败"; } } } } }
protected void btn_Delete_Click(object sender, EventArgs e) { Addr_OfficialCityBLL _bll = new Addr_OfficialCityBLL(int.Parse(lbl_ID.Text)); if (_bll.Delete() < 0) { lbl_AlertInfo.Text = "该城市包含下级城市,请勿删除"; return; } Addr_OfficialCityPopulationBLL populationbll = new Addr_OfficialCityPopulationBLL(_bll.Model.ID); if (populationbll != null) { if (populationbll.Delete() < 0) { lbl_AlertInfo.Text = "删除该区域人口统计信息时出错!"; return; } } lbl_AlertInfo.Text = ""; Response.Redirect("OfficialCityManage.aspx?SuperID=" + _bll.Model.SuperID.ToString()); }
protected void btn_Delete_Click(object sender, EventArgs e) { Addr_OfficialCityBLL _bll = new Addr_OfficialCityBLL(int.Parse(lbl_ID.Text)); if (_bll.Delete() < 0) { lbl_AlertInfo.Text = "该城市包含下级城市,请勿删除"; return; } Addr_OfficialCityPopulationBLL populationbll = new Addr_OfficialCityPopulationBLL(_bll.Model.ID); if (populationbll != null) { if (populationbll.Delete() < 0) { lbl_AlertInfo.Text = "删除该区域人口统计信息时出错!"; return; } } lbl_AlertInfo.Text = ""; Response.Redirect("OfficialCityManage.aspx?SuperID=" + _bll.Model.SuperID.ToString()); }
private void BindOfficialPopulation() { if ((int)ViewState["ID"] > 0) { Addr_OfficialCityPopulationBLL populationBindBll = new Addr_OfficialCityPopulationBLL((int)ViewState["ID"]); Addr_OfficialCityBLL bll = new Addr_OfficialCityBLL((int)ViewState["ID"]); DataTable officialDatatable = bll.GetAllChildNode(); if (officialDatatable.Rows.Count <= 0) { pl_Details.Visible = true; btn_SavePopulation.Visible = true; if (populationBindBll.Model == null) { populationBindBll = new Addr_OfficialCityPopulationBLL(); populationBindBll.Model.ID = bll.Model.ID; } pl_Details.BindData(populationBindBll.Model); } else { pl_Details.Visible = false; btn_SavePopulation.Visible = false; } } else { pl_Details.Visible = false; btn_SavePopulation.Visible = false; } }