Пример #1
0
        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();
            }
        }
Пример #2
0
        private void btnSendAuto_Click(object sender, EventArgs e)
        {
            try
            {
                StatusTransaction updateLower = UpdatedLower();
                if (updateLower == StatusTransaction.True)
                {
                    StatusTransaction success = StatusTransaction.NoProcess;
                    if (rdSkip.Checked)
                    {
                        Class.ClsSkipOnStation skip = new Class.ClsSkipOnStation();
                        //success = skip.skipOnStationSendAuto();
                        success = skip.skipOnStationSendAuto((int)_tpr_id, (int)_mrm_id, (int)_tps_id);
                    }
                    else if (rdPending.Checked)
                    {
                        Class.ClsPendingOnStation pend = new Class.ClsPendingOnStation();
                        //success = pend.pendingOnStationSendAuto();
                        success = pend.pendingOnStationSendAuto((int)_tpr_id, (int)_mvt_id, (int)_mrm_id, (int)_mhs_id, (int)_tps_id);
                    }

                    if (success == StatusTransaction.True)
                    {
                        if (rdSkip.Checked)
                        {
                            new Class.logPatientFlowCls(Class.logPatientFlowCls.sendType.SkipAuto,
                                                        (int)_tpr_id,
                                                        (int)_tps_id,
                                                        Program.CurrentSite.mhs_id,
                                                        Program.CurrentRoom.mrd_ename,
                                                        Program.CurrentUser.mut_username);
                        }
                        else if (rdPending.Checked)
                        {
                            new Class.logPatientFlowCls(Class.logPatientFlowCls.sendType.PendingAuto,
                                                        (int)_tpr_id,
                                                        (int)_tps_id,
                                                        Program.CurrentSite.mhs_id,
                                                        Program.CurrentRoom.mrd_ename,
                                                        Program.CurrentUser.mut_username);
                        }

                        Program.CurrentRegis         = null;
                        Program.CurrentPatient_queue = null;
                        this.DialogResult            = System.Windows.Forms.DialogResult.OK;
                    }
                    else if (success == StatusTransaction.ReSendManualSite2)
                    {
                        MessageBox.Show("ไม่สามารถดำเนินการ send auto ได้ กรุณาเลือกห้องที่จะส่งอีกครั้ง", "Alert.", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                    else
                    {
                        MessageBox.Show("กรุณาดำเนินการอีกครั้ง", "Alert.", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        this.DialogResult = System.Windows.Forms.DialogResult.Retry;
                        //return error
                    }
                }
                else if (updateLower == StatusTransaction.Error)
                {
                    MessageBox.Show("กรุณา send auto อีกครั้ง", "Alert.", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            catch
            {
            }
        }
Пример #3
0
        private void btnOK_Click(object sender, EventArgs e)
        {
            int tpr_id = Program.CurrentRegis.tpr_id;
            StatusTransaction checkPatientOnCheckB = new Class.FunctionDataCls().checkStatusPatientOnCheckPointB(tpr_id, Program.CurrentRoom.mrm_id);

            if (checkPatientOnCheckB == StatusTransaction.True)
            {
                Class.ClsPendingOnStation cls = new Class.ClsPendingOnStation();
                List <int> list_mvt_id        = new List <int>();
                foreach (DataGridViewRow dr in gridStation.Rows)
                {
                    if (dr.Cells[0].Value != null)
                    {
                        if ((bool)dr.Cells[Colselect.Name].Value == true)
                        {
                            int mvt_id = Convert.ToInt32(dr.Cells["colmvtid"].Value);
                            list_mvt_id.Add(mvt_id);
                        }
                    }
                }
                //int mhs_id = Program.CurrentSite.mhs_id;
                StatusTransaction pandingOnCheckB = new Class.ClsPendingOnStation().pendingPatientCheckpointB(list_mvt_id);
                if (pandingOnCheckB == StatusTransaction.Error)
                {
                    MessageBox.Show("Alert.", "กรุณา Cancel อีกครั้ง", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else if (pandingOnCheckB == StatusTransaction.True)
                {
                    this.DialogResult = DialogResult.OK;
                }
            }
            else if (checkPatientOnCheckB == StatusTransaction.False)
            {
                MessageBox.Show("คนไข้ไม่ได้อยู่ในสถานะ ที่จะยกเลิก Station ได้", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
                this.DialogResult = DialogResult.Cancel;
            }

            //string strReason="";
            //strReason = CBReason.SelectedValue.ToString();
            //if (txtReason.Text.Trim().Length > 0)
            //{
            //    strReason += txtReason.Text;
            //}
            //if (strReason.Trim() == "")
            //{
            //    txtReason.Focus();
            //    return;
            //}

            //bool isupdate = false;

            //for (int iRow = 0; iRow <= dataGridView2.Rows.Count - 1; iRow++)
            //{

            //    if (dataGridView2[0, iRow].Value != null && Convert.ToBoolean(dataGridView2[0, iRow].Value) == true)
            //    {
            //        int mvtid = Convert.ToInt32(dataGridView2["colmvtid", iRow].Value);
            //        int mrmid = Convert.ToInt32(dataGridView2["colRoomid", iRow].Value);

            //        //noina modufy

            //         int count_te = (from data in dbc.mst_room_hdrs where data.mrm_id == mrmid && data.mrm_code == "TE" select data).Count();
            //         if (count_te == 1)
            //         {
            //             var objpp = (from t1 in dbc.trn_patient_plans
            //                          where t1.tpr_id == Program.CurrentRegis.tpr_id
            //                          && t1.mvt_id == mvtid
            //                          orderby t1.tpr_id descending
            //                          select t1).ToList();
            //             if (objpp != null)
            //             {
            //                 foreach (var dr in objpp)
            //                 {
            //                     dr.tpl_status = 'C';
            //                     dbc.SubmitChanges();
            //                 }
            //             }
            //         }
            //         else
            //         {
            //             //หา mvtid ของ mrmid ชุดนั้นๆ ออกมา ก่อน แล้ว นำไปอัพเดต ที trn_patient_plans tpl_status = C
            //             var objmre = (from mre in dbc.mst_room_events where mre.mrm_id == mrmid select mre).ToList();
            //             if (objmre != null)
            //             {
            //                 foreach (var dr in objmre)
            //                 {
            //                     var objpp = (from t1 in dbc.trn_patient_plans
            //                                  where t1.tpr_id == Program.CurrentRegis.tpr_id
            //                                  && t1.mvt_id == dr.mvt_id
            //                                  orderby t1.tpr_id descending
            //                                  select t1).ToList();
            //                     if (objpp != null)
            //                     {
            //                         foreach (var dr2 in objpp)
            //                         {
            //                             dr2.tpl_status = 'C';
            //                             dbc.SubmitChanges();
            //                         }
            //                     }
            //                 }
            //         }

            //        }

            //code orginal comment by noina
            //trn_patient_plan objpp = (from t1 in dbc.trn_patient_plans
            //                          where t1.tpr_id == Program.CurrentRegis.tpr_id
            //                          && t1.mvt_id == mvtid
            //                          orderby t1.tpr_id descending
            //                          select t1).FirstOrDefault() ;

            //objpp.tpl_status = 'C';
            //end

            //        isupdate = true;
            //    }
            //}

            //noina comment
            //if (isupdate)
            //{//Updte trn_patient_queues Reason
            //    int mvtid = Program.Getmvt_id(dbc, "CB");
            //    DateTime dtnow = Program.GetServerDateTime();
            //    trn_patient_queue currentQueue=(from t1 in dbc.trn_patient_queues
            //                                    where t1.tpr_id==Program.CurrentPatient_queue.tpr_id
            //                                    && t1.mvt_id == mvtid
            //                                    select t1).FirstOrDefault();
            //    if (currentQueue != null)
            //    {
            //        currentQueue.tps_cancel_remark = strReason;
            //        currentQueue.tps_update_by = Program.CurrentUser.mut_username;
            //        currentQueue.tps_update_date = dtnow;
            //        int objcount = (from t1 in dbc.trn_patient_plans
            //                                  where t1.tpr_id == Program.CurrentRegis.tpr_id
            //                                  && t1.tpl_status=='N'
            //                                  orderby t1.tpr_id descending
            //                                  select t1).Count();
            //        if (objcount == 0)
            //        {
            //            currentQueue.tps_status = "CL";
            //            currentQueue.tps_ns_status = null;
            //            currentQueue.tps_start_date = null;
            //            currentQueue.tps_end_date = null;
            //            currentQueue.tps_cancel_date = dtnow;

            //            Program.CurrentPatient_queue = null;
            //            Program.CurrentRegis = null;
            //        }
            //            dbc.SubmitChanges();
            //    }
            //}
        }