Esempio n. 1
0
 private void btnSave_Click(object sender, EventArgs e)
 {
     try
     {
         papResultUC1.EndEdit();
         try
         {
             cdc.SubmitChanges();
         }
         catch (System.Data.Linq.ChangeConflictException)
         {
             foreach (System.Data.Linq.ObjectChangeConflict occ in cdc.ChangeConflicts)
             {
                 cdc.Refresh(System.Data.Linq.RefreshMode.KeepChanges, occ.Object);
             }
             cdc.SubmitChanges();
         }
         lblAlert.Text = "Save Data Complete.";
     }
     catch (Exception ex)
     {
         Program.MessageError(this.Name, "btnSave_Click(object sender, EventArgs e)", ex, false);
         lblAlert.Text = "Please Try Again.";
     }
 }
Esempio n. 2
0
 public static void kickLoginOldRoom(int mut_id, int mrd_id)
 {
     using (InhCheckupDataContext cdc = new InhCheckupDataContext())
     {
         var log = cdc.log_user_logins.Where(x => x.mut_id == mut_id && /*x.mrd_id == mrd_id &&*/ x.lug_end_date == null).ToList();
         foreach (log_user_login item in log)
         {
             item.lug_end_date = Program.GetServerDateTime();
         }
         cdc.SubmitChanges();
         List <log_user_login> log_room = cdc.log_user_logins.Where(x => /*x.mrd_id == mrd_id &&*/ x.lug_end_date == null).ToList();
         if (log_room == null || log_room.Count() == 0)
         {
             List <int?>         list_mrd_id   = log_room.Select(x => x.mrd_id).ToList();
             List <mst_room_dtl> list_room_dtl = cdc.mst_room_dtls.Where(x => list_mrd_id.Contains(x.mrd_id)).ToList();
             list_room_dtl.ForEach(x => x.mrd_rm_status = 'E');
             //mst_room_dtl mrd = cdc.mst_room_dtls.Where(x => x.mrd_id == mrd_id).FirstOrDefault();
             //if (mrd != null)
             //{
             //    mrd.mrd_rm_status = 'E';
             //}
         }
         mst_user_type mut = cdc.mst_user_types.Where(x => x.mut_id == mut_id).FirstOrDefault();
         mut.mut_login_status = Program.get_mutLoginStatus;
         cdc.SubmitChanges();
     }
 }
Esempio n. 3
0
        public static void ExitRoom()
        {
            if (Program.CurrentRoom != null && Program.CurrentUser != null && Class.ClsManageUserLogin.current_log != null)
            {
                InhCheckupDataContext dbc = new InhCheckupDataContext();
                //log_user_login currentloguserlogin = (from t1 in dbc.log_user_logins
                //                                      where t1.mrd_id == Program.CurrentRoom.mrd_id
                //                                       && t1.mut_id == Program.CurrentUser.mut_id
                //                                       && t1.lug_end_date == null
                //                                      select t1).FirstOrDefault();
                log_user_login currentloguserlogin = dbc.log_user_logins.Where(x => x.lug_id == Class.ClsManageUserLogin.current_log.lug_id).FirstOrDefault();
                if (currentloguserlogin != null)
                {
                    currentloguserlogin.lug_end_date = Program.GetServerDateTime();
                }
                mst_user_type CurrentUser = (from t1 in dbc.mst_user_types where t1.mut_id == Program.CurrentUser.mut_id select t1).FirstOrDefault();
                CurrentUser.mut_login_status = get_mutLoginStatus;
                dbc.SubmitChanges();
                Program.CurrentUser = CurrentUser;

                mst_room_dtl currentroom = (from t1 in dbc.mst_room_dtls where t1.mrd_id == Program.CurrentRoom.mrd_id select t1).FirstOrDefault();
                if (currentroom != null)
                {
                    currentroom.mrd_rm_status = 'E';
                    dbc.SubmitChanges();
                }
            }
            get_mutLoginStatus = '0';
            Class.ClsManageUserLogin.current_log = null;
            Program.CurrentRegis = null;
            Program.CurrentRoom  = null;
            GC.Collect();                  //คำสั่ง Clear Memory ที่เคยเรียก data base มาใช้งาน
            AlertOutDepartment.StopTime(); //ปิดการทำงานการเตือน Out Department
        }
