private void gridStation_CellContentClick(object sender, DataGridViewCellEventArgs e) { try { if (gridStation.Columns[e.ColumnIndex].Name == "colBtn") { StatusTransaction updateLower = UpdatedLower(); if (updateLower == StatusTransaction.True) { gridStationObj gso = (gridStationObj)gridStationBindingSource.Current; EmrClass.GetDataMasterCls mst = new EmrClass.GetDataMasterCls(); mst_event mvt = mst.GetMstEvent(gso.mvt_id); if (mvt.mvt_code == "EM") { List <gridStationObj> obj = (List <gridStationObj>)gridStationBindingSource.DataSource; mst_event eyeNurseEvent = mst.GetMstEvent("EN"); var incMvtCode = obj.Select(x => mst.GetMstEvent(x.mvt_id).mvt_code).ToList(); if (incMvtCode.Contains(eyeNurseEvent.mvt_code)) { MessageBox.Show("Can not send to " + mvt.mvt_ename + " before " + eyeNurseEvent.mvt_ename + "." + Environment.NewLine + "Please select another room.", "Send Queue Alert", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } } bool success = false; gridStationObj result = (gridStationObj)gridStationBindingSource.Current; if (rdSkip.Checked) { Class.ClsSkipOnStation skip = new Class.ClsSkipOnStation(); if (_useform == useform.onStation) { //success = skip.skipOnStationSendManaul((int)result.mrm_id, result.mvt_id); StatusTransaction skipStation = skip.skipOnStationSendManaul((int)_tpr_id, (int)_tps_id, (int)result.mrm_id, result.mvt_id); if (skipStation == StatusTransaction.True) { new Class.logPatientFlowCls(Class.logPatientFlowCls.sendType.SkipManual, (int)_tpr_id, (int)_tps_id, Program.CurrentSite.mhs_id, Program.CurrentRoom.mrd_ename, Program.CurrentUser.mut_username); success = true; //if (new EmrClass.GetDataMasterCls().GetMstRoomHdr((int)result.mrm_id).mrm_code == "DC") //{ //new Class.FunctionDataCls().stampPEDoctor((int)_tpr_id); //} } else if (skipStation == StatusTransaction.NoProcess) { MessageBox.Show("คนไข้ไม่ได้อยู่ในสถานะดำเนินการ skip ต่อได้", "Alert", MessageBoxButtons.OK, MessageBoxIcon.Information); } else if (skipStation == StatusTransaction.Error) { MessageBox.Show("กรุณา skip อีกครั้ง", "Alert.", MessageBoxButtons.OK, MessageBoxIcon.Information); } } else if (_useform == useform.onWaiting) { //success = skip.skipOnStationSendManaul((int)result.mrm_id, result.mvt_id); StatusTransaction skipStation = skip.skipOnWaitingSendManaul((int)_tpr_id, (int)_tps_id, (int)result.mrm_id, result.mvt_id); if (skipStation == StatusTransaction.True) { new Class.logPatientFlowCls(Class.logPatientFlowCls.sendType.SkipOnWaitingManual, (int)_tpr_id, (int)_tps_id, Program.CurrentSite.mhs_id, "WaitingList", Program.CurrentUser.mut_username); success = true; //if (new EmrClass.GetDataMasterCls().GetMstRoomHdr((int)result.mrm_id).mrm_code == "DC") //{ //new Class.FunctionDataCls().stampPEDoctor((int)_tpr_id); //} } else if (skipStation == StatusTransaction.NoProcess) { MessageBox.Show("คนไข้ไม่ได้อยู่ในสถานะดำเนินการ skip ต่อได้", "Alert", MessageBoxButtons.OK, MessageBoxIcon.Information); } else if (skipStation == StatusTransaction.Error) { MessageBox.Show("กรุณา skip อีกครั้ง", "Alert.", MessageBoxButtons.OK, MessageBoxIcon.Information); } } } else if (rdPending.Checked) { Class.ClsPendingOnStation pend = new Class.ClsPendingOnStation(); if (_useform == useform.onStation) { //success = pend.pendingOnStationSendManaul((int)result.mrm_id, result.mvt_id); StatusTransaction pendingStation = pend.pendingOnStationSendManaul((int)_tpr_id, (int)_mvt_id, (int)_mrm_id, (int)_mhs_id, (int)result.mrm_id, result.mvt_id, (int)_tps_id); if (pendingStation == StatusTransaction.True) { new Class.logPatientFlowCls(Class.logPatientFlowCls.sendType.PendingManual, (int)_tpr_id, (int)_tps_id, Program.CurrentSite.mhs_id, Program.CurrentRoom.mrd_ename, Program.CurrentUser.mut_username); success = true; //if (new EmrClass.GetDataMasterCls().GetMstRoomHdr((int)result.mrm_id).mrm_code == "DC") //{ //new Class.FunctionDataCls().stampPEDoctor((int)_tpr_id); //} } else if (pendingStation == StatusTransaction.NoProcess) { MessageBox.Show("คนไข้ไม่ได้อยู่ในสถานะดำเนินการ pending ต่อได้", "Alert", MessageBoxButtons.OK, MessageBoxIcon.Information); } else if (pendingStation == StatusTransaction.Error) { MessageBox.Show("กรุณา pending อีกครั้ง", "Alert.", MessageBoxButtons.OK, MessageBoxIcon.Information); } } else if (_useform == useform.onWaiting) { //success = pend.pendingOnStationSendManaul((int)result.mrm_id, result.mvt_id); StatusTransaction pendingStation = pend.pendingOnWaitingSendManaul((int)_tpr_id, (int)_mvt_id, (int)_mrm_id, (int)_mhs_id, (int)result.mrm_id, result.mvt_id, (int)_tps_id); if (pendingStation == StatusTransaction.True) { new Class.logPatientFlowCls(Class.logPatientFlowCls.sendType.PendingOnWaitingManual, (int)_tpr_id, (int)_tps_id, Program.CurrentSite.mhs_id, "WaitingList", Program.CurrentUser.mut_username); success = true; //if (new EmrClass.GetDataMasterCls().GetMstRoomHdr((int)result.mrm_id).mrm_code == "DC") //{ //new Class.FunctionDataCls().stampPEDoctor((int)_tpr_id); //} } else if (pendingStation == StatusTransaction.NoProcess) { MessageBox.Show("คนไข้ไม่ได้อยู่ในสถานะดำเนินการ pending ต่อได้", "Alert", MessageBoxButtons.OK, MessageBoxIcon.Information); } else if (pendingStation == StatusTransaction.Error) { MessageBox.Show("กรุณากด pending อีกครั้ง", "Alert.", MessageBoxButtons.OK, MessageBoxIcon.Information); } } } if (success) { Program.CurrentRegis = null; Program.CurrentPatient_queue = null; this.DialogResult = System.Windows.Forms.DialogResult.OK; } } else if (updateLower == StatusTransaction.Error) { MessageBox.Show("กรุณากด send manual อีกครั้ง", "Alert.", MessageBoxButtons.OK, MessageBoxIcon.Information); } } } catch (Exception ex) { MessageBox.Show("กรุณากด send manual อีกครั้ง", "Alert.", MessageBoxButtons.OK, MessageBoxIcon.Information); Program.MessageError("frmCancelQueue", "gridStation_CellContentClick", ex, false); } finally { this.Close(); } }
private bool popupFinish(int tpb_id) { using (frmPopupBookFinishRemark frm = new frmPopupBookFinishRemark()) { frmPopupBookFinishRemark.bookFinish _bookFinish = frm.popupFinish(); if (_bookFinish.save == true) { try { using (InhCheckupDataContext dbc = new InhCheckupDataContext()) { DateTime dateNow = Program.GetServerDateTime(); int tpr_id = dbc.trn_patient_books.Where(x => x.tpb_id == tpb_id).Select(x => x.tpr_id).FirstOrDefault(); trn_patient_regi tpr = dbc.trn_patient_regis.Where(x => x.tpr_id == tpr_id).FirstOrDefault(); tpr.tpr_status = "CP"; trn_patient_book tpb = tpr.trn_patient_books.Where(x => x.tpb_id == tpb_id).FirstOrDefault(); tpb.tpb_status = "BF"; tpb.tpb_send_email = _bookFinish.detail.send_email; tpb.tpb_send_post = _bookFinish.detail.send_post; tpb.tpb_finish_remark = _bookFinish.detail.remark; tpb.tpb_update_by = Program.CurrentUser.mut_username; tpb.tpb_update_date = dateNow; tpb.tpb_finish_by = Program.CurrentUser.mut_username; tpb.tpb_finish_date = dateNow; EmrClass.GetDataMasterCls mst = new EmrClass.GetDataMasterCls(); mst_hpc_site mhs = mst.GetMstHpcSite(tpr.mhs_id); mst_room_hdr mrm_finish = mst.GetMstRoomHdr("FN", mhs.mhs_code); //mst_room_dtl mrd_finish = dbc.mst_room_dtls.Where(x => x.mrm_id == mrm_finish.mrm_id).FirstOrDefault(); mst_event mvt_finish = mst.GetMstEvent("FN"); trn_patient_queue tps = tpr.trn_patient_queues.Where(x => x.mrm_id == mrm_finish.mrm_id).FirstOrDefault(); if (tps == null) { tps = new trn_patient_queue(); tpr.trn_patient_queues.Add(tps); } //tps.mrd_id = mrd_finish.mrd_id; tps.mrm_id = mrm_finish.mrm_id; tps.mvt_id = mvt_finish.mvt_id; tps.tps_bm_seq = null; tps.tps_end_date = dateNow; tps.tps_call_by = Program.CurrentUser.mut_username; tps.tps_call_date = dateNow; tps.tps_call_status = null; tps.tps_update_by = Program.CurrentUser.mut_username; tps.tps_update_date = dateNow; tps.tps_ns_status = null; tps.tps_status = "LR"; dbc.SubmitChanges(); } return(true); } catch (Exception ex) { throw new Exception(ex.Message); } } } return(false); }
private void previewBook(int tpb_id) { try { using (InhCheckupDataContext dbc = new InhCheckupDataContext()) { trn_patient_book tpb = dbc.trn_patient_books.Where(x => x.tpb_id == tpb_id).FirstOrDefault(); string path = @"\\" + tpb.tpb_server_path + @"\" + tpb.tpb_path_file + @"\" + tpb.tpb_file_name; if (File.Exists(path)) { try { Process.Start(path); } catch { lbAlert.Text = "Cannot Open File."; } } else { lbAlert.Text = "File not Exists or Connect Server Error."; } if (tpb.tpb_print_by == null) { tpb.tpb_reprint = 0; } else { tpb.tpb_reprint++; } DateTime dateNow = Program.GetServerDateTime(); tpb.tpb_status = "BP"; tpb.tpb_update_by = Program.CurrentUser.mut_username; tpb.tpb_update_date = dateNow; tpb.tpb_print_by = Program.CurrentUser.mut_username; tpb.tpb_print_date = dateNow; trn_patient_regi tpr = tpb.trn_patient_regi; tpr.tpr_print_book = "C"; EmrClass.GetDataMasterCls mst = new EmrClass.GetDataMasterCls(); mst_hpc_site mhs = mst.GetMstHpcSite(tpr.mhs_id); mst_room_hdr mrm_book = mst.GetMstRoomHdr("BK", mhs.mhs_code); mst_room_dtl mrd_book = dbc.mst_room_dtls.Where(x => x.mrm_id == mrm_book.mrm_id).FirstOrDefault(); mst_event mvt_book = mst.GetMstEvent("BK"); trn_patient_queue tps = tpr.trn_patient_queues.Where(x => x.mrm_id == mrm_book.mrm_id).FirstOrDefault(); if (tps == null) { tps = new trn_patient_queue(); tpr.trn_patient_queues.Add(tps); } tps.mrd_id = mrd_book.mrd_id; tps.mrm_id = mrm_book.mrm_id; tps.mvt_id = mvt_book.mvt_id; tps.tps_bm_seq = null; tps.tps_call_by = Program.CurrentUser.mut_username; tps.tps_call_date = dateNow; tps.tps_call_status = null; tps.tps_end_date = dateNow; tps.tps_update_by = Program.CurrentUser.mut_username; tps.tps_update_date = dateNow; tps.tps_ns_status = null; tps.tps_status = "LR"; mst_room_hdr mrm_finish = mst.GetMstRoomHdr("FN", mhs.mhs_code); mst_event mvt_finish = mst.GetMstEvent("FN"); tpr.trn_patient_queues.Add(new trn_patient_queue { mrd_id = null, mrm_id = mrm_finish.mrm_id, mvt_id = mvt_finish.mvt_id, tps_bm_seq = null, tps_start_date = dateNow, tps_call_by = Program.CurrentUser.mut_username, tps_call_date = dateNow, tps_call_status = null, tps_update_by = Program.CurrentUser.mut_username, tps_update_date = dateNow, tps_ns_status = "QL", tps_status = "NS" }); dbc.SubmitChanges(); } } catch (Exception ex) { throw new Exception(ex.Message); } }
private bool ProcessSelectRoom(int select_mvt_id, int select_mrm_id, int waitingTime) { EmrClass.GetDataMasterCls mst = new EmrClass.GetDataMasterCls(); Class.FunctionDataCls func = new Class.FunctionDataCls(); int tpr_id = Program.CurrentRegis.tpr_id; int mrm_id = Program.CurrentRoom.mrm_id; mst_room_hdr currentRoom = mst.GetMstRoomHdr(mrm_id); if (currentRoom != null && currentRoom.mrm_code == "EM" && Program.CurrentRoom.mrd_type == 'N') { mst_event selectRoom = mst.GetMstEvent(select_mvt_id); if (func.checkEyeDropper(tpr_id)) { if (selectRoom != null) { if (selectRoom.mvt_code == "EM") { if (MessageBox.Show("มีการเลือก Eye Dropper ซึ่งมีการรอ 15 นาที" + Environment.NewLine + "คุณต้องการดำเนินการต่อหรือไม่?", "Warning!", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes) { return(true); } else { return(false); } } else { var timelimit = Program.GetLimitTime("EDT"); if (waitingTime > timelimit) { if (MessageBox.Show("ห้องที่คุณเลือก มีเวลารอเกิน " + timelimit.ToString() + " นาที" + Environment.NewLine + "คุณต้องการดำเนินการต่อหรือไม่?", "Warning!", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes) { return(true); } else { return(false); } } else { return(true); } } } return(false); } else { if (selectRoom != null) { if (selectRoom.mvt_code != "EM") { if (MessageBox.Show("ส่งห้องที่ไม่ใช่ Eye Doctor คุณต้องการจะดำเนินการต่อหรือไม่?", "Warning!", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes) { return(true); } else { return(false); } } else { return(true); } } return(false); } } else { return(true); } }