Exemple #1
0
 private void grdPatientInfo_KeyPress(object sender, KeyPressEventArgs e)
 {
     try
     {
         if (grdPatientInfo.CurrentRow == null)
         {
             return;
         }
         int vTestResult_Id = Utility.Int32Dbnull(grdPatientInfo.GetValue("TestDetail_ID"));
         if (globalVariables.UserName == "ADMIN" || globalVariables.UserName == "LIS_ADMIN")
         {
             //Insert_Update_Result();
         }
         else
         {
             if (grdPatientInfo.CurrentColumn.Key == "Test_Result" &
                 grdPatientInfo.RootTable.Columns["Test_Result"].EditType != EditType.NoEdit &
                 vTestResult_Id > 0)
             {
                 if (TResultDetail.CreateQuery().WHERE(TResultDetail.Columns.TestDetailId, vTestResult_Id).
                     AND(TResultDetail.Columns.ParaStatus, Comparison.GreaterThan, 0).GetRecordCount() > 0)
                 {
                     Utility.ShowMsg("Đã in kết quả. Không được sửa, Bạn hãy liên hệ với ADMIN để được trợ giúp!", "Thông Báo", MessageBoxIcon.Warning);
                     e.Handled = true;
                 }
             }
         }
     }
     catch (Exception ex)
     {
         Utility.ShowMsg(ex.Message);
     }
 }
        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 tsmUpdateBarcode_Click(object sender, EventArgs e)
 {
     try
     {
         if (TResultDetail.CreateQuery().WHERE(TResultDetail.Columns.TestId, grdTestInfo.GetValue("Test_ID")).GetRecordCount() > 0)
         {
             Utility.ShowMsg("Đăng ký đã có kết quả. Không được sửa barcode !");
             return;
         }
         frmInput_Update_Barcode oForm = new frmInput_Update_Barcode();
         if (SysPara.AutoGenerateBarcode == 2)
         {
             oForm.vTestType_ID = Utility.Int32Dbnull(grdTestInfo.GetValue("TestType_ID"));
         }
         oForm.txtBarcode.Text       = Utility.sDbnull(grdTestInfo.GetValue("Barcode"));
         oForm.txtTestType_Name.Text = Utility.sDbnull(grdTestInfo.GetValue("TestType_Name"));
         oForm.vPatient_ID           = patientId;
         oForm.ShowDialog();
         if (string.IsNullOrEmpty(oForm.txtBarcode.Text) | oForm.txtBarcode.Text == Utility.sDbnull(grdTestInfo.GetValue("Barcode")))
         {
             return;
         }
         new Update(TTestInfo.Schema.Name).Set(TTestInfo.Columns.Barcode).EqualTo(oForm.txtBarcode.Text).
         Where(TTestInfo.Columns.TestId).IsEqualTo(Utility.Int32Dbnull(grdTestInfo.GetValue("Test_ID"))).
         Execute();
         new Update(TRegList.Schema.Name).Set(TTestInfo.Columns.Barcode).EqualTo(oForm.txtBarcode.Text).
         Where(TRegList.Columns.TestId).IsEqualTo(Utility.Int32Dbnull(grdTestInfo.GetValue("Test_ID"))).
         Execute();
         grdTestInfo.CurrentRow.Cells["Barcode"].Value = oForm.txtBarcode.Text;
     }
     catch (Exception ex)
     {
         Utility.ShowMsg(ex.Message);
     }
 }