Esempio n. 4
0
        public StatusTransaction skipOnStationSendManaul(int tpr_id, int tps_id, int next_mrm_id, int next_mvt_id)
        {
            try
            {
                InhCheckupDataContext cdc = new InhCheckupDataContext();

                trn_patient_regi  tpr = cdc.trn_patient_regis.Where(x => x.tpr_id == tpr_id).FirstOrDefault();
                trn_patient_queue tps = tpr.trn_patient_queues.Where(x => x.tps_id == tps_id).FirstOrDefault();

                Class.FunctionDataCls func = new Class.FunctionDataCls();
                updatePlanForSkip(ref tpr, tps_id);
                skipReserveCurrentQueue(ref tpr, tps_id);
                func.deleteCurrentQueue(ref cdc, ref tpr, tps_id);
                func.insertNextQueue(ref tpr, next_mrm_id, next_mvt_id);
                try
                {
                    cdc.SubmitChanges();
                    return(StatusTransaction.True);
                }
                catch (System.Data.Linq.ChangeConflictException)
                {
                    foreach (ObjectChangeConflict occ in cdc.ChangeConflicts)
                    {
                        cdc.Refresh(System.Data.Linq.RefreshMode.KeepChanges, occ.Object);
                    }
                    cdc.SubmitChanges();
                    return(StatusTransaction.True);
                }
            }
            catch (Exception ex)
            {
                Program.MessageError("ClsSkipOnStation", "skipOnStationSendManaul", ex, false);
                return(StatusTransaction.Error);
            }
        }
Esempio n. 5
0
 private void btnSave_Click(object sender, EventArgs e)
 {
     try
     {
         tabAssessmentAndPlanUC1.EndEdit();
         try
         {
             dbc.SubmitChanges();
         }
         catch (System.Data.Linq.ChangeConflictException)
         {
             foreach (System.Data.Linq.ObjectChangeConflict occ in dbc.ChangeConflicts)
             {
                 dbc.Refresh(System.Data.Linq.RefreshMode.KeepChanges, occ.Object);
             }
             dbc.SubmitChanges();
         }
         lbAlertMsg.Text = "Save Data Complete.";
     }
     catch (Exception ex)
     {
         Program.MessageError(this.Name, "btnSave_Click", ex, false);
         lbAlertMsg.Text = "โปรดลองอีกครั้ง";
     }
 }
Esempio n. 6
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            lblMsg.Text = "";
            try
            {
                DateTime dateNow = Program.GetServerDateTime();
                DataBinding_trn_doctor_exam.EndEdit();

                var other = DataBinding_trn_doctor_exam.OfType <trn_doctor_exam>().FirstOrDefault();
                if (other.trxm_create_date == null)
                {
                    other.trxm_create_date = dateNow;
                }
                other.trxm_update_date = dateNow;

                try
                {
                    trn_patient_book_result bookResult = dbc.trn_patient_book_results
                                                         .Where(x => x.tpr_id == Program.CurrentRegis.tpr_id &&
                                                                x.tpbr_radiology == "OE")
                                                         .FirstOrDefault();
                    if (bookResult == null)
                    {
                        bookResult = new trn_patient_book_result()
                        {
                            tpr_id           = Program.CurrentRegis.tpr_id,
                            tpbr_radiology   = "OE",
                            tpbr_create_by   = Program.CurrentUser.mut_username,
                            tpbr_create_date = dateNow
                        };
                        dbc.trn_patient_book_results.InsertOnSubmit(bookResult);
                    }
                    bookResult.tpbr_flag_saved      = true;
                    bookResult.tpbr_show_sections   = true;
                    bookResult.tpbr_show_summary    = true;
                    bookResult.tpbr_not_show_report = false;
                    bookResult.tpbr_active          = true;
                    bookResult.tpbr_update_by       = Program.CurrentUser.mut_username;
                    bookResult.tpbr_update_date     = dateNow;
                    dbc.SubmitChanges();
                }
                catch (System.Data.Linq.ChangeConflictException)
                {
                    foreach (System.Data.Linq.ObjectChangeConflict occ in dbc.ChangeConflicts)
                    {
                        dbc.Refresh(System.Data.Linq.RefreshMode.KeepChanges, occ.Object);
                    }
                    dbc.SubmitChanges();
                }
            }
            catch (Exception ex)
            {
                lblMsg.Text = ex.Message;
            }
            lblMsg.Text = "Save Data Completed.";
        }
