AreaBLL _AreaBLL = new AreaBLL(); //实例化 /// <summary> /// 初始化数据 /// </summary> private void InitData() { if (!string.IsNullOrEmpty(Request.QueryString["GA03001"])) { DataTable dt = _AreaBLL.SelectSystemAreaById(Request.QueryString["GA03001"]); if (dt != null && dt.Rows.Count > 0) { this.txtGA03002.Text = dt.Rows[0]["GA03002"].ToString(); this.txtGA03004.Text = dt.Rows[0]["GA03004"].ToString(); this.ID.Value = dt.Rows[0]["GA03001"].ToString(); } } }
AreaBLL _AreaBLL = new AreaBLL(); //实例化 /// <summary> /// 初始化数据 /// </summary> private void InitData() { if (!string.IsNullOrEmpty(Request.QueryString["GA03001"])) { DataTable dt = _AreaBLL.SelectSystemAreaById(Request.QueryString["GA03001"]); if (dt != null && dt.Rows.Count > 0) { DataTable dt1 = _AreaBLL.SelectSystemAreaForProvince(); this.drpProvince.DataSource = dt1; this.drpProvince.DataValueField = "GA03001"; this.drpProvince.DataTextField = "GA03002"; this.drpProvince.DataBind(); this.drpProvince.Items.Insert(0, new ListItem("请选择", "")); this.txtGA03002.Text = dt.Rows[0]["GA03002"].ToString(); this.txtGA03004.Text = dt.Rows[0]["GA03004"].ToString(); this.drpProvince.SelectedValue = dt.Rows[0]["GA03003"].ToString(); this.ID.Value = dt.Rows[0]["GA03001"].ToString(); } } }
/// <summary> /// 数据初始化绑定 /// </summary> private void DataBind() { if (string.IsNullOrEmpty(Request.QueryString["CA01001"])) { Response.Redirect("CA0101List.aspx"); } DataTable dt = _CustomerManagementLogic.SelectCustomerBase(string.Format(" AND CA01001 = '{0}'", Request.QueryString["CA01001"])); try { this.ID.Value = dt.Rows[0]["CA01001"].ToString(); this.txtCA01002.Text = dt.Rows[0]["CA01002"].ToString(); this.txtCA01003.Text = dt.Rows[0]["CA01003"].ToString(); this.txtCA01004.Text = dt.Rows[0]["CA01004"].ToString().Replace("’", "'"); this.txtCA01005.Text = dt.Rows[0]["CA01005"].ToString(); this.txtCA01006.Text = dt.Rows[0]["CA01006"].ToString(); this.txtCA01007.Text = dt.Rows[0]["CA01007"].ToString(); this.txtCA01008.Text = dt.Rows[0]["CA01008"].ToString(); this.txtCA01009.Text = dt.Rows[0]["CA01009"].ToString(); this.txtCA01010.Text = dt.Rows[0]["CA01010"].ToString(); this.txtCA01011.Text = dt.Rows[0]["CA01011"].ToString(); this.txtCA01012.Text = dt.Rows[0]["CA01012"].ToString(); this.txtCA01014.Text = dt.Rows[0]["CA01014"].ToString(); this.txtCA01015.Text = dt.Rows[0]["CA01015"].ToString(); this.txtCA01017.Text = dt.Rows[0]["CA01017"].ToString(); this.txtCA01021.Text = dt.Rows[0]["CA01021"].ToString(); this.txtCA01026.Text = dt.Rows[0]["CA01026"].ToString(); this.txtCA01027.Text = dt.Rows[0]["CA01027"].ToString(); this.txtCA01028.Text = dt.Rows[0]["CA01028"].ToString(); this.txtCA01029.Text = dt.Rows[0]["CA01029"].ToString(); this.txtCA01030.Text = dt.Rows[0]["CA01030"].ToString(); this.txtCA01031.Text = dt.Rows[0]["CA01031"].ToString(); this.txtCA01032.Text = dt.Rows[0]["CA01032"].ToString(); this.txtCA01033.Text = dt.Rows[0]["CA01033"].ToString(); this.txtCA01034.Text = dt.Rows[0]["CA01034"].ToString(); this.txtCA01035.Text = dt.Rows[0]["CA01035"].ToString(); this.txtCA01036.Text = dt.Rows[0]["CA01036"].ToString(); this.txtCA01037.Text = dt.Rows[0]["CA01037"].ToString(); this.txtCA01038.Text = dt.Rows[0]["CA01038"].ToString(); this.txtCA01039.Text = dt.Rows[0]["CA01039"].ToString(); this.txtCA01040.Text = dt.Rows[0]["CA01040"].ToString(); this.txtCA01041.Text = dt.Rows[0]["CA01041"].ToString(); this.txtCA01042.Text = dt.Rows[0]["CA01042"].ToString(); this.txtCA01043.Text = dt.Rows[0]["CA01043"].ToString(); this.txtCA01044.Text = dt.Rows[0]["CA01044"].ToString(); this.txtCA01045.Text = dt.Rows[0]["CA01045"].ToString(); this.txtCA01046.Text = dt.Rows[0]["CA01046"].ToString(); this.txtCA01048.Text = dt.Rows[0]["CA01048"].ToString(); this.txtCA01049.Text = dt.Rows[0]["CA01049"].ToString(); this.txtCA01050.Text = dt.Rows[0]["CA01050"].ToString(); this.txtCA01051.Text = dt.Rows[0]["CA01051"].ToString(); //拿出区域上级编码 if (!string.IsNullOrEmpty(dt.Rows[0]["CA01013"].ToString())) { DataTable dtGA03 = _DataManagementLogic.SelectSystemAreaById(dt.Rows[0]["CA01013"].ToString()); this.ddlGA03Province.SelectedValue = dtGA03.Rows[0]["GA03003"].ToString(); //绑定此省下所有的市(区域) DataTable dtGA0301 = _DataManagementLogic.SelectSystemAreaForCity(dtGA03.Rows[0]["GA03003"].ToString()); this.ddlGA03City.DataSource = dtGA0301; this.ddlGA03City.DataTextField = "GA03002"; this.ddlGA03City.DataValueField = "GA03001"; this.ddlGA03City.DataBind(); //设置市下拉选中数据库中对应的区域编码 this.ddlGA03City.Value = dt.Rows[0]["CA01013"].ToString(); } //根据行业分类,获取行业分类下所有的行业代码 DataTable dtCB04 = _CustomerManagementLogic.SelectCustomerTradeCodeByCB04003(dt.Rows[0]["CA01019"].ToString()); this.ddlCA01020.DataSource = dtCB04; this.ddlCA01020.DataTextField = "CB04002"; this.ddlCA01020.DataValueField = "CB04001"; this.ddlCA01020.DataBind(); this.ddlCA01020.Items.Insert(0, new ListItem("请选择", "")); //设置行业代码下拉选中数据库中对应的行业编码 this.ddlCA01020.Value = dt.Rows[0]["CA01020"].ToString(); this.ddlCA01016.SelectedValue = dt.Rows[0]["CA01016"].ToString(); this.ddlCA01018.SelectedValue = dt.Rows[0]["CA01018"].ToString(); this.ddlCA01019.SelectedValue = dt.Rows[0]["CA01019"].ToString(); this.ddlCA01022.SelectedValue = dt.Rows[0]["CA01022"].ToString(); this.ddlCA01023.SelectedValue = dt.Rows[0]["CA01023"].ToString(); if (dt.Rows[0]["CA01024"].ToString().Trim() == "1") { this.rbtnCA01024Yes.Checked = true; } else if (dt.Rows[0]["CA01024"].ToString().Trim() == "0") { this.rbtnCA01024No.Checked = true; } if (dt.Rows[0]["CA01025"].ToString().Trim() == "1") { this.rbtnCA01025Yes.Checked = true; } else if (dt.Rows[0]["CA01025"].ToString().Trim() == "0") { this.rbtnCA01025No.Checked = true; } if (dt.Rows[0]["CA01047"].ToString().Trim() == "1") { this.rbtnCA01047Yes.Checked = true; } else if (dt.Rows[0]["CA01047"].ToString().Trim() == "0") { this.rbtnCA01047No.Checked = true; } if (dt.Rows[0]["CA01052"].ToString().Trim() == "1") { this.rbtnCA01052Yes.Checked = true; } else if (dt.Rows[0]["CA01052"].ToString().Trim() == "0") { this.rbtnCA01052No.Checked = true; } } catch { Response.Write("<script>alert('数据异常!');window.location.href = '/Page/CustomerManagement/CA0101List.aspx';</script>"); } }