protected void btnSave_Click(object sender, EventArgs e) { string strErr = ""; if (!PageValidate.IsNumber(txtCityId.Text)) { strErr += "CityId格式错误!\\n"; } if (!PageValidate.IsNumber(txtProvinceId.Text)) { strErr += "ProvinceId格式错误!\\n"; } if (this.txtCityName.Text.Trim().Length == 0) { strErr += "CityName不能为空!\\n"; } if (strErr != "") { MessageBox.Show(this, strErr); return; } int CityId = int.Parse(this.txtCityId.Text); int ProvinceId = int.Parse(this.txtProvinceId.Text); string CityName = this.txtCityName.Text; Ncu.jsj.Model.City model = new Ncu.jsj.Model.City(); model.CityId = CityId; model.ProvinceId = ProvinceId; model.CityName = CityName; Ncu.jsj.BLL.City bll = new Ncu.jsj.BLL.City(); bll.Add(model); Maticsoft.Common.MessageBox.ShowAndRedirect(this, "保存成功!", "add.aspx"); }
private void ShowInfo(int CityId) { Ncu.jsj.BLL.City bll = new Ncu.jsj.BLL.City(); Ncu.jsj.Model.City model = bll.GetModel(CityId); this.lblCityId.Text = model.CityId.ToString(); this.lblProvinceId.Text = model.ProvinceId.ToString(); this.lblCityName.Text = model.CityName; }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { Ncu.jsj.BLL.City bll = new Ncu.jsj.BLL.City(); if (Request.Params["id"] != null && Request.Params["id"].Trim() != "") { int CityId = (Convert.ToInt32(Request.Params["id"])); bll.Delete(CityId); Response.Redirect("list.aspx"); } } }