private void listBoxControlStreet_DoubleClick(object sender, EventArgs e) { shreet = this.listBoxControlStreet.SelectedValue as Shreet; if (shreet != null) { this.textEditStreet.Text = shreet.ShreetName; IList <District> dListDistrict = DistrictManager.GetDistrictByID(shreet.DistrictId); if (dListDistrict != null) { this.textEditDistrict.Text = dListDistrict[0].DistrictName; if (dListDistrict[0].City != null) { this.textEditCity.Text = dListDistrict[0].City.CityName; this.textEditAddress.Text = dListDistrict[0].City.CityName + dListDistrict[0].DistrictName + shreet.ShreetName; } else { this.textEditAddress.Text = dListDistrict[0].DistrictName + shreet.ShreetName; } } else { this.textEditAddress.Text = shreet.ShreetName; } } else { this.textEditStreet.Text = ""; this.textEditAddress.Text = ""; } }
protected void btnSubmit_Click(object sender, EventArgs e) { if (!Page.IsValid) { return; } bool Updating = false; District oDistrict = null; if (DistrictID > 0) { oDistrict = DistrictManager.GetDistrictByID(DistrictID); Updating = oDistrict != null; } if (!Updating) { oDistrict = new District(); } oDistrict.CityID = this.ddlCityID.SelectedValue.ToInt(); oDistrict.DistrictName = this.txtDistrictName.Text; bool bSuccess = Updating ? DistrictManager.UpdateDistrict(oDistrict) : DistrictManager.InsertDistrict(oDistrict); if (bSuccess) { Redirect("/district-list?s=1"); } else { base.Warn("error.save"); } }
private void InitData() { if (DistrictID > 0) { District oDistrict = DistrictManager.GetDistrictByID(DistrictID); if (oDistrict != null) { this.ddlCityID.Select(oDistrict.CityID); this.txtDistrictName.Text = oDistrict.DistrictName; } } }
private void listBoxControlStreet_Click(object sender, EventArgs e) { shreet = this.listBoxControlStreet.SelectedValue as Shreet; if (shreet != null) { this.textEditStreet.Text = shreet.ShreetName; IList <District> dList = DistrictManager.GetDistrictByID(shreet.DistrictId); if (dList != null) { this.textEditDistrict.Text = dList[0].DistrictName; } this.bindingSourceDistrict.DataSource = dList; } else { this.textEditStreet.Text = ""; } }
private void InitData() { bool visible = false; if (DistrictID > 0) { District oDistrict = DistrictManager.GetDistrictByID(DistrictID); if (oDistrict != null) { visible = true; this.ltrDistrictID.Text = oDistrict.DistrictID.ToSureString(); this.ltrCityID.Text = oDistrict.CityID.ToSureString(); this.ltrDistrictName.Text = oDistrict.DistrictName; } } tblData.Visible = visible; if (!visible) { Warn(ResourceManager.GetResource("form.nodata")); } }