public void btnSave_Click(object sender, EventArgs e) { string strErr=""; if(this.txtusername.Text.Trim().Length==0) { strErr+="回发此数据的用户不能为空!\\n"; } if(this.txtPatiendId.Text.Trim().Length==0) { strErr+="回发的患者唯一标识不能为空!\\n"; } if(this.txtSampleId.Text.Trim().Length==0) { strErr+="回发的样本id不能为空!\\n"; } if(this.txtPostBackStatus.Text.Trim().Length==0) { strErr+="回发后的状态不能为空!\\n"; } if(!PageValidate.IsDateTime(txtPostBackDate.Text)) { strErr+="回发时间格式错误!\\n"; } if(strErr!="") { MessageBox.Show(this,strErr); return; } int id=int.Parse(this.lblid.Text); string username=this.txtusername.Text; string PatiendId=this.txtPatiendId.Text; string SampleId=this.txtSampleId.Text; string PostBackStatus=this.txtPostBackStatus.Text; DateTime PostBackDate=DateTime.Parse(this.txtPostBackDate.Text); RuRo.Model.ZSSY.SpecimenRtLog model=new RuRo.Model.ZSSY.SpecimenRtLog(); model.id=id; model.username=username; model.PatiendId=PatiendId; model.SampleId=SampleId; model.PostBackStatus=PostBackStatus; model.PostBackDate=PostBackDate; RuRo.BLL.ZSSY.SpecimenRtLog bll=new RuRo.BLL.ZSSY.SpecimenRtLog(); bll.Update(model); RuRo.Common.MessageBox.ShowAndRedirect(this,"保存成功!","list.aspx"); }
/// <summary> /// 添加当前样本回发日志到数据库 /// </summary> /// <param name="item">当前的样本数据</param> /// <param name="result">回发后的状态</param> /// <returns>保存是否成功</returns> private bool AddToSpecimenRtLog(RuRo.BLL.WebService.SpecimenRt item, string result) { //保存日志:a、直接保存SpecimenRtLog RuRo.Model.ZSSY.SpecimenRtLog specimenRtLog = new RuRo.Model.ZSSY.SpecimenRtLog(); specimenRtLog.PatiendId = item.PatientId;//提交的患者唯一标识 specimenRtLog.PostBackDate = DateTime.Now;//提交日期 specimenRtLog.PostBackStatus = result;//保存提交的结果 specimenRtLog.SampleId = item.Specimens[0].Id;//样本id if (string.IsNullOrEmpty(GetUserName())) { return false; } else { specimenRtLog.username = GetUserName();//当前用户 } return fpExtendDatabase.AddToSpecimenRtLog(specimenRtLog);//保存到数据库__返回保存是否成功的状态 }