Esempio n. 7
0
        //------------Save && Cancel
        private void btnSaveStationRoom_Click(object sender, EventArgs e)
        {
            lbmsgAlert.Text = "";
            mstroomdtlsBindingSource.EndEdit();
            RoomHDRbindingSource1.EndEdit();

            dbc.SubmitChanges();
            lbmsgAlert.Text = "Save data completed.";
            LoadRoomEvent(0);
        }
Esempio n. 8
0
        private bool Save(char strType)
        {
            try
            {
                if (strType == 'N')
                {
                    var objQuestP = (from t1 in dbc.trn_ques_patients where t1.tpr_id == SetTprID select new { t1.tqp_type }).FirstOrDefault();
                    if (objQuestP == null || objQuestP.tqp_type == 'D')
                    {
                        //lblnotcc_questionnaire.Visible = true;

                        if (MessageBox.Show("กรุณายืนยันข้อมูลแบบสอบถาม", "Message Alert", MessageBoxButtons.OK, MessageBoxIcon.Information) == DialogResult.OK)
                        {
                            Forms.QuestionnaireFrm fqn = new Forms.QuestionnaireFrm();
                            fqn.tpr_id = Program.CurrentRegis.tpr_id;
                            fqn.ShowDialog();
                            return(false);
                        }
                        else
                        {
                            return(false);
                        }
                        //return false;
                    }
                }

                try
                {
                    this.subjectiveUC1.EndEdit();
                    this.objectiveUC1.EndEdit();
                    this.tabAssessmentAndPlanUC1.EndEdit();
                    dbc.SubmitChanges();
                }
                catch (System.Data.Linq.ChangeConflictException)
                {
                    foreach (System.Data.Linq.ObjectChangeConflict occ in dbc.ChangeConflicts)
                    {
                        dbc.Refresh(System.Data.Linq.RefreshMode.KeepChanges, occ.Object);
                    }
                    dbc.SubmitChanges();
                }

                //select set current dc hdr
                Program.CurrentHDR = (from hdr in dbc.trn_doctor_hdrs where hdr.tpr_id == SetTprID select hdr).FirstOrDefault();
                return(true);
            }
            catch (Exception ex)
            {
                Program.MessageError(this.Name, "Save", ex, false);
                return(false);
            }
        }
Esempio n. 9
0
 private void SaveData()
 {
     try
     {
         PackageItembindingSource1.EndEdit();
         dbc.SubmitChanges();
         lbmsgalert.Text = "Save data completed.";
     }
     catch (Exception ex)
     {
         lbmsgalert.Text = "Error:" + ex.Message;//Program.MessageError(ex.Message);
     }
 }
Esempio n. 10
0
 private void btnTab1Save_Click(object sender, EventArgs e)
 {
     try
     {
         ConfigHeader_bindingSource1.EndEdit();
         mstconfigdtlsBindingSource.EndEdit();
         dbc.SubmitChanges();
         lbMsgAlertTab1.Text = "Save data completed.";
     }
     catch (Exception ex)
     {
         Program.MessageError(ex.Message);
     }
 }
Esempio n. 11
0
 private void btnSave_Click(object sender, EventArgs e)
 {
     try
     {
         //save Marrie pnlMarried
         PatientbindingSource1.EndEdit();
         dbc.SubmitChanges();
         lbErrormsg.Text = "Save data completed.";
     }
     catch (Exception ex)
     {
         lbErrormsg.Text = ex.Message;
     }
 }
