public void btnSave_Click(object sender, EventArgs e) { string strErr = ""; if (!PageValidate.IsDateTime(txtD_DateTime.Text)) { strErr += "D_DateTime格式错误!\\n"; } if (this.txtD_Location.Text.Trim().Length == 0) { strErr += "D_Location不能为空!\\n"; } if (!PageValidate.IsNumber(txtD_Icd10ID.Text)) { strErr += "疾病icd10编码格式错误!\\n"; } if (this.txtD_Note.Text.Trim().Length == 0) { strErr += "死亡说明不能为空!\\n"; } if (!PageValidate.IsNumber(txtD_UserID.Text)) { strErr += "登记人,与sys_User表的格式错误!\\n"; } if (!PageValidate.IsDateTime(txtD_RegDate.Text)) { strErr += "登记日期格式错误!\\n"; } if (strErr != "") { MessageBox.Show(this, strErr); return; } int DeathID = int.Parse(this.lblDeathID.Text); DateTime D_DateTime = DateTime.Parse(this.txtD_DateTime.Text); string D_Location = this.txtD_Location.Text; int D_Icd10ID = int.Parse(this.txtD_Icd10ID.Text); string D_Note = this.txtD_Note.Text; int D_UserID = int.Parse(this.txtD_UserID.Text); DateTime D_RegDate = DateTime.Parse(this.txtD_RegDate.Text); Maticsoft.Model.record_DeathRegistration model = new Maticsoft.Model.record_DeathRegistration(); model.DeathID = DeathID; model.D_DateTime = D_DateTime; model.D_Location = D_Location; model.D_Icd10ID = D_Icd10ID; model.D_Note = D_Note; model.D_UserID = D_UserID; model.D_RegDate = D_RegDate; Maticsoft.BLL.record_DeathRegistration bll = new Maticsoft.BLL.record_DeathRegistration(); bll.Update(model); Maticsoft.Common.MessageBox.ShowAndRedirect(this, "保存成功!", "list.aspx"); }
public void btnSave_Click(object sender, EventArgs e) { string strErr=""; if(!PageValidate.IsDateTime(txtD_DateTime.Text)) { strErr+="D_DateTime格式错误!\\n"; } if(this.txtD_Location.Text.Trim().Length==0) { strErr+="D_Location不能为空!\\n"; } if(!PageValidate.IsNumber(txtD_Icd10ID.Text)) { strErr+="疾病icd10编码格式错误!\\n"; } if(this.txtD_Note.Text.Trim().Length==0) { strErr+="死亡说明不能为空!\\n"; } if(!PageValidate.IsNumber(txtD_UserID.Text)) { strErr+="登记人,与sys_User表的格式错误!\\n"; } if(!PageValidate.IsDateTime(txtD_RegDate.Text)) { strErr+="登记日期格式错误!\\n"; } if(strErr!="") { MessageBox.Show(this,strErr); return; } int DeathID=int.Parse(this.lblDeathID.Text); DateTime D_DateTime=DateTime.Parse(this.txtD_DateTime.Text); string D_Location=this.txtD_Location.Text; int D_Icd10ID=int.Parse(this.txtD_Icd10ID.Text); string D_Note=this.txtD_Note.Text; int D_UserID=int.Parse(this.txtD_UserID.Text); DateTime D_RegDate=DateTime.Parse(this.txtD_RegDate.Text); Maticsoft.Model.record_DeathRegistration model=new Maticsoft.Model.record_DeathRegistration(); model.DeathID=DeathID; model.D_DateTime=D_DateTime; model.D_Location=D_Location; model.D_Icd10ID=D_Icd10ID; model.D_Note=D_Note; model.D_UserID=D_UserID; model.D_RegDate=D_RegDate; Maticsoft.BLL.record_DeathRegistration bll=new Maticsoft.BLL.record_DeathRegistration(); bll.Update(model); Maticsoft.Common.MessageBox.ShowAndRedirect(this,"保存成功!","list.aspx"); }
private void ShowInfo(int DeathID) { Maticsoft.BLL.record_DeathRegistration bll = new Maticsoft.BLL.record_DeathRegistration(); Maticsoft.Model.record_DeathRegistration model = bll.GetModel(DeathID); this.lblDeathID.Text = model.DeathID.ToString(); this.lblD_DateTime.Text = model.D_DateTime.ToString(); this.lblD_Location.Text = model.D_Location; this.lblD_Icd10ID.Text = model.D_Icd10ID.ToString(); this.lblD_Note.Text = model.D_Note; this.lblD_UserID.Text = model.D_UserID.ToString(); this.lblD_RegDate.Text = model.D_RegDate.ToString(); }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(Maticsoft.Model.record_DeathRegistration model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update record_DeathRegistration set "); strSql.Append("D_DateTime=@D_DateTime,"); strSql.Append("D_Location=@D_Location,"); strSql.Append("D_Icd10ID=@D_Icd10ID,"); strSql.Append("D_Note=@D_Note,"); strSql.Append("D_UserID=@D_UserID,"); strSql.Append("D_RegDate=@D_RegDate"); strSql.Append(" where DeathID=@DeathID"); SqlParameter[] parameters = { new SqlParameter("@D_DateTime", SqlDbType.DateTime), new SqlParameter("@D_Location", SqlDbType.NVarChar, 50), new SqlParameter("@D_Icd10ID", SqlDbType.Int, 4), new SqlParameter("@D_Note", SqlDbType.Text), new SqlParameter("@D_UserID", SqlDbType.Int, 4), new SqlParameter("@D_RegDate", SqlDbType.DateTime), new SqlParameter("@DeathID", SqlDbType.Int, 4) }; parameters[0].Value = model.D_DateTime; parameters[1].Value = model.D_Location; parameters[2].Value = model.D_Icd10ID; parameters[3].Value = model.D_Note; parameters[4].Value = model.D_UserID; parameters[5].Value = model.D_RegDate; parameters[6].Value = model.DeathID; int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters); if (rows > 0) { return(true); } else { return(false); } }
/// <summary> /// 点击确定按钮执行的方法 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Button1_Click(object sender, EventArgs e) { Maticsoft.BLL.record_DeathRegistration supervision_bll = new Maticsoft.BLL.record_DeathRegistration(); Maticsoft.Model.record_DeathRegistration record_DeathRegistration_model = supervision_bll.GetModel(DeathID); if (record_DeathRegistration_model == null) { record_DeathRegistration_model = new Maticsoft.Model.record_DeathRegistration(); } //获取客户端通过Post方式传递过来的值的 record_DeathRegistration_model.D_DateTime = (DateTime)Common.sink(this.D_DateTime.UniqueID, MethodType.Post, 255, 0, DataType.Dat); record_DeathRegistration_model.D_Reason = (string)Common.sink(this.D_Reason.UniqueID, MethodType.Post, 0, 0, DataType.Str); record_DeathRegistration_model.D_Location = (string)Common.sink(this.D_Location.UniqueID, MethodType.Post, 0, 0, DataType.Str); record_DeathRegistration_model.D_RegDate = (DateTime)Common.sink(this.D_RegDate.UniqueID, MethodType.Post, 0, 0, DataType.Dat); record_DeathRegistration_model.D_UserID = Convert.ToInt32(this.D_UserID.Value); record_DeathRegistration_model.D_RegUserID = Convert.ToInt32(this.D_RegUserID.Value); switch (CMD) { case "New": CMD_Txt = "增加"; //增加操作调用Add方法 record_DeathRegistration_model.DeathID = supervision_bll.Add(record_DeathRegistration_model); if(record_DeathRegistration_model.DeathID > 0) { Maticsoft.BLL.record_UserBaseInfo record_UserBaseInfo_bll = new Maticsoft.BLL.record_UserBaseInfo(); Maticsoft.Model.record_UserBaseInfo record_UserBaseInfo_model = record_UserBaseInfo_bll.GetModel(record_DeathRegistration_model.D_UserID); record_UserBaseInfo_model.U_AuditStatus = 3; record_UserBaseInfo_bll.Update(record_UserBaseInfo_model); } break; case "Edit": CMD_Txt = "修改"; //修改操作调用Update方法 supervision_bll.Update(record_DeathRegistration_model); break; } All_Title_Txt = CMD_Txt + App_Txt; EventMessage.MessageBox(1, "操作成功", string.Format("{1}ID({0})成功!", record_DeathRegistration_model.DeathID, All_Title_Txt), Icon_Type.OK, Common.GetHomeBaseUrl("default.aspx")); }
/// <summary> /// 得到一个对象实体 /// </summary> public Maticsoft.Model.record_DeathRegistration DataRowToModel(DataRow row) { Maticsoft.Model.record_DeathRegistration model=new Maticsoft.Model.record_DeathRegistration(); if (row != null) { if(row["DeathID"]!=null && row["DeathID"].ToString()!="") { model.DeathID=int.Parse(row["DeathID"].ToString()); } if(row["D_DateTime"]!=null && row["D_DateTime"].ToString()!="") { model.D_DateTime=DateTime.Parse(row["D_DateTime"].ToString()); } if(row["D_Location"]!=null) { model.D_Location=row["D_Location"].ToString(); } if(row["D_Icd10ID"]!=null && row["D_Icd10ID"].ToString()!="") { model.D_Icd10ID=int.Parse(row["D_Icd10ID"].ToString()); } if(row["D_Note"]!=null) { model.D_Note=row["D_Note"].ToString(); } if(row["D_UserID"]!=null && row["D_UserID"].ToString()!="") { model.D_UserID=int.Parse(row["D_UserID"].ToString()); } if(row["D_RegDate"]!=null && row["D_RegDate"].ToString()!="") { model.D_RegDate=DateTime.Parse(row["D_RegDate"].ToString()); } } return model; }
/// <summary> /// 增加一条数据 /// </summary> public int Add(Maticsoft.Model.record_DeathRegistration model) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into record_DeathRegistration("); strSql.Append("D_DateTime,D_Location,D_Icd10ID,D_Note,D_UserID,D_RegDate)"); strSql.Append(" values ("); strSql.Append("@D_DateTime,@D_Location,@D_Icd10ID,@D_Note,@D_UserID,@D_RegDate)"); strSql.Append(";select @@IDENTITY"); SqlParameter[] parameters = { new SqlParameter("@D_DateTime", SqlDbType.DateTime), new SqlParameter("@D_Location", SqlDbType.NVarChar, 50), new SqlParameter("@D_Icd10ID", SqlDbType.Int, 4), new SqlParameter("@D_Note", SqlDbType.Text), new SqlParameter("@D_UserID", SqlDbType.Int, 4), new SqlParameter("@D_RegDate", SqlDbType.DateTime) }; parameters[0].Value = model.D_DateTime; parameters[1].Value = model.D_Location; parameters[2].Value = model.D_Icd10ID; parameters[3].Value = model.D_Note; parameters[4].Value = model.D_UserID; parameters[5].Value = model.D_RegDate; object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters); if (obj == null) { return(0); } else { return(Convert.ToInt32(obj)); } }
/// <summary> /// 得到一个对象实体 /// </summary> public Maticsoft.Model.record_DeathRegistration DataRowToModel(DataRow row) { Maticsoft.Model.record_DeathRegistration model = new Maticsoft.Model.record_DeathRegistration(); if (row != null) { if (row["DeathID"] != null && row["DeathID"].ToString() != "") { model.DeathID = int.Parse(row["DeathID"].ToString()); } if (row["D_DateTime"] != null && row["D_DateTime"].ToString() != "") { model.D_DateTime = DateTime.Parse(row["D_DateTime"].ToString()); } if (row["D_Location"] != null) { model.D_Location = row["D_Location"].ToString(); } if (row["D_Icd10ID"] != null && row["D_Icd10ID"].ToString() != "") { model.D_Icd10ID = int.Parse(row["D_Icd10ID"].ToString()); } if (row["D_Note"] != null) { model.D_Note = row["D_Note"].ToString(); } if (row["D_UserID"] != null && row["D_UserID"].ToString() != "") { model.D_UserID = int.Parse(row["D_UserID"].ToString()); } if (row["D_RegDate"] != null && row["D_RegDate"].ToString() != "") { model.D_RegDate = DateTime.Parse(row["D_RegDate"].ToString()); } } return(model); }
/// <summary> /// 得到一个对象实体 /// </summary> public Maticsoft.Model.record_DeathRegistration GetModel(int DeathID) { StringBuilder strSql = new StringBuilder(); strSql.Append("select top 1 DeathID,D_DateTime,D_Location,D_Icd10ID,D_Note,D_UserID,D_RegDate from record_DeathRegistration "); strSql.Append(" where DeathID=@DeathID"); SqlParameter[] parameters = { new SqlParameter("@DeathID", SqlDbType.Int, 4) }; parameters[0].Value = DeathID; Maticsoft.Model.record_DeathRegistration model = new Maticsoft.Model.record_DeathRegistration(); DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters); if (ds.Tables[0].Rows.Count > 0) { return(DataRowToModel(ds.Tables[0].Rows[0])); } else { return(null); } }
/// <summary> /// 得到一个对象实体 /// </summary> public Maticsoft.Model.record_DeathRegistration GetModel(int DeathID) { StringBuilder strSql=new StringBuilder(); strSql.Append("select top 1 DeathID,D_DateTime,D_Location,D_Icd10ID,D_Note,D_UserID,D_RegDate from record_DeathRegistration "); strSql.Append(" where DeathID=@DeathID"); SqlParameter[] parameters = { new SqlParameter("@DeathID", SqlDbType.Int,4) }; parameters[0].Value = DeathID; Maticsoft.Model.record_DeathRegistration model=new Maticsoft.Model.record_DeathRegistration(); DataSet ds=DbHelperSQL.Query(strSql.ToString(),parameters); if(ds.Tables[0].Rows.Count>0) { return DataRowToModel(ds.Tables[0].Rows[0]); } else { return null; } }