/// <summary> /// 新增修改方法 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnSave_Click(object sender, EventArgs e) { string hid = Request["hid"] + ""; if (!string.IsNullOrWhiteSpace(hid)) { Hi.Model.SYS_Hospital hospital = new Hi.BLL.SYS_Hospital().GetModel(Convert.ToInt32(hid)); hospital.HospitalCode = this.hospitalCode.Value.Trim(); //医院编码 hospital.HospitalName = this.hospitalName.Value.Trim(); //医院全称 hospital.HospitalLevel = this.hospitalLevel.Value.Trim(); //医院级别 hospital.Province = this.hidProvince.Value.Trim(); //省 hospital.City = this.hidCity.Value.Trim(); //市 hospital.Area = this.hidArea.Value.Trim(); //区 hospital.Address = this.address.Value.Trim(); //详细地址 if (new Hi.BLL.SYS_Hospital().Update(hospital)) { Response.Redirect("hospitalInfo.aspx?hid=" + hospital.ID); } else { JScript.AlertMsgMo(this, "医院编辑失败", "function (){ window.location.reload(); }"); } } else { List <Hi.Model.SYS_Hospital> hoslist = new Hi.BLL.SYS_Hospital().GetList("", " HospitalName='" + this.hospitalName.Value.Trim() + "'", ""); if (hoslist != null && hoslist.Count > 0) { JScript.AlertMsgMo(this, "医院名称已存在", "function (){ }"); } else { Hi.Model.SYS_Hospital hospital = new Hi.Model.SYS_Hospital(); hospital.HospitalCode = this.hospitalCode.Value.Trim(); //医院编码 hospital.HospitalName = this.hospitalName.Value.Trim(); //医院全称 hospital.HospitalLevel = this.hospitalLevel.Value.Trim(); //医院级别 hospital.Province = this.hidProvince.Value.Trim(); //省 hospital.City = this.hidCity.Value.Trim(); //市 hospital.Area = this.hidArea.Value.Trim(); //区 hospital.Address = this.address.Value.Trim(); //详细地址 hospital.CreateDate = DateTime.Now; hospital.dr = false; hospital.CreateUser = UserID.ToString(); hospital.IsEnabled = true; hospital.ts = DateTime.Now; int id = new Hi.BLL.SYS_Hospital().Add(hospital); if (id > 0) { Response.Redirect("hospitalInfo.aspx?hid=" + id); } else { JScript.AlertMsgMo(this, "医院编辑失败", "function (){ window.location.reload(); }"); } } } }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(Hi.Model.SYS_Hospital model) { return(dal.Update(model)); }
/// <summary> /// 增加一条数据 /// </summary> public int Add(Hi.Model.SYS_Hospital model) { return(dal.Add(model)); }