Esempio n. 12
0
        public bool RegisterPatient(tmp_getptarrived arrivedData)
        {
            try
            {
                using (InhCheckupDataContext cdc = new InhCheckupDataContext())
                {
                    DateTime dateNow = Program.GetServerDateTime();

                    EmrClass.GetDataFromWSTrakCare cls = new EmrClass.GetDataFromWSTrakCare();
                    trn_patient tpt            = cdc.trn_patients.Where(x => x.tpt_hn_no == arrivedData.papmi_no).FirstOrDefault();
                    bool        flagNewPatient = true;
                    if (tpt != null)
                    {
                        flagNewPatient = false;
                    }
                    cls.otherClinicSkipToCheckB(arrivedData, ref tpt, Program.CurrentSite.mhs_id);//add Program.CurrentSite.mhs_id suriya 03/04/2015
                    List <trn_patient_regi> listRegis = tpt.trn_patient_regis.Where(x => x.tpr_en_no == arrivedData.paadm_admno).ToList();
                    foreach (trn_patient_regi regis in listRegis)
                    {
                        trn_doctor_hdr docHdr = regis.trn_doctor_hdrs.FirstOrDefault();
                        if (docHdr == null)
                        {
                            docHdr = new trn_doctor_hdr();
                            regis.trn_doctor_hdrs.Add(docHdr);
                            docHdr.trh_create_date = dateNow;
                            docHdr.trh_create_by   = "SysImp";
                            docHdr.trh_update_date = dateNow;
                            docHdr.trh_update_by   = "SysImp";
                        }
                    }
                    if (flagNewPatient)
                    {
                        cdc.trn_patients.InsertOnSubmit(tpt);
                    }
                    cdc.SubmitChanges();
                    trn_patient_regi PatientRegis = tpt.trn_patient_regis.OrderByDescending(x => x.tpr_id).FirstOrDefault();
                    if (PatientRegis != null)
                    {
                        new EmrClass.GetPTPackageCls().setRelationOrderSet(ref PatientRegis);
                        cdc.SubmitChanges();
                    }
                    return(true);
                }
            }
            catch (Exception ex)
            {
                Program.MessageError("EmrClass.FunctionDataCls", "RegisterPatient", ex, false);
                return(false);
            }
        }
Esempio n. 13
0
 private void SaveLAB()
 {
     try
     {
         try
         {
             DateTime dateNow = Program.GetServerDateTime();
             trn_patient_book_result bookResult = dbc.trn_patient_book_results
                                                  .Where(x => x.tpr_id == Program.CurrentRegis.tpr_id &&
                                                         x.tpbr_radiology == "LB")
                                                  .FirstOrDefault();
             if (bookResult == null)
             {
                 bookResult = new trn_patient_book_result()
                 {
                     tpr_id           = Program.CurrentRegis.tpr_id,
                     tpbr_radiology   = "LB",
                     tpbr_create_by   = Program.CurrentUser.mut_username,
                     tpbr_create_date = dateNow
                 };
                 dbc.trn_patient_book_results.InsertOnSubmit(bookResult);
             }
             bookResult.tpbr_flag_saved      = true;
             bookResult.tpbr_show_sections   = true;
             bookResult.tpbr_show_summary    = true;
             bookResult.tpbr_not_show_report = false;
             bookResult.tpbr_active          = true;
             bookResult.tpbr_update_by       = Program.CurrentUser.mut_username;
             bookResult.tpbr_update_date     = dateNow;
             dbc.SubmitChanges();
             lbAlertMsg.Text = "Save Data Complete.";
         }
         catch (System.Data.Linq.ChangeConflictException)
         {
             foreach (System.Data.Linq.ObjectChangeConflict occ in dbc.ChangeConflicts)
             {
                 dbc.Refresh(System.Data.Linq.RefreshMode.KeepChanges, occ.Object);
             }
             dbc.SubmitChanges();
         }
     }
     catch (ChangeConflictException)
     {
         foreach (ObjectChangeConflict occ in dbc.ChangeConflicts)
         {
             dbc.Refresh(System.Data.Linq.RefreshMode.KeepChanges, occ.Object);
         }
         dbc.SubmitChanges();
     }
 }
Esempio n. 14
0
 private void btnSave_Click(object sender, EventArgs e)
 {
     try
     {
         tabPhyExamUC1.EndEdit();
         try
         {
             DateTime dateNow = Program.GetServerDateTime();
             trn_patient_book_result bookResult = dbc.trn_patient_book_results
                                                  .Where(x => x.tpr_id == this._tpr_id &&
                                                         x.tpbr_radiology == "PE")
                                                  .FirstOrDefault();
             if (bookResult == null)
             {
                 bookResult = new trn_patient_book_result()
                 {
                     tpr_id           = (int)this._tpr_id,
                     tpbr_radiology   = "PE",
                     tpbr_create_by   = Program.CurrentUser.mut_username,
                     tpbr_create_date = dateNow
                 };
                 dbc.trn_patient_book_results.InsertOnSubmit(bookResult);
             }
             bookResult.tpbr_flag_saved      = true;
             bookResult.tpbr_show_sections   = true;
             bookResult.tpbr_show_summary    = true;
             bookResult.tpbr_not_show_report = false;
             bookResult.tpbr_active          = true;
             bookResult.tpbr_update_by       = Program.CurrentUser.mut_username;
             bookResult.tpbr_update_date     = dateNow;
             dbc.SubmitChanges();
         }
         catch (System.Data.Linq.ChangeConflictException)
         {
             foreach (System.Data.Linq.ObjectChangeConflict occ in dbc.ChangeConflicts)
             {
                 dbc.Refresh(System.Data.Linq.RefreshMode.KeepChanges, occ.Object);
             }
             dbc.SubmitChanges();
         }
         lbAlertMsg.Text          = "Save Data Complete.";
         btnSendToDocscan.Enabled = true;
     }
     catch (Exception ex)
     {
         Program.MessageError(this.Name, "btnSave_Click", ex, false);
         lbAlertMsg.Text = "โปรดลองอีกครั้ง";
     }
 }
