public void UpdateResultDetailDetail(TResultDetail objResultDetail) { SqlQuery q = new Select().From(TResultDetail.Schema) .Where(TResultDetail.Columns.TestId).IsEqualTo(objResultDetail.TestId).And( TResultDetail.Columns.TestTypeId).IsEqualTo(objResultDetail.TestTypeId).And( TResultDetail.Columns.PatientId).IsEqualTo(objResultDetail.PatientId); if (q.GetRecordCount() <= 0) { objResultDetail.IsNew = true; objResultDetail.Save(); } else { new Update(TResultDetail.Schema) .Set(TResultDetail.Columns.Barcode).EqualTo(objResultDetail.Barcode) .Set(TResultDetail.Columns.ParaName).EqualTo(objResultDetail.ParaName) .Set(TResultDetail.Columns.Note).EqualTo(objResultDetail.Note) .Set(TResultDetail.Columns.PrintData).EqualTo(objResultDetail.PrintData) .Set(TResultDetail.Columns.TestResult).EqualTo(objResultDetail.TestResult) .Set(TResultDetail.Columns.TestId).EqualTo(objResultDetail.TestId) .Set(TResultDetail.Columns.TestTypeId).EqualTo(objResultDetail.TestTypeId) .Set(TResultDetail.Columns.PatientId).EqualTo(objResultDetail.PatientId) .Set(TResultDetail.Columns.TestDate).EqualTo(objResultDetail.TestDate) .Set(TResultDetail.Columns.TestSequence).EqualTo(objResultDetail.TestSequence) .Set(TResultDetail.Columns.ParaStatus).EqualTo(objResultDetail.ParaStatus) .Set(TResultDetail.Columns.UpdateNum).EqualTo(objResultDetail.UpdateNum) .Set(TResultDetail.Columns.MeasureUnit).EqualTo(objResultDetail.MeasureUnit) .Set(TResultDetail.Columns.NormalLevelW).EqualTo(objResultDetail.NormalLevelW) .Set(TResultDetail.Columns.NormalLevel).EqualTo(objResultDetail.NormalLevel) .Where(TResultDetail.Columns.TestDetailId).IsEqualTo(objResultDetail.TestDetailId).Execute(); } }
private void grdTestResult_CellUpdated(object sender, ColumnActionEventArgs e) { try { if (grdTestResult.CurrentRow == null) { return; } if (Utility.Int32Dbnull(grdTestResult.GetValue("TestDetail_ID"), -1) > 0) { new Update(TResultDetail.Schema.Name).Set(TResultDetail.Columns.TestResult).EqualTo( grdTestResult.GetValue("Test_Result")).Where(TResultDetail.Columns.TestDetailId).IsEqualTo( Utility.Int32Dbnull(grdTestResult.GetValue("TestDetail_ID"), -1)).Execute(); } else { var obj = new TResultDetail(); if (string.IsNullOrEmpty(Utility.sDbnull(grdTestResult.GetValue("Para_Name")))) { Utility.ShowMsg("Tên thông số không được để trống"); return; } obj.TestId = Utility.Int32Dbnull(grdTestResult.GetValue("Test_ID"), -1); obj.PatientId = Utility.Int32Dbnull(grdTestResult.GetValue("Patient_ID"), -1); obj.TestTypeId = Utility.Int32Dbnull(grdTestResult.GetValue("TestType_ID"), -1); obj.TestDate = Utility.getSysDate(); obj.DataSequence = Utility.Int32Dbnull(grdTestResult.GetValue("Data_Sequence")); obj.TestResult = Utility.sDbnull(grdTestResult.GetValue("Test_Result")); obj.NormalLevel = Utility.sDbnull(grdTestResult.GetValue("Normal_Level")); obj.NormalLevelW = Utility.sDbnull(grdTestResult.GetValue("Normal_levelW")); obj.MeasureUnit = Utility.sDbnull(grdTestResult.GetValue("Measure_Unit")); obj.ParaName = Utility.sDbnull(grdTestResult.GetValue("Para_Name")); obj.TestDataId = Utility.sDbnull(grdTestResult.GetValue("TestData_ID")); obj.ParaStatus = 0; obj.PrintData = true; obj.Barcode = Utility.sDbnull(grdTestResult.GetValue("Barcode")); obj.UpdateNum = 0; obj.IsNew = true; obj.Save(); grdTestResult.CurrentRow.Cells["TestDetail_ID"].Value = Utility.Int32Dbnull(TResultDetail.CreateQuery(). WHERE(TResultDetail.Columns.PatientId, obj.PatientId). WHERE(TResultDetail.Columns.TestTypeId, obj.TestTypeId). GetMax(TResultDetail.Columns.TestDetailId), -1); } grdTestResult.UpdateData(); dtTestResult.AcceptChanges(); } catch (Exception ex) { Utility.ShowMsg(ex.Message); } }
public void Update(decimal TestDetailId, decimal?TestId, decimal?PatientId, int?TestTypeId, DateTime?TestDate, string TestSequence, int?DataSequence, string TestResult, string NormalLevelW, string NormalLevel, string MeasureUnit, string ParaName, short ParaStatus, string Note, bool?PrintData, string Barcode, int?UpdateNum, string TestDataId, decimal?DeviceId, short?IsNormal, int?SentStatus, DateTime?TestDateCreated) { TResultDetail item = new TResultDetail(); item.MarkOld(); item.IsLoaded = true; item.TestDetailId = TestDetailId; item.TestId = TestId; item.PatientId = PatientId; item.TestTypeId = TestTypeId; item.TestDate = TestDate; item.TestSequence = TestSequence; item.DataSequence = DataSequence; item.TestResult = TestResult; item.NormalLevelW = NormalLevelW; item.NormalLevel = NormalLevel; item.MeasureUnit = MeasureUnit; item.ParaName = ParaName; item.ParaStatus = ParaStatus; item.Note = Note; item.PrintData = PrintData; item.Barcode = Barcode; item.UpdateNum = UpdateNum; item.TestDataId = TestDataId; item.DeviceId = DeviceId; item.IsNormal = IsNormal; item.SentStatus = SentStatus; item.TestDateCreated = TestDateCreated; item.Save(UserName); }
public ActionResult UpdateDataResultDetail(ref DataTable resultDetail, int v_TestInfo) { int TestResult_Id = -1; Query _Query = TResultDetail.CreateQuery(); try { using (var scope = new TransactionScope()) { using (var sp = new SharedDbConnectionScope()) { new Update(TTestInfo.Schema) .Set(TTestInfo.Columns.TestStatus).EqualTo(80) .Where(TTestInfo.Columns.TestId).IsEqualTo(v_TestInfo).Execute(); foreach (DataRow dr in resultDetail.Rows) { //if (dr["CHON"].ToString() == "1") //{ if (dr["IsNew"].ToString() == "1") { TResultDetail ObjResultDetail = CreateResultDetail(dr); if (ObjResultDetail != null) { ObjResultDetail.IsNew = true; ObjResultDetail.Save(); TestResult_Id = Convert.ToInt32(_Query.GetMax(TResultDetail.Columns.TestDetailId)); dr[TResultDetail.Columns.TestDetailId] = TestResult_Id; } //dr["IsNew"] = 0; } else { TResultDetail ObjResultDetail = CreateResultDetail(dr); UpdateResultDetail(ObjResultDetail); //} } } resultDetail.AcceptChanges(); } scope.Complete(); return(ActionResult.Success); } } catch (Exception exception) { return(ActionResult.Error); } }
//public static DataSet GetTestInfoByPatientInfo(int v_PatientId, string testTypeId) //{ // try // { // var ds = new DataSet(); // string strFormat = "dd/MM/yyyy"; // //string strFromDate = fromDate.ToString(strFormat); // //string strToDate = toDate.ToString(strFormat); // ds = SPs.SpGetTestInfoByPatientIDV2(v_PatientId, testTypeId).GetDataSet(); // return ds; // } // catch (Exception) // { // throw; // } //} //public static DataSet GetTestInfoByPatientInfo( string testTypeId) //{ // DataSet ds = new DataSet(); // ds = SPs.SpGetTestInfoByPatientID(testTypeId).GetDataSet(); // return ds; //} public static int InsertResultDetail(TResultDetail resultDetail) { int record = -1; Query _Query = TResultDetail.CreateQuery(); try { using (var scope = new TransactionScope()) { using (var sp = new SharedDbConnectionScope()) { resultDetail.IsNew = true; resultDetail.Save(); record = Convert.ToInt32(_Query.GetMax(TResultDetail.Columns.TestDetailId)); } scope.Complete(); } } catch (Exception exception) { record = -1; } return(record); }
public void Insert(decimal? TestId,decimal? PatientId,int? TestTypeId,DateTime? TestDate,string TestSequence,int? DataSequence,string TestResult,string NormalLevelW,string NormalLevel,string MeasureUnit,string ParaName,short ParaStatus,string Note,bool? PrintData,string Barcode,int? UpdateNum,string TestDataId,decimal? DeviceId,short? IsNormal,int? SentStatus,DateTime? TestDateCreated) { TResultDetail item = new TResultDetail(); item.TestId = TestId; item.PatientId = PatientId; item.TestTypeId = TestTypeId; item.TestDate = TestDate; item.TestSequence = TestSequence; item.DataSequence = DataSequence; item.TestResult = TestResult; item.NormalLevelW = NormalLevelW; item.NormalLevel = NormalLevel; item.MeasureUnit = MeasureUnit; item.ParaName = ParaName; item.ParaStatus = ParaStatus; item.Note = Note; item.PrintData = PrintData; item.Barcode = Barcode; item.UpdateNum = UpdateNum; item.TestDataId = TestDataId; item.DeviceId = DeviceId; item.IsNormal = IsNormal; item.SentStatus = SentStatus; item.TestDateCreated = TestDateCreated; item.Save(UserName); }
private void Insert_Update_Result() { try { if (grdResultDetail.CurrentRow == null) return; if (Utility.Int32Dbnull(grdResultDetail.GetValue("TestDetail_ID"), -1) > 0) { new Update(TResultDetail.Schema.Name).Set(TResultDetail.Columns.ParaName).EqualTo( Utility.sDbnull(grdResultDetail.GetValue("Para_Name"))). Set(TResultDetail.Columns.NormalLevel).EqualTo( Utility.sDbnull(grdResultDetail.GetValue("Normal_Level"))). Set(TResultDetail.Columns.NormalLevelW).EqualTo( Utility.sDbnull(grdResultDetail.GetValue("Normal_LevelW"))). Set(TResultDetail.Columns.MeasureUnit).EqualTo( Utility.sDbnull(grdResultDetail.GetValue("Measure_Unit"))). Set(TResultDetail.Columns.TestResult).EqualTo( Utility.sDbnull(grdResultDetail.GetValue("Test_Result"))). Set(TResultDetail.Columns.Note).EqualTo(Utility.sDbnull(grdResultDetail.GetValue("Note"))). Set(TResultDetail.Columns.DataSequence).EqualTo( Utility.sDbnull(grdResultDetail.GetValue("Data_Sequence"))). Set(TResultDetail.Columns.TestDate).EqualTo( DateTime.Now.ToString("yyyy-MM-dd")). Where(TResultDetail.Columns.TestDetailId).IsEqualTo( Utility.Int32Dbnull(grdResultDetail.GetValue("TestDetail_ID"), -1)). Execute(); } else { var obj = new TResultDetail(); obj.TestId = Utility.Int32Dbnull(grdTestInfo.GetValue("Test_ID"), -1); obj.PatientId = Utility.Int32Dbnull(grdPatients.GetValue("Patient_ID"), -1); obj.TestTypeId = Utility.Int32Dbnull(grdTestInfo.GetValue("TestType_ID"), -1); obj.TestDate = DateTime.Now; obj.DataSequence = Utility.Int32Dbnull(grdResultDetail.GetValue("Data_Sequence")); obj.TestResult = Utility.sDbnull(grdResultDetail.GetValue("Test_Result")); obj.NormalLevel = Utility.sDbnull(grdResultDetail.GetValue("Normal_Level")); obj.NormalLevelW = Utility.sDbnull(grdResultDetail.GetValue("Normal_levelW")); obj.MeasureUnit = Utility.sDbnull(grdResultDetail.GetValue("Measure_Unit")); obj.ParaName = Utility.sDbnull(grdResultDetail.GetValue("Para_Name")); obj.TestDataId = Utility.sDbnull(grdResultDetail.GetValue("TestData_ID")); obj.ParaStatus = 0; obj.PrintData = true; obj.Barcode = Utility.sDbnull(grdTestInfo.GetValue("Barcode")); obj.UpdateNum = 0; obj.IsNew = true; obj.Save(); grdResultDetail.CurrentRow.Cells["TestDetail_ID"].Value = Utility.Int32Dbnull(TResultDetail.CreateQuery(). WHERE(TResultDetail.Columns.PatientId, obj.PatientId). WHERE(TResultDetail.Columns.TestTypeId, obj.TestTypeId). GetMax(TResultDetail.Columns.TestDetailId), -1); grdResultDetail.UpdateData(); m_dtResultDetail.AcceptChanges(); } } catch (Exception ex) { Utility.ShowMsg(ex.Message); } }
private void grdPatientInfo_CellUpdated(object sender, Janus.Windows.GridEX.ColumnActionEventArgs e) { try { if (grdPatientInfo.CurrentRow.RowType != RowType.Record | grdPatientInfo.CurrentColumn.Key != "Test_Result") return; if (string.IsNullOrEmpty(Utility.sDbnull(grdPatientInfo.GetValue("TestData_ID")))) return; if (grdPatientInfo.CurrentRow == null) return; if (Utility.Int32Dbnull(grdPatientInfo.GetValue("TestDetail_ID"), -1) > 0) { new Update(TResultDetail.Schema.Name).Set(TResultDetail.Columns.ParaName) .EqualTo(Utility.sDbnull(grdPatientInfo.GetValue("Para_Name"))). Set(TResultDetail.Columns.TestResult).EqualTo(Utility.sDbnull(grdPatientInfo.GetValue("Test_Result"))). Where(TResultDetail.Columns.TestDetailId).IsEqualTo(Utility.Int32Dbnull(grdPatientInfo.GetValue("TestDetail_ID"), -1)). Execute(); } else { var obj = new TResultDetail(); obj.TestId = Utility.Int32Dbnull(grdPatientInfo.GetValue("Test_ID"), -1); obj.PatientId = Utility.Int32Dbnull(grdPatientInfo.GetValue("Patient_ID"), -1); obj.TestTypeId = Utility.Int32Dbnull(grdPatientInfo.GetValue("TestType_ID"), -1); obj.TestDate = DateTime.Now; obj.DataSequence = Utility.Int32Dbnull(grdPatientInfo.GetValue("Data_Sequence")); obj.TestResult = Utility.sDbnull(grdPatientInfo.GetValue("Test_Result")); obj.NormalLevel = Utility.sDbnull(grdPatientInfo.GetValue("Normal_Level")); obj.NormalLevelW = Utility.sDbnull(grdPatientInfo.GetValue("Normal_levelW")); obj.MeasureUnit = Utility.sDbnull(grdPatientInfo.GetValue("Measure_Unit")); obj.ParaName = Utility.sDbnull(grdPatientInfo.GetValue("Para_Name")); obj.TestDataId = Utility.sDbnull(grdPatientInfo.GetValue("TestData_ID")); obj.ParaStatus = 0; obj.PrintData = true; obj.Barcode = Utility.sDbnull(grdPatientInfo.GetValue("Barcode")); obj.UpdateNum = 0; obj.IsNew = true; obj.Save(); //grdPatientInfo.CurrentRow.Cells["TestDetail_ID"].Value = obj.TestDetailId; grdPatientInfo.CurrentRow.Cells["TestDetail_ID"].Value = Utility.Int32Dbnull(TResultDetail.CreateQuery(). WHERE(TResultDetail.Columns.PatientId, obj.PatientId). WHERE(TResultDetail.Columns.TestTypeId, obj.TestTypeId). GetMax(TResultDetail.Columns.TestDetailId), -1); grdPatientInfo.UpdateData(); dtPatientInfo.AcceptChanges(); } } catch (Exception ex) { Utility.ShowMsg(ex.Message); } }
private void grdPatientInfo_CellUpdated(object sender, Janus.Windows.GridEX.ColumnActionEventArgs e) { try { if (grdPatientInfo.CurrentRow.RowType != RowType.Record | grdPatientInfo.CurrentColumn.Key != "Test_Result") { return; } if (string.IsNullOrEmpty(Utility.sDbnull(grdPatientInfo.GetValue("TestData_ID")))) { return; } if (grdPatientInfo.CurrentRow == null) { return; } if (Utility.Int32Dbnull(grdPatientInfo.GetValue("TestDetail_ID"), -1) > 0) { new Update(TResultDetail.Schema.Name).Set(TResultDetail.Columns.ParaName) .EqualTo(Utility.sDbnull(grdPatientInfo.GetValue("Para_Name"))). Set(TResultDetail.Columns.TestResult).EqualTo(Utility.sDbnull(grdPatientInfo.GetValue("Test_Result"))). Where(TResultDetail.Columns.TestDetailId).IsEqualTo(Utility.Int32Dbnull(grdPatientInfo.GetValue("TestDetail_ID"), -1)). Execute(); } else { var obj = new TResultDetail(); obj.TestId = Utility.Int32Dbnull(grdPatientInfo.GetValue("Test_ID"), -1); obj.PatientId = Utility.Int32Dbnull(grdPatientInfo.GetValue("Patient_ID"), -1); obj.TestTypeId = Utility.Int32Dbnull(grdPatientInfo.GetValue("TestType_ID"), -1); obj.TestDate = DateTime.Now; obj.DataSequence = Utility.Int32Dbnull(grdPatientInfo.GetValue("Data_Sequence")); obj.TestResult = Utility.sDbnull(grdPatientInfo.GetValue("Test_Result")); obj.NormalLevel = Utility.sDbnull(grdPatientInfo.GetValue("Normal_Level")); obj.NormalLevelW = Utility.sDbnull(grdPatientInfo.GetValue("Normal_levelW")); obj.MeasureUnit = Utility.sDbnull(grdPatientInfo.GetValue("Measure_Unit")); obj.ParaName = Utility.sDbnull(grdPatientInfo.GetValue("Para_Name")); obj.TestDataId = Utility.sDbnull(grdPatientInfo.GetValue("TestData_ID")); obj.ParaStatus = 0; obj.PrintData = true; obj.Barcode = Utility.sDbnull(grdPatientInfo.GetValue("Barcode")); obj.UpdateNum = 0; obj.IsNew = true; obj.Save(); //grdPatientInfo.CurrentRow.Cells["TestDetail_ID"].Value = obj.TestDetailId; grdPatientInfo.CurrentRow.Cells["TestDetail_ID"].Value = Utility.Int32Dbnull(TResultDetail.CreateQuery(). WHERE(TResultDetail.Columns.PatientId, obj.PatientId). WHERE(TResultDetail.Columns.TestTypeId, obj.TestTypeId). GetMax(TResultDetail.Columns.TestDetailId), -1); grdPatientInfo.UpdateData(); dtPatientInfo.AcceptChanges(); } } catch (Exception ex) { Utility.ShowMsg(ex.Message); } }