public void btnSave_Click(object sender, EventArgs e) { string strErr=""; if(this.txtDiagnoseTypeFlag.Text.Trim().Length==0) { strErr+="DiagnoseTypeFlag不能为空!\\n"; } if(!PageValidate.IsDateTime(txtDiagnoseDateTime.Text)) { strErr+="DiagnoseDateTime格式错误!\\n"; } if(!PageValidate.IsNumber(txtRegisterID.Text)) { strErr+="RegisterID格式错误!\\n"; } if(!PageValidate.IsNumber(txtInPatientID.Text)) { strErr+="InPatientID格式错误!\\n"; } if(this.txtICDCode.Text.Trim().Length==0) { strErr+="ICDCode不能为空!\\n"; } if(this.txtDiseaseName.Text.Trim().Length==0) { strErr+="DiseaseName不能为空!\\n"; } if(this.txtDescription.Text.Trim().Length==0) { strErr+="Description不能为空!\\n"; } if(strErr!="") { MessageBox.Show(this,strErr); return; } int id=int.Parse(this.lblid.Text); string DiagnoseTypeFlag=this.txtDiagnoseTypeFlag.Text; DateTime DiagnoseDateTime=DateTime.Parse(this.txtDiagnoseDateTime.Text); int RegisterID=int.Parse(this.txtRegisterID.Text); int InPatientID=int.Parse(this.txtInPatientID.Text); string ICDCode=this.txtICDCode.Text; string DiseaseName=this.txtDiseaseName.Text; string Description=this.txtDescription.Text; RuRo.Model.ClinicalInfo model=new RuRo.Model.ClinicalInfo(); model.id=id; model.DiagnoseTypeFlag=DiagnoseTypeFlag; model.DiagnoseDateTime=DiagnoseDateTime; model.RegisterID=RegisterID; model.InPatientID=InPatientID; model.ICDCode=ICDCode; model.DiseaseName=DiseaseName; model.Description=Description; RuRo.BLL.ClinicalInfo bll=new RuRo.BLL.ClinicalInfo(); bll.Update(model); Maticsoft.Common.MessageBox.ShowAndRedirect(this,"保存成功!","list.aspx"); }
/// <summary> /// 得到一个对象实体 /// </summary> public RuRo.Model.ClinicalInfo DataRowToModel(DataRow row) { RuRo.Model.ClinicalInfo model = new RuRo.Model.ClinicalInfo(); if (row != null) { if (row["id"] != null && row["id"].ToString() != "") { model.id = int.Parse(row["id"].ToString()); } if (row["DiagnoseTypeFlag"] != null) { model.DiagnoseTypeFlag = row["DiagnoseTypeFlag"].ToString(); } if (row["DiagnoseDateTime"] != null && row["DiagnoseDateTime"].ToString() != "") { model.DiagnoseDateTime = DateTime.Parse(row["DiagnoseDateTime"].ToString()); } if (row["RegisterID"] != null && row["RegisterID"].ToString() != "") { model.RegisterID = int.Parse(row["RegisterID"].ToString()); } if (row["InPatientID"] != null && row["InPatientID"].ToString() != "") { model.InPatientID = int.Parse(row["InPatientID"].ToString()); } if (row["ICDCode"] != null) { model.ICDCode = row["ICDCode"].ToString(); } if (row["DiseaseName"] != null) { model.DiseaseName = row["DiseaseName"].ToString(); } if (row["Description"] != null) { model.Description = row["Description"].ToString(); } if (row["type"] != null) { model.type = row["type"].ToString(); } if (row["ADDTIME"] != null && row["ADDTIME"].ToString() != "") { model.ADDTIME = DateTime.Parse(row["ADDTIME"].ToString()); } if (row["PatientID"] != null && row["PatientID"].ToString() != "") { model.PatientID = int.Parse(row["PatientID"].ToString()); } } return model; }
/// <summary> /// 得到一个对象实体 /// </summary> public RuRo.Model.ClinicalInfo GetModel(int id) { StringBuilder strSql=new StringBuilder(); strSql.Append("select top 1 id,DiagnoseTypeFlag,DiagnoseDateTime,RegisterID,InPatientID,ICDCode,DiseaseName,Description from ClinicalInfo "); strSql.Append(" where id=@id"); SqlParameter[] parameters = { new SqlParameter("@id", SqlDbType.Int,4) }; parameters[0].Value = id; RuRo.Model.ClinicalInfo model=new RuRo.Model.ClinicalInfo(); DataSet ds=DbHelperSQL.Query(strSql.ToString(),parameters); if(ds.Tables[0].Rows.Count>0) { return DataRowToModel(ds.Tables[0].Rows[0]); } else { return null; } }