Esempio n. 15
0
 private void UI_DeleteFavorite(object sender, string e)
 {
     if (MessageBox.Show("Do you want to Delete '" + e + "'?", e, MessageBoxButtons.YesNo) == DialogResult.Yes)
     {
         try
         {
             ExamResultUI ui = sender as ExamResultUI;
             if (ui != null)
             {
                 using (InhCheckupDataContext cdc = new InhCheckupDataContext())
                 {
                     mst_autocomplete_physical_exam mst = cdc.mst_autocomplete_physical_exams
                                                          .Where(x => x.mape_type == ui.AutoCompleteType &&
                                                                 x.mst_user_type.mut_username == _username &&
                                                                 x.mape_description == e)
                                                          .FirstOrDefault();
                     if (mst != null)
                     {
                         cdc.mst_autocomplete_physical_exams.DeleteOnSubmit(mst);
                         cdc.SubmitChanges();
                     }
                     List <string> tmp = ui.AutoCompleteListThList;
                     tmp.Remove(e);
                     ui.AutoCompleteListThList = tmp;
                 }
             }
         }
         catch (Exception ex)
         {
             Program.MessageError("ExamCheckupUC", "UI_DeleteText", ex, false);
         }
     }
 }
Esempio n. 16
0
 public string SaveDraft(int tpr_id, string reason)
 {
     try
     {
         using (InhCheckupDataContext cdc = new InhCheckupDataContext())
         {
             trn_patient_doctor_approve patientDoctorApprove = cdc.trn_patient_doctor_approves
                                                               .Where(x => x.tpr_id == tpr_id)
                                                               .FirstOrDefault();
             if (patientDoctorApprove != null)
             {
                 patientDoctorApprove.tpda_reject_reason = reason;
                 cdc.SubmitChanges();
                 return("Save Draft Completed.");
             }
             else
             {
                 return("");
             }
         }
     }
     catch (Exception ex)
     {
         return(ex.Message);
     }
 }
Esempio n. 17
0
        private StatusTransaction UpdatedLower()
        {
            try
            {
                try
                {
                    _timeLower = Convert.ToInt32(_timeLower).ToString();
                }
                catch
                {
                    _timeLower = "0";
                }

                using (InhCheckupDataContext cdc = new InhCheckupDataContext())
                {
                    DateTime         datenow         = Program.GetServerDateTime();
                    trn_patient_regi objpatientregis = (from t1 in cdc.trn_patient_regis
                                                        where t1.tpr_id == _tpr_id
                                                        select t1).FirstOrDefault();
                    objpatientregis.tpr_miss_lower      = (_checkLower == true) ? true : false;
                    objpatientregis.tpr_miss_lower_date = (_checkLower == true) ? (DateTime?)datenow : null;
                    objpatientregis.tpr_call_lower_time = Convert.ToInt32(_timeLower);
                    objpatientregis.tpr_call_lower_date = Program.GetServerDateTime().AddMinutes((double)objpatientregis.tpr_call_lower_time);
                    cdc.SubmitChanges();
                    return(StatusTransaction.True);
                }
                //End Set column [tus_miss_lower]
            }
            catch (Exception ex)
            {
                Program.MessageError("frmUltrasound2", "UpdatedLower", ex, false);
                return(StatusTransaction.Error);
            }
        }