Exemple #4
0
        private void DeleteAllTestId(Int32 Test_ID)
        {
            try
            {
                if (!Utility.AcceptQuestion("Thực hiện xóa", "Thông báo", true))
                {
                    return;
                }

                Query myQuery;

                myQuery           = TResultDetail.CreateQuery().WHERE(TTestInfo.Columns.TestId, Test_ID);
                myQuery.QueryType = QueryType.Delete;
                myQuery.Execute();

                myQuery           = TTestInfo.CreateQuery().WHERE(TTestInfo.Columns.TestId, Test_ID);
                myQuery.QueryType = QueryType.Delete;
                myQuery.Execute();

                grdTestInfo.CurrentRow.Delete();
            }
            catch (Exception ex)
            {
                Utility.ShowMsg(ex.Message);
            }
        }
 private void tsmDelTestInfo_Click(object sender, EventArgs e)
 {
     try
     {
         if (
             TResultDetail.CreateQuery().WHERE(TResultDetail.Columns.TestId,
                                               Utility.Int32Dbnull(
                                                   grdTestInfo.GetValue(TTestInfo.Columns.TestId))).
             GetRecordCount() > 0)
         {
             Utility.ShowMsg("Đã có kết quả. Không được xóa !");
             return;
         }
         if (Utility.AcceptQuestion("Xóa " + grdTestInfo.GetValue(TTestTypeList.Columns.TestTypeName),
                                    "Thông báo", true))
         {
             new Delete().From(TTestInfo.Schema.Name).Where(TTestInfo.Columns.TestId).
             IsEqualTo(Utility.Int32Dbnull(grdTestInfo.GetValue("Test_ID"))).Execute();
             new Delete().From(TRegList.Schema.Name).Where(TRegList.Columns.TestId).
             IsEqualTo(Utility.Int32Dbnull(grdTestInfo.GetValue("Test_ID"))).Execute();
             grdTestInfo.CurrentRow.Delete();
             grdTestInfo.UpdateData();
             dtTestInfo.AcceptChanges();
         }
     }
     catch (Exception ex)
     {
         Utility.ShowMsg(ex.Message);
     }
 }
        /// <summary>
        /// hàm thực hiện update UpdateResultDetail dữ liệu
        /// </summary>
        /// <param name="resultDetail"></param>
        /// <returns></returns>
        public void UpdateResultDetail(TResultDetail resultDetail)
        {
            int   record = -1;
            Query _Query = TResultDetail.CreateQuery();


            if (TResultDetail.FetchByID(resultDetail.TestDetailId) != null)
            {
                new Update(TResultDetail.Schema)
                .Set(TResultDetail.Columns.Barcode).EqualTo(resultDetail.Barcode)
                .Set(TResultDetail.Columns.ParaName).EqualTo(resultDetail.ParaName)
                .Set(TResultDetail.Columns.Note).EqualTo(resultDetail.Note)
                .Set(TResultDetail.Columns.PrintData).EqualTo(resultDetail.PrintData)
                .Set(TResultDetail.Columns.TestResult).EqualTo(resultDetail.TestResult)
                .Set(TResultDetail.Columns.TestId).EqualTo(resultDetail.TestId)
                .Set(TResultDetail.Columns.TestTypeId).EqualTo(resultDetail.TestTypeId)
                .Set(TResultDetail.Columns.PatientId).EqualTo(resultDetail.PatientId)
                .Set(TResultDetail.Columns.TestDate).EqualTo(resultDetail.TestDate)
                .Set(TResultDetail.Columns.TestSequence).EqualTo(resultDetail.TestSequence)
                .Set(TResultDetail.Columns.ParaStatus).EqualTo(resultDetail.ParaStatus)
                .Set(TResultDetail.Columns.UpdateNum).EqualTo(resultDetail.UpdateNum)
                .Set(TResultDetail.Columns.MeasureUnit).EqualTo(resultDetail.MeasureUnit)
                .Set(TResultDetail.Columns.NormalLevelW).EqualTo(resultDetail.NormalLevelW)
                .Set(TResultDetail.Columns.NormalLevel).EqualTo(resultDetail.NormalLevel)
                .Where(TResultDetail.Columns.TestDetailId).IsEqualTo(resultDetail.TestDetailId).Execute();
            }
        }
        private TResultDetail CreateResultDetail(DataRow dataRow)
        {
            var resultDetail = new TResultDetail();

            if (dataRow["IsNew"].ToString() == "0")
            {
                resultDetail.TestDetailId = Utility.Int32Dbnull(dataRow[TResultDetail.Columns.TestDetailId], -1);
            }
            resultDetail.TestId     = Utility.Int32Dbnull(dataRow[TResultDetail.Columns.TestId], -1);
            resultDetail.TestTypeId = Utility.Int32Dbnull(dataRow[TResultDetail.Columns.TestTypeId], -1);
            resultDetail.Barcode    = Utility.sDbnull(dataRow[TResultDetail.Columns.Barcode], "");
            ;
            resultDetail.PatientId = Utility.Int32Dbnull(dataRow[TResultDetail.Columns.PatientId], -1);
            ;
            resultDetail.NormalLevel  = Utility.sDbnull(dataRow[TResultDetail.Columns.NormalLevel], "");
            resultDetail.NormalLevelW = Utility.sDbnull(dataRow[TResultDetail.Columns.NormalLevelW], "");
            resultDetail.ParaName     = Utility.sDbnull(dataRow[TResultDetail.Columns.ParaName], "");
            resultDetail.PrintData    = Convert.ToBoolean(dataRow[TResultDetail.Columns.PrintData]);
            resultDetail.MeasureUnit  = Utility.sDbnull(dataRow[TResultDetail.Columns.MeasureUnit]);
            resultDetail.ParaStatus   = 0;
            resultDetail.TestResult   = Utility.sDbnull(dataRow[TResultDetail.Columns.TestResult]);
            resultDetail.TestDate     = Convert.ToDateTime(dataRow[TResultDetail.Columns.TestDate].ToString());
            resultDetail.DataSequence = Utility.Int32Dbnull(dataRow[TResultDetail.Columns.DataSequence]);
            resultDetail.UpdateNum    = 1;
            return(resultDetail);
        }
        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);
            }
        }
 public bool Destroy(object TestDetailId)
 {
     return(TResultDetail.Destroy(TestDetailId) == 1);
 }
Exemple #16
0
        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);
            }
        }
 public bool Delete(object TestDetailId)
 {
     return(TResultDetail.Delete(TestDetailId) == 1);
 }