/// <summary> /// 得到一个对象实体 /// </summary> public RuRo.Model.ZSSY.LabTestMaster GetModel() { //该表无主键信息,请自定义主键/条件字段 StringBuilder strSql=new StringBuilder(); strSql.Append("select top 1 Id,TestNo,priorityIndicator,WorkingId,TestCause,RelevantClinicDiag,Specimen,SpcmReceivedDateTime,OrderingDept,orderingProvider,PerformedBy,ResultStatus,ResultsRptDateTime,transcriptionist,VerifiedBy from LabTestMaster "); strSql.Append(" where "); SqlParameter[] parameters = { }; RuRo.Model.ZSSY.LabTestMaster model=new RuRo.Model.ZSSY.LabTestMaster(); 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 RuRo.Model.ZSSY.LabTestMaster DataRowToModel(DataRow row) { RuRo.Model.ZSSY.LabTestMaster model=new RuRo.Model.ZSSY.LabTestMaster(); if (row != null) { if(row["Id"]!=null && row["Id"].ToString()!="") { model.Id=int.Parse(row["Id"].ToString()); } if(row["TestNo"]!=null) { model.TestNo=row["TestNo"].ToString(); } if(row["priorityIndicator"]!=null) { model.priorityIndicator=row["priorityIndicator"].ToString(); } if(row["WorkingId"]!=null) { model.WorkingId=row["WorkingId"].ToString(); } if(row["TestCause"]!=null) { model.TestCause=row["TestCause"].ToString(); } if(row["RelevantClinicDiag"]!=null) { model.RelevantClinicDiag=row["RelevantClinicDiag"].ToString(); } if(row["Specimen"]!=null) { model.Specimen=row["Specimen"].ToString(); } if(row["SpcmReceivedDateTime"]!=null) { model.SpcmReceivedDateTime=row["SpcmReceivedDateTime"].ToString(); } if(row["OrderingDept"]!=null) { model.OrderingDept=row["OrderingDept"].ToString(); } if(row["orderingProvider"]!=null) { model.orderingProvider=row["orderingProvider"].ToString(); } if(row["PerformedBy"]!=null) { model.PerformedBy=row["PerformedBy"].ToString(); } if(row["ResultStatus"]!=null) { model.ResultStatus=row["ResultStatus"].ToString(); } if(row["ResultsRptDateTime"]!=null) { model.ResultsRptDateTime=row["ResultsRptDateTime"].ToString(); } if(row["transcriptionist"]!=null) { model.transcriptionist=row["transcriptionist"].ToString(); } if(row["VerifiedBy"]!=null) { model.VerifiedBy=row["VerifiedBy"].ToString(); } } return model; }
public void btnSave_Click(object sender, EventArgs e) { string strErr=""; if(!PageValidate.IsNumber(txtId.Text)) { strErr+="Id格式错误!\\n"; } if(this.txtTestNo.Text.Trim().Length==0) { strErr+="检验申请单号不能为空!\\n"; } if(this.txtpriorityIndicator.Text.Trim().Length==0) { strErr+="优先标志不能为空!\\n"; } if(this.txtWorkingId.Text.Trim().Length==0) { strErr+="工作单号不能为空!\\n"; } if(this.txtTestCause.Text.Trim().Length==0) { strErr+="检验目的不能为空!\\n"; } if(this.txtRelevantClinicDiag.Text.Trim().Length==0) { strErr+="临床诊断不能为空!\\n"; } if(this.txtSpecimen.Text.Trim().Length==0) { strErr+="标本不能为空!\\n"; } if(this.txtSpcmReceivedDateTime.Text.Trim().Length==0) { strErr+="采样时间不能为空!\\n"; } if(this.txtOrderingDept.Text.Trim().Length==0) { strErr+="开医嘱科室不能为空!\\n"; } if(this.txtorderingProvider.Text.Trim().Length==0) { strErr+="医生工号不能为空!\\n"; } if(this.txtPerformedBy.Text.Trim().Length==0) { strErr+="执行科室不能为空!\\n"; } if(this.txtResultStatus.Text.Trim().Length==0) { strErr+="执行情况不能为空!\\n"; } if(this.txtResultsRptDateTime.Text.Trim().Length==0) { strErr+="报告完成时间不能为空!\\n"; } if(this.txttranscriptionist.Text.Trim().Length==0) { strErr+="报告者工号不能为空!\\n"; } if(this.txtVerifiedBy.Text.Trim().Length==0) { strErr+="审核者工号不能为空!\\n"; } if(strErr!="") { MessageBox.Show(this,strErr); return; } int Id=int.Parse(this.txtId.Text); string TestNo=this.txtTestNo.Text; string priorityIndicator=this.txtpriorityIndicator.Text; string WorkingId=this.txtWorkingId.Text; string TestCause=this.txtTestCause.Text; string RelevantClinicDiag=this.txtRelevantClinicDiag.Text; string Specimen=this.txtSpecimen.Text; string SpcmReceivedDateTime=this.txtSpcmReceivedDateTime.Text; string OrderingDept=this.txtOrderingDept.Text; string orderingProvider=this.txtorderingProvider.Text; string PerformedBy=this.txtPerformedBy.Text; string ResultStatus=this.txtResultStatus.Text; string ResultsRptDateTime=this.txtResultsRptDateTime.Text; string transcriptionist=this.txttranscriptionist.Text; string VerifiedBy=this.txtVerifiedBy.Text; RuRo.Model.ZSSY.LabTestMaster model=new RuRo.Model.ZSSY.LabTestMaster(); model.Id=Id; model.TestNo=TestNo; model.priorityIndicator=priorityIndicator; model.WorkingId=WorkingId; model.TestCause=TestCause; model.RelevantClinicDiag=RelevantClinicDiag; model.Specimen=Specimen; model.SpcmReceivedDateTime=SpcmReceivedDateTime; model.OrderingDept=OrderingDept; model.orderingProvider=orderingProvider; model.PerformedBy=PerformedBy; model.ResultStatus=ResultStatus; model.ResultsRptDateTime=ResultsRptDateTime; model.transcriptionist=transcriptionist; model.VerifiedBy=VerifiedBy; RuRo.BLL.ZSSY.LabTestMaster bll=new RuRo.BLL.ZSSY.LabTestMaster(); bll.Update(model); RuRo.Common.MessageBox.ShowAndRedirect(this,"保存成功!","list.aspx"); }