Esempio n. 18
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            lbAlertMessage.Text = "";
            if (GridUsertype.CurrentRow != null)
            {
                string UserID       = Convert1.ToString(GridUsertype.CurrentRow.Cells[1].Value);
                string UserName     = GridUsertype.CurrentRow.Cells[2].Value.ToString();
                var    listUserroom = (from t1 in dbc.mst_user_rooms
                                       where t1.mut_username == UserName
                                       select t1);
                dbc.mst_user_rooms.DeleteAllOnSubmit(listUserroom);

                for (int i = 0; i <= dataGridView1.Rows.Count - 1; i++)
                {
                    if (Convert1.ToBoolean(dataGridView1[0, i].Value) == true)
                    {
                        int mrmid = Utility.GetInteger(dataGridView1[1, i].Value);

                        mst_user_type usermut = (from t1 in dbc.mst_user_types where t1.mut_username == UserName select t1).FirstOrDefault();
                        mst_user_room newitem = new mst_user_room();
                        newitem.mst_user_type = usermut;
                        newitem.mut_id        = usermut.mut_id;
                        newitem.mut_username  = UserName;
                        newitem.mrm_id        = mrmid;
                        dbc.mst_user_rooms.InsertOnSubmit(newitem);
                    }
                }
                dbc.SubmitChanges();
                lbAlertMessage.Text = "Save data completed.";
            }
            else
            {
                lbAlertMessage.Text = "Please select user for edit.";
            }
        }
Esempio n. 19
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                if (currentObste != null)
                {
                    var objcurrentpft = (from t1 in dbc.trn_obstetric_chiefs
                                         where t1.toc_id == currentObste.toc_id
                                         select t1).FirstOrDefault();
                    if (objcurrentpft != null)
                    {
                        //if (ch_ResultAlert.Enabled == true)
                        //{

                        //}
                        objcurrentpft.toc_doc_code = txtDocCode.Text;
                        objcurrentpft.toc_doc_name = txtDocName.Text;
                        dbc.SubmitChanges();
                    }
                    lbMsgAlert.Text = "Save data completed.";
                    txtDocCode.Text = "";
                    txtDocName.Text = "";
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Alert Message", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Esempio n. 20
0
 public static void MessageError(string strEvent, string ErrorCode, Exception ex, bool isShowMsg)
 {
     try
     {
         using (InhCheckupDataContext dbc = new InhCheckupDataContext())
         {
             log_transaction objlog = new log_transaction();
             objlog.its_user_by    = (Program.CurrentUser == null) ? "" : Program.CurrentUser.mut_username;
             objlog.its_program    = (Program.CurrentRoom == null) ? "" : Program.CurrentRoom.mrd_ename;
             objlog.its_tpr_id     = (Program.CurrentRegis == null) ? 0 : Program.CurrentRegis.tpr_id;
             objlog.its_event      = strEvent;
             objlog.its_err_code   = ErrorCode;
             objlog.its_err_msg    = (ex == null) ? "" : ex.Message;
             objlog.its_StackTrace = (ex == null) ? "" : ex.StackTrace;
             objlog.its_err_date   = Program.GetServerDateTime();
             dbc.log_transactions.InsertOnSubmit(objlog);
             dbc.SubmitChanges();
         }
     }
     catch (Exception)
     {
         if (isShowMsg)
         {
             MessageBox.Show("บันทึก Log Tranaction ไม่ได้", "Error Alert", MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
     }
     if (isShowMsg)
     {
         MessageBox.Show("ระบบเกิดข้อผิดพลาดไม่สามารถทำงานต่อได้ กรุณาติดต่อผู้ดูแลระบบ " + Environment.NewLine + ex.Message, "แจ้งเตือนปัญหาการใช้งาน", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Esempio n. 21
0
 public StatusTransaction pendingPatientCheckpointB(int tpr_id, int mhs_id, List <int> list_mvt_id)
 {
     try
     {
         using (InhCheckupDataContext cdc = new InhCheckupDataContext())
         {
             trn_patient_regi tpr = cdc.trn_patient_regis.Where(x => x.tpr_id == tpr_id).FirstOrDefault();
             tpr.tpr_pending = true;
             EmrClass.GetDataMasterCls mst = new EmrClass.GetDataMasterCls();
             foreach (int mvt_id in list_mvt_id)
             {
                 mst_room_hdr mrm = mst.GetMstRoomHdrByMvt(mvt_id, mhs_id);
                 updatePendingPatientPlan(ref tpr, mvt_id, mrm.mrm_id, mhs_id);
                 insertPatientPending(ref tpr, mrm.mrm_id);
             }
             cdc.SubmitChanges();
             return(StatusTransaction.True);
         }
     }
     catch (Exception ex)
     {
         Program.MessageError("ClsPendingOnStation", "pendingPatientCheckpointB", ex, false);
         return(StatusTransaction.Error);
     }
 }
Esempio n. 22
0
 private bool SkipLower()
 {
     try
     {
         using (InhCheckupDataContext cdc = new InhCheckupDataContext())
         {
             DateTime         dateNow      = Program.GetServerDateTime();
             trn_patient_regi PatientRegis = cdc.trn_patient_regis
                                             .Where(x => x.tpr_id == tpr_id)
                                             .FirstOrDefault();
             PatientRegis.tpr_miss_lower = chkUltrasound.Checked;
             if (chkUltrasound.Checked)
             {
                 PatientRegis.tpr_miss_lower_date = dateNow;
                 PatientRegis.tpr_call_lower_time = Convert.ToInt32(txtMinuteLower.Text);
                 PatientRegis.tpr_call_lower_date = dateNow.AddMinutes(Convert.ToInt32(txtMinuteLower.Text));
             }
             else
             {
                 PatientRegis.tpr_miss_lower_date = null;
                 PatientRegis.tpr_call_lower_time = null;
                 PatientRegis.tpr_call_lower_date = null;
             }
             cdc.SubmitChanges();
             return(true);
         }
     }
     catch (Exception ex)
     {
         Program.MessageError(this.Name, "SkipLower()", ex, false);
         return(false);
     }
 }
Esempio n. 23
0
        public bool SendToCheckBOnStation(int tpr_id, int tps_id)
        {
            try
            {
                using (InhCheckupDataContext cdc = new InhCheckupDataContext())
                {
                    DateTime         dateNow = Program.GetServerDateTime();
                    trn_patient_regi tpr     = cdc.trn_patient_regis.Where(x => x.tpr_id == tpr_id).FirstOrDefault();

                    patient_regisToCheckB(ref tpr);
                    queueToCheckB(ref tpr, dateNow);

                    trn_patient_queue tps = tpr.trn_patient_queues.Where(x => x.tps_id == tps_id).FirstOrDefault(); // update status ห้องปัจจุบัน
                    tps.tps_send_by     = Program.CurrentUser.mut_username;
                    tps.tps_end_date    = dateNow;
                    tps.tps_status      = "ED";
                    tps.tps_ns_status   = null;
                    tps.tps_update_by   = Program.CurrentUser.mut_username;
                    tps.tps_update_date = dateNow;
                    cdc.SubmitChanges();
                }
                return(true);
            }
            catch
            {
            }
            return(false);
        }
Esempio n. 24
0
        public ActionResult LogOn()
        {
            string username = Request.QueryString["username"];
            string otp      = Request.QueryString["password"];

            if (string.IsNullOrEmpty(username) || string.IsNullOrEmpty(otp))
            {
                return(View());
            }
            else
            {
                using (InhCheckupDataContext cdc = new InhCheckupDataContext())
                {
                    DateTime     dateNow = Utility.GetServerDateTime();
                    mst_user_otp mdo     = cdc.mst_user_otps.Where(x => x.mst_user_type.mut_username == username).FirstOrDefault();
                    if (mdo != null && mdo.mut_otp == otp && mdo.mut_expire >= dateNow)
                    {
                        mdo.mut_expire = dateNow;
                        cdc.SubmitChanges();
                        Session["username"] = username;
                        return(RedirectToAction("PatientSearch", "BookViewer"));
                    }
                    else
                    {
                        return(View(new LogOnModel()
                        {
                            strMsg = "Invalid Log in. Please try again."
                        }));
                    }
                }
            }
        }
Esempio n. 25
0
 private void button1_Click(object sender, EventArgs e)
 {
     if (bsPatient.Count == 0)
     {
         return;
     }
     using (InhCheckupDataContext cdc = new InhCheckupDataContext())
     {
         int tpr_id           = ((Patients)bsPatient.Current).tpr_id;
         trn_patient_regi tpr = cdc.trn_patient_regis.Where(x => x.tpr_id == tpr_id).FirstOrDefault();
         if (radioButton1.Checked)
         {
             tpr.tpr_patient_type = '1';
         }
         else if (radioButton2.Checked)
         {
             tpr.tpr_patient_type = '2';
         }
         else
         {
             tpr.tpr_patient_type = '3';
         }
         cdc.SubmitChanges();
     }
 }
Esempio n. 26
0
 private void btnSave_Click(object sender, EventArgs e)
 {
     try
     {
         if (CurrentPFT != null)
         {
             var objcurrentpft = (from t1 in dbc.trn_pfts
                                  where t1.tpf_id == CurrentPFT.tpf_id
                                  select t1).FirstOrDefault();
             if (objcurrentpft != null)
             {
                 objcurrentpft.tpf_doc_code = txtDocCode.Text;
                 objcurrentpft.tpf_doc_name = txtDocName.Text;
                 dbc.SubmitChanges();
             }
             lbMsgAlert.Text = "Save data completed.";
             txtDocCode.Text = "";
             txtDocName.Text = "";
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "Alert Message", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Esempio n. 27
0
        private void btnSaveAsDraft_Click(object sender, EventArgs e)
        {
            try
            {
                trn_patient_ass_hdr currenthdr = (trn_patient_ass_hdr)PatientAssHdrbindingSource1.Current;
                currenthdr.tpeh_summary = Program.GetValueRadioTochar(panelSummary);

                PatientAssHdrbindingSource1.EndEdit();
                dbc.SubmitChanges();
                lbAlertMsg.Text = "Save data completed.";
            }
            catch (Exception ex)
            {
                Program.MessageError(this.Name, "btnSaveAsDraft_Click", ex, false);
            }
        }
Esempio n. 28
0
 private void btnLogIn_Click(object sender, EventArgs e)
 {
     try
     {
         using (InhCheckupDataContext cdc = new InhCheckupDataContext())
         {
             userAdmin user = admin.Where(x => x.user.ToUpper() == txtusername.Text.ToUpper()).FirstOrDefault();
             if (user != null && user.password == txtpassword.Text)
             {
                 trn_patient_doctor_approve docApprove = cdc.trn_patient_doctor_approves
                                                         .Where(x => x.tpr_id == _tpr_id)
                                                         .FirstOrDefault();
                 docApprove.tpda_status       = "CBB";
                 docApprove.tpda_process_by   = user.user;
                 docApprove.tpda_process_date = DateTime.Now;
                 cdc.SubmitChanges();
                 loginSuccess = true;
                 this.Close();
             }
             else
             {
                 label3.Visible = true;
             }
         }
     }
     catch
     {
         MessageBox.Show("เกิดความผิดพลาด กรุณาลองอีกครั้ง", "Fail.");
     }
 }
Esempio n. 29
0
 public bool RetrieveLabToEmrCheckupWithQuestionnaire(int tpr_id, LabClass.QuestionnaireResult questionnaire, string user)
 {
     try
     {
         using (InhCheckupDataContext cdc = new InhCheckupDataContext())
         {
             DateTime dateNow = Class.globalCls.GetServerDateTime();
             var      pregis  = cdc.trn_patient_regis.Where(x => x.tpr_id == tpr_id).FirstOrDefault();
             var      ques    = pregis.trn_ques_patients.FirstOrDefault();
             if (ques == null)
             {
                 ques = new trn_ques_patient
                 {
                     tqp_create_by   = user,
                     tqp_create_date = dateNow
                 };
                 pregis.trn_ques_patients.Add(ques);
             }
             ques.tqp_his_smok      = questionnaire.smoke;
             ques.tqp_fwm_pregnancy = questionnaire.pregnancy;
             ques.tqp_ill_med_diab  = questionnaire.diabetes;
             ques.tqp_update_by     = user;
             ques.tqp_update_date   = dateNow;
             cdc.SubmitChanges();
         }
         return(RetrieveLabToEmrCheckup(tpr_id, user));
     }
     catch (Exception ex)
     {
         Class.globalCls.MessageError("InsertLabCls", "RetrieveLabToEmrCheckupWithQuestionnaire", ex.Message);
         throw ex;
     }
     return(false);
 }
Esempio n. 30
0
 private void frmMain_FormClosing(object sender, FormClosingEventArgs e)
 {
     if (MessageBox.Show("คุณต้องการออกจากโปรแกรมหรือไม่", "ยืนยันการออกจากโปรแกรม", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
     {
         e.Cancel = true;
     }
     else
     {
         if (Class.ClsManageUserLogin.current_log != null)
         {
             try
             {
                 using (InhCheckupDataContext cdc = new InhCheckupDataContext())
                 {
                     log_user_login log = cdc.log_user_logins.Where(x => x.lug_id == Class.ClsManageUserLogin.current_log.lug_id).FirstOrDefault();
                     if (log.lug_end_date == null)
                     {
                         log.lug_end_date = Program.GetServerDateTime();
                         cdc.SubmitChanges();
                     }
                 }
             }
             catch
             {
             }
         }
         Program.Logout();
     }
 }