Exemple #1
0
        private void btn_Click(object sender, EventArgs e)
        {
            Button btnitem   = (Button)sender;
            string typeQueue = "";

            if ((btnitem.Tag.ToString() != "CD" ||
                 (btnitem.Tag.ToString() == "CD" && (Program.CurrentUser.mut_type != 'D' && Program.CurrentUser.mut_type != 'N'))) &&
                btnitem.Tag.ToString() != "CB" &&
                btnitem.Tag.ToString() != "CC" &&
                (btnitem.Tag.ToString() != "PF" ||
                 (btnitem.Tag.ToString() == "PF" && Program.CurrentUser.mut_type != 'D')) &&
                (btnitem.Tag.ToString() != "DC" ||
                 (btnitem.Tag.ToString() == "DC" && Program.CurrentUser.mut_type != 'N')) &&
                (btnitem.Tag.ToString() != "PT" ||
                 (btnitem.Tag.ToString() == "PT" && Program.CurrentUser.mut_type != 'N')))
            {
                frmLoginRoom frmlr = new frmLoginRoom();
                if (btnitem.Tag.ToString() == "DC")
                {
                    frmlr.SetVisiblePQueue();
                }
                frmlr.GetmrmCode = btnitem.Tag.ToString();
                if (frmlr.ShowDialog() != DialogResult.OK)
                {
                    return;
                }
                typeQueue = frmlr.GetTypeQueue;
            }

            Program.FooterIsclick = true;
            GC.Collect();//คำสั่ง Clear Memory ที่เคยเรียก data base มาใช้งาน
            timer1.Enabled = true;
            try
            {
                switch (btnitem.Tag.ToString())
                {
                case "RG":
                    frmshow = 1;
                    Program.CurrentFrmShow  = 1;
                    childForm_1             = new frmViewQueueList();
                    childForm_1.WindowState = FormWindowState.Maximized;
                    childForm_1.ShowDialog();
                    break;

                case "BM": frmshow         = 2;
                    Program.CurrentFrmShow = 2;
                    frmBM_2             = new frmBasicMeasurement();
                    frmBM_2.WindowState = FormWindowState.Maximized;
                    frmBM_2.ShowDialog();
                    break;

                case "SC":
                    frmshow = 3;
                    Program.CurrentFrmShow = 3;
                    frmsc_3             = new frmScreeningPage();
                    frmsc_3.WindowState = FormWindowState.Maximized;
                    frmsc_3.ShowDialog();
                    break;

                case "DC":
                    if (Program.CurrentUser != null && Program.CurrentUser.mut_type == 'D')
                    {    //typeQueue Radio On Queue ,Out Queue
                        if (typeQueue == "N")
                        {
                            //frmPE fPE = new frmPE();
                            frmshow = 4;
                            Program.CurrentFrmShow = 4;
                            var type = Type.GetType("BKvs2010.Forms.DoctorFrm");
                            var form = Activator.CreateInstance(type) as Forms.CheckupInheriteFrm;
                            form.FormStatus  = Forms.CheckupInheriteFrm.formStatus.isStation;
                            form.WindowState = FormWindowState.Maximized;
                            form.user        = Program.CurrentUser;
                            form.mrd_id      = Program.CurrentRoom.mrd_id;
                            form.lug_id      = Class.ClsManageUserLogin.current_log.lug_id;
                            form.kickedUser += new Forms.CheckupInheriteFrm.KickedUser(form_kickedUser);
                            form.ShowDialog();
                            //fPEbtn_4 = new frmPE();
                            //fPEbtn_4.WindowState = FormWindowState.Maximized;
                            //fPEbtn_4.ShowDialog();
                        }
                        else if (typeQueue == "O")
                        {
                            //frmPE_OutQueue fPE = new frmPE_OutQueue();
                            frmshow = 5;
                            Program.CurrentFrmShow = 5;
                            fPE_OutQ_5             = new frmPE_OutQueue();
                            fPE_OutQ_5.WindowState = FormWindowState.Maximized;
                            fPE_OutQ_5.ShowDialog();
                        }
                    }
                    //else if (Program.CurrentUser != null && Program.CurrentUser.mut_type == 'N')
                    //{
                    //    //frmPEChgDoc fPE = new frmPEChgDoc();
                    //    frmshow = 6;
                    //    Program.CurrentFrmShow = 6;
                    //    fPECD_6 = new frmPEChgDoc();
                    //    fPECD_6.ShowDialog();
                    //}
                    //else
                    //{
                    //    MessageBox.Show("ห้องนี้กำหนดสิทธิ์ เข้าได้เฉพาะหมอเท่านั้น", "Alert.", MessageBoxButtons.OK);
                    //}
                    break;

                case "CD":
                    if (Program.CurrentUser != null && Program.CurrentUser.mut_type == 'D')
                    {
                        //frmCarotidReport frmcd = new frmCarotidReport();
                        frmshow = 7;
                        Program.CurrentFrmShow    = 7;
                        frmcdReport_7             = new frmCarotidReport();
                        frmcdReport_7.WindowState = FormWindowState.Maximized;
                        frmcdReport_7.ShowDialog();
                    }
                    else if (Program.CurrentUser != null && Program.CurrentUser.mut_type == 'T')
                    {
                        //frmCarotid_2 frmcd = new frmCarotid_2();
                        frmshow = 8;
                        Program.CurrentFrmShow = 8;
                        frmcd_8             = new frmCarotid_2();
                        frmcd_8.WindowState = FormWindowState.Maximized;
                        frmcd_8.ShowDialog();
                    }
                    break;

                case "XR":
                    //frmChestXRay frmxr = new frmChestXRay();
                    frmshow = 9;
                    Program.CurrentFrmShow = 9;
                    //frmxr_9=new frmChestXRay();
                    //frmxr_9.WindowState = FormWindowState.Maximized;
                    //frmxr_9.ShowDialog();
                    {
                        var type = Type.GetType("BKvs2010.Forms.ChestXrayFrm");
                        var form = Activator.CreateInstance(type) as Forms.CheckupInheriteFrm;
                        form.FormStatus  = Forms.CheckupInheriteFrm.formStatus.isStation;
                        form.WindowState = FormWindowState.Maximized;
                        form.user        = Program.CurrentUser;
                        form.mrd_id      = Program.CurrentRoom.mrd_id;
                        form.lug_id      = Class.ClsManageUserLogin.current_log.lug_id;
                        form.kickedUser += new Forms.CheckupInheriteFrm.KickedUser(form_kickedUser);
                        form.ShowDialog();
                    }
                    break;

                case "US":
                    //frmUltrasound2 frmus = new frmUltrasound2();
                    frmshow = 10;
                    Program.CurrentFrmShow = 10;
                    //frmus_10=new frmUltrasound2();
                    //frmus_10.WindowState = FormWindowState.Maximized;
                    //frmus_10.ShowDialog();
                    {
                        var type = Type.GetType("BKvs2010.Forms.UltrasoundFrm");
                        var form = Activator.CreateInstance(type) as Forms.CheckupInheriteFrm;
                        form.FormStatus  = Forms.CheckupInheriteFrm.formStatus.isStation;
                        form.WindowState = FormWindowState.Maximized;
                        form.user        = Program.CurrentUser;
                        form.mrd_id      = Program.CurrentRoom.mrd_id;
                        form.lug_id      = Class.ClsManageUserLogin.current_log.lug_id;
                        form.kickedUser += new Forms.CheckupInheriteFrm.KickedUser(form_kickedUser);
                        form.ShowDialog();
                    }
                    break;

                case "DM":
                    //frmMammogramPage frmDM = new frmMammogramPage();
                    frmshow = 11;
                    Program.CurrentFrmShow = 11;
                    //frmDM_11=new frmMammogramPage();
                    ////frmDM_11.WindowState = FormWindowState.Maximized;
                    //frmDM_11.ShowDialog();
                    {
                        var type = Type.GetType("BKvs2010.Forms.MammogramFrm");
                        var form = Activator.CreateInstance(type) as Forms.CheckupInheriteFrm;
                        form.FormStatus  = Forms.CheckupInheriteFrm.formStatus.isStation;
                        form.WindowState = FormWindowState.Maximized;
                        form.user        = Program.CurrentUser;
                        form.mrd_id      = Program.CurrentRoom.mrd_id;
                        form.lug_id      = Class.ClsManageUserLogin.current_log.lug_id;
                        form.kickedUser += new Forms.CheckupInheriteFrm.KickedUser(form_kickedUser);
                        form.ShowDialog();
                    }
                    break;

                case "BD":
                    //frmBMD fBD = new frmBMD();
                    frmshow = 12;
                    Program.CurrentFrmShow = 12;
                    //fBD_12=new frmBMD();
                    //fBD_12.WindowState = FormWindowState.Maximized;
                    //fBD_12.ShowDialog();
                    {
                        var type = Type.GetType("BKvs2010.Forms.BMDFrm");
                        var form = Activator.CreateInstance(type) as Forms.CheckupInheriteFrm;
                        form.FormStatus  = Forms.CheckupInheriteFrm.formStatus.isStation;
                        form.WindowState = FormWindowState.Maximized;
                        form.user        = Program.CurrentUser;
                        form.mrd_id      = Program.CurrentRoom.mrd_id;
                        form.lug_id      = Class.ClsManageUserLogin.current_log.lug_id;
                        form.kickedUser += new Forms.CheckupInheriteFrm.KickedUser(form_kickedUser);
                        form.ShowDialog();
                    }
                    break;

                case "EM":
                    //frmEye1 feye = new frmEye1();
                    frmshow = 13;
                    Program.CurrentFrmShow = 13;
                    //feye_13=new frmEye1();
                    //feye_13.WindowState = FormWindowState.Maximized;
                    //feye_13.ShowDialog();
                    {
                        var type = Type.GetType("BKvs2010.Forms.EyesFrm");
                        var form = Activator.CreateInstance(type) as Forms.CheckupInheriteFrm;
                        form.FormStatus  = Forms.CheckupInheriteFrm.formStatus.isStation;
                        form.WindowState = FormWindowState.Maximized;
                        form.user        = Program.CurrentUser;
                        form.mrd_id      = Program.CurrentRoom.mrd_id;
                        if (Program.CurrentRoom.mrd_type == 'D')
                        {
                            using (InhCheckupDataContext cdc = new InhCheckupDataContext())
                            {
                                form.mvt_id = cdc.mst_events.Where(x => x.mvt_code == "EM").Select(x => x.mvt_id).FirstOrDefault();
                            }
                        }
                        else if (Program.CurrentRoom.mrd_type == 'N')
                        {
                            using (InhCheckupDataContext cdc = new InhCheckupDataContext())
                            {
                                form.mvt_id = cdc.mst_events.Where(x => x.mvt_code == "EN").Select(x => x.mvt_id).FirstOrDefault();
                            }
                        }
                        form.lug_id      = Class.ClsManageUserLogin.current_log.lug_id;
                        form.kickedUser += new Forms.CheckupInheriteFrm.KickedUser(form_kickedUser);
                        form.ShowDialog();
                    }
                    break;

                case "HS":
                    //frmHearing frmAUdE = new frmHearing();
                    frmshow = 14;
                    Program.CurrentFrmShow = 14;
                    //frmAUdE_14=new frmHearing();
                    //frmAUdE_14.WindowState = FormWindowState.Maximized;
                    //frmAUdE_14.ShowDialog();
                    {
                        var type = Type.GetType("BKvs2010.Forms.HearingFrm");
                        var form = Activator.CreateInstance(type) as Forms.CheckupInheriteFrm;
                        form.FormStatus  = Forms.CheckupInheriteFrm.formStatus.isStation;
                        form.WindowState = FormWindowState.Maximized;
                        form.user        = Program.CurrentUser;
                        form.mrd_id      = Program.CurrentRoom.mrd_id;
                        form.lug_id      = Class.ClsManageUserLogin.current_log.lug_id;
                        form.kickedUser += new Forms.CheckupInheriteFrm.KickedUser(form_kickedUser);
                        form.ShowDialog();
                    }
                    break;

                case "EK":
                    frmshow = 15;
                    Program.CurrentFrmShow = 15;
                    //frmekg_15=new frmEKG();
                    //frmekg_15.WindowState = FormWindowState.Maximized;
                    //frmekg_15.ShowDialog();
                    {
                        var type = Type.GetType("BKvs2010.Forms.EKGFrm");
                        var form = Activator.CreateInstance(type) as Forms.CheckupInheriteFrm;
                        form.FormStatus  = Forms.CheckupInheriteFrm.formStatus.isStation;
                        form.WindowState = FormWindowState.Maximized;
                        form.user        = Program.CurrentUser;
                        form.mrd_id      = Program.CurrentRoom.mrd_id;
                        form.lug_id      = Class.ClsManageUserLogin.current_log.lug_id;
                        form.kickedUser += new Forms.CheckupInheriteFrm.KickedUser(form_kickedUser);
                        form.ShowDialog();
                    }
                    break;

                case "AB":
                    //frmABI2 frmab = new frmABI2();
                    frmshow = 16;
                    Program.CurrentFrmShow = 16;
                    //frmab_16=new frmABI2();
                    //frmab_16.WindowState = FormWindowState.Maximized;
                    //frmab_16.ShowDialog();
                    {
                        var type = Type.GetType("BKvs2010.Forms.ABIFrm");
                        var form = Activator.CreateInstance(type) as Forms.CheckupInheriteFrm;
                        form.FormStatus  = Forms.CheckupInheriteFrm.formStatus.isStation;
                        form.WindowState = FormWindowState.Maximized;
                        form.user        = Program.CurrentUser;
                        form.mrd_id      = Program.CurrentRoom.mrd_id;
                        form.lug_id      = Class.ClsManageUserLogin.current_log.lug_id;
                        form.kickedUser += new Forms.CheckupInheriteFrm.KickedUser(form_kickedUser);
                        form.ShowDialog();
                    }
                    break;

                case "ES":
                    frmshow = 17;
                    Program.CurrentFrmShow = 17;
                    //frmest_17=new frmEST();
                    //frmest_17.WindowState = FormWindowState.Maximized;
                    //frmest_17.ShowDialog();
                    {
                        var type = Type.GetType("BKvs2010.Forms.ESTFrm");
                        var form = Activator.CreateInstance(type) as Forms.CheckupInheriteFrm;
                        form.FormStatus  = Forms.CheckupInheriteFrm.formStatus.isStation;
                        form.WindowState = FormWindowState.Maximized;
                        form.user        = Program.CurrentUser;
                        form.mrd_id      = Program.CurrentRoom.mrd_id;
                        form.lug_id      = Class.ClsManageUserLogin.current_log.lug_id;
                        form.kickedUser += new Forms.CheckupInheriteFrm.KickedUser(form_kickedUser);
                        form.ShowDialog();
                    }
                    break;

                case "PT":
                    //frmObstetrics frmpt = new frmObstetrics();//สูตินารีเวช
                    frmshow = 18;
                    Program.CurrentFrmShow = 18;
                    //frmpt_18 = new frmObstetrics();
                    //frmpt_18.WindowState = FormWindowState.Maximized;
                    //frmpt_18.ShowDialog();
                    if (Program.CurrentUser != null && Program.CurrentUser.mut_type == 'D')
                    {
                        var type = Type.GetType("BKvs2010.Forms.GYNFrm");
                        var form = Activator.CreateInstance(type) as Forms.CheckupInheriteFrm;
                        form.FormStatus  = Forms.CheckupInheriteFrm.formStatus.isStation;
                        form.WindowState = FormWindowState.Maximized;
                        form.user        = Program.CurrentUser;
                        form.mrd_id      = Program.CurrentRoom.mrd_id;
                        form.lug_id      = Class.ClsManageUserLogin.current_log.lug_id;
                        form.kickedUser += new Forms.CheckupInheriteFrm.KickedUser(form_kickedUser);
                        form.ShowDialog();
                    }
                    //else
                    //{
                    //    frmshow = 34;
                    //    Program.CurrentFrmShow = 34;
                    //    frmpt_34 = new frmObstetricsChgDoc();
                    //    //frmpt_18.WindowState = FormWindowState.Maximized;
                    //    frmpt_34.ShowDialog();
                    //    break;
                    //}
                    break;

                case "BP":
                    //frmBookResult frmPB = new frmBookResult();
                    frmshow = 27;
                    Program.CurrentFrmShow = 27;
                    frmBR_27             = new frmBookResult();
                    frmBR_27.WindowState = FormWindowState.Maximized;
                    frmBR_27.ShowDialog();
                    break;

                case "TE":
                    //frmTeeth frmth = new frmTeeth();
                    frmshow = 19;
                    Program.CurrentFrmShow = 19;
                    //frmth_19=new frmTeeth();
                    //frmth_19.WindowState = FormWindowState.Maximized;
                    //frmth_19.ShowDialog();
                    {
                        var type = Type.GetType("BKvs2010.Forms.DentalFrm");
                        var form = Activator.CreateInstance(type) as Forms.CheckupInheriteFrm;
                        form.FormStatus  = Forms.CheckupInheriteFrm.formStatus.isStation;
                        form.WindowState = FormWindowState.Maximized;
                        form.user        = Program.CurrentUser;
                        form.mrd_id      = Program.CurrentRoom.mrd_id;
                        form.lug_id      = Class.ClsManageUserLogin.current_log.lug_id;
                        form.kickedUser += new Forms.CheckupInheriteFrm.KickedUser(form_kickedUser);
                        form.ShowDialog();
                    }
                    break;

                case "UG":
                    frmshow = 20;
                    Program.CurrentFrmShow = 20;
                    //frmUG_20=new frmUgiXRay();
                    ////frmUG_20.WindowState = FormWindowState.Maximized;
                    //frmUG_20.ShowDialog();
                    {
                        var type = Type.GetType("BKvs2010.Forms.UGIFrm");
                        var form = Activator.CreateInstance(type) as Forms.CheckupInheriteFrm;
                        form.FormStatus  = Forms.CheckupInheriteFrm.formStatus.isStation;
                        form.WindowState = FormWindowState.Maximized;
                        form.user        = Program.CurrentUser;
                        form.mrd_id      = Program.CurrentRoom.mrd_id;
                        form.lug_id      = Class.ClsManageUserLogin.current_log.lug_id;
                        form.kickedUser += new Forms.CheckupInheriteFrm.KickedUser(form_kickedUser);
                        form.ShowDialog();
                    }
                    break;

                case "PH":
                    //frmPHM frmph = new frmPHM();
                    frmshow = 21;
                    Program.CurrentFrmShow = 21;
                    frmph_21             = new frmPHM();
                    frmph_21.WindowState = FormWindowState.Maximized;
                    frmph_21.ShowDialog();
                    break;

                case "BK":
                    //frmshow = 22;
                    //Program.CurrentFrmShow = 22;
                    //frmBK_22=new frmQuestionnaireAviation2();
                    //frmBK_22.WindowState = FormWindowState.Maximized;
                    //frmBK_22.ShowDialog();
                    break;

                case "PF":
                    if (Program.CurrentUser != null && Program.CurrentUser.mut_type == 'D')
                    {
                        //frmPFT_Result frmpf = new frmPFT_Result();
                        frmshow = 23;
                        Program.CurrentFrmShow = 23;
                        frmpfR_23             = new frmPFT_Result();
                        frmpfR_23.WindowState = FormWindowState.Maximized;
                        frmpfR_23.ShowDialog();
                    }
                    else
                    {
                        //frmPFT frmpf = new frmPFT();
                        frmshow = 24;
                        Program.CurrentFrmShow = 24;
                        //frmpft_24 = new frmPFT();
                        //frmpft_24.WindowState = FormWindowState.Maximized;
                        //frmpft_24.ShowDialog();
                        {
                            var type = Type.GetType("BKvs2010.Forms.PFTFrm");
                            var form = Activator.CreateInstance(type) as Forms.CheckupInheriteFrm;
                            form.FormStatus  = Forms.CheckupInheriteFrm.formStatus.isStation;
                            form.WindowState = FormWindowState.Maximized;
                            form.user        = Program.CurrentUser;
                            form.mrd_id      = Program.CurrentRoom.mrd_id;
                            form.lug_id      = Class.ClsManageUserLogin.current_log.lug_id;
                            form.kickedUser += new Forms.CheckupInheriteFrm.KickedUser(form_kickedUser);
                            form.ShowDialog();
                        }
                    }
                    break;

                case "CC":
                case "CB":
                    string mrmcode    = btnitem.Tag.ToString();
                    string strLogtype = Program.CurrentUser.mut_type.ToString();
                    using (InhCheckupDataContext dbc = new InhCheckupDataContext())
                    {
                        #region SelectRoom New version [Akkaradech on 2014-01-13]
                        //var countRoomLogin = (from t1 in dbc.log_user_logins
                        //                      where t1.mhs_id == Program.CurrentSite.mhs_id
                        //                      && t1.mut_id == Program.CurrentUser.mut_id
                        //                      && t1.lug_end_date == null
                        //                      select t1.mrd_id).ToList();
                        int getmrmid = (from t1 in dbc.mst_room_hdrs
                                        where t1.mrm_code == mrmcode &&
                                        t1.mhs_id == Program.CurrentSite.mhs_id
                                        select t1.mrm_id).FirstOrDefault();

                        int countRoomLogin = (from t1 in dbc.log_user_logins
                                              join t2 in dbc.mst_room_dtls
                                              on t1.mrd_id equals t2.mrd_id
                                              where t1.mhs_id == Program.CurrentSite.mhs_id &&
                                              t2.mrm_id == getmrmid &&
                                              t1.lug_end_date == null
                                              select t1.mrd_id).Count();

                        var objroom = (from t1 in dbc.mst_room_dtls
                                       where t1.mst_room_hdr.mrm_code == mrmcode &&
                                       t1.mst_room_hdr.mhs_id == Program.CurrentSite.mhs_id
                                       //&& t1.mrd_id == mrdid
                                       //&& t1.mrd_dummy_room == 'Y'
                                       select t1).FirstOrDefault();
                        Program.IsDummy     = true;
                        Program.CurrentRoom = objroom;

                        if (strLogtype == "D")
                        {
                            int countdoctor = (from t in dbc.mst_room_hdrs
                                               where t.mrm_id == getmrmid &&
                                               t.mhs_id == Program.CurrentSite.mhs_id
                                               select t.mrm_count_doctor.Value).FirstOrDefault();

                            if (countRoomLogin < countdoctor)
                            {
                                if (mrmcode == "CB")
                                {
                                    //if (Program.CurrentSite.mhs_code == "01JMSCK" || Program.CurrentSite.mhs_code == "01JMS" || Program.CurrentSite.mhs_code == "01IMS" || Program.CurrentSite.mhs_code == "01AMS" || Program.CurrentSite.mhs_code == "01BLC")
                                    //{
                                    //    MessageBox.Show("ไม่สามารถเข้าใช้งานได้", "Alert Message", MessageBoxButtons.OK, MessageBoxIcon.Information);
                                    //    return;
                                    //}
                                    //else
                                    //{
                                    frmshow = 25;
                                    Program.CurrentFrmShow = 25;
                                    frmcB_25             = new frmCheckpointB2();
                                    frmcB_25.WindowState = FormWindowState.Maximized;
                                    frmcB_25.ShowDialog();
                                    //}
                                }
                                if (mrmcode == "CC")
                                {
                                    frmshow = 26;
                                    Program.CurrentFrmShow = 26;
                                    frmCC_26             = new frmCheckPointC();
                                    frmCC_26.WindowState = FormWindowState.Maximized;
                                    frmCC_26.ShowDialog();
                                }
                            }
                            else
                            {
                                MessageBox.Show("ไม่สามารถเข้าใช้งานได้", "Alert Message", MessageBoxButtons.OK, MessageBoxIcon.Information);
                                return;
                            }
                        }
                        else
                        {
                            int countperson = (from t in dbc.mst_room_hdrs
                                               where t.mrm_id == getmrmid &&
                                               t.mhs_id == Program.CurrentSite.mhs_id
                                               select t.mrm_count_person.Value).FirstOrDefault();
                            if (countRoomLogin < countperson)
                            {
                                if (mrmcode == "CB")
                                {
                                    frmshow = 25;
                                    Program.CurrentFrmShow = 25;
                                    frmcB_25             = new frmCheckpointB2();
                                    frmcB_25.WindowState = FormWindowState.Maximized;
                                    frmcB_25.ShowDialog();
                                }
                                if (mrmcode == "CC")
                                {
                                    frmshow = 26;
                                    Program.CurrentFrmShow = 25;
                                    frmCC_26 = new frmCheckPointC();
                                    //frmCC_26.WindowState = FormWindowState.Maximized;
                                    frmCC_26.ShowDialog();
                                }
                            }
                            else
                            {
                                MessageBox.Show("ไม่สามารถเข้าใช้งานได้", "Alert Message", MessageBoxButtons.OK, MessageBoxIcon.Information);
                                return;
                            }
                        }
                        #endregion

                        #region CommentedCode Old version [Akkaradech on 2014-01-13]
                        //var objroomlist = (from t1 in dbc.mst_room_dtls
                        //                   where t1.mst_room_hdr.mst_user_rooms.Where(x => x.mut_username == Program.CurrentUser.mut_username
                        //                        && x.mst_room_hdr.mrm_code == mrmcode).Count() > 0
                        //                        && t1.mst_room_hdr.mhs_id == Program.CurrentSite.mhs_id
                        //                        && (t1.mrd_rm_status == 'E' || (t1.mrd_rm_status != 'E' && countRoomLogin.Contains(t1.mrd_id)))
                        //                   orderby t1.mrd_dummy_room, t1.mrd_id
                        //                   select new Roomselect { EName = t1.mrd_ename, ID = t1.mrd_id }).ToList();

                        //var dumyroom = (from t1 in dbc.mst_room_dtls
                        //                where t1.mst_room_hdr.mrm_code == mrmcode
                        //                && t1.mrd_dummy_room == 'Y'
                        //                select t1);
                        //if (dumyroom.Count() > 0 && objroomlist.Where(x => x.ID == dumyroom.FirstOrDefault().mrd_id).Count() == 0)
                        //{
                        //    mst_room_dtl dmroom = dumyroom.FirstOrDefault();
                        //    Roomselect newroom = new Roomselect();
                        //    newroom.EName = dmroom.mrd_ename;
                        //    newroom.ID = dmroom.mrd_id;
                        //    objroomlist.Add(newroom);
                        //}
                        //Program.IsDummy = false;
                        //if (objroomlist.Count() == 0)
                        //{//กรณีไม่ได้กำหนดสิทธิ์เข้าใช้ห้องCheck Point B
                        //    MessageBox.Show("ไม่สามารถเข้าใช้งานได้", "Alert Message", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        //    return;
                        //}
                        //int mrdid = objroomlist.FirstOrDefault().ID;
                        //var objroom = (from t1 in dbc.mst_room_dtls
                        //               where t1.mst_room_hdr.mrm_code == mrmcode
                        //               //&& t1.mrd_id == mrdid
                        //               //&& t1.mrd_dummy_room == 'Y'
                        //               select t1).FirstOrDefault();
                        //Program.IsDummy = true;
                        //Program.CurrentRoom = objroom;

                        //if (objroomlist.Count() > 0 && objroom == null)
                        //{
                        //    if (Program.Login(Program.CurrentUser.mut_username, Program.CurrentSite.mhs_id, mrdid))
                        //    {
                        //    }
                        //    else
                        //    {
                        //        return;
                        //    }
                        //}
                        //else if (objroom != null)
                        //{//Dummy Room
                        //    Program.IsDummy = true;
                        //    Program.CurrentRoom = objroom;
                        //}

                        //if (mrmcode == "CB")
                        //{
                        //    //frmCheckpointB2 frmcB = new frmCheckpointB2();
                        //    frmshow = 25; frmcB_25 = new frmCheckpointB2();
                        //    frmcB_25.WindowState = FormWindowState.Maximized;
                        //    frmcB_25.ShowDialog();
                        //}
                        //if (mrmcode == "CC")
                        //{
                        //    //frmCheckPointC frmCC = new frmCheckPointC();
                        //    frmshow = 26; frmCC_26 = new frmCheckPointC();
                        //    frmCC_26.WindowState = FormWindowState.Maximized;
                        //    frmCC_26.ShowDialog();
                        //}
                        #endregion
                    }
                    break;
                }
                frmshow        = 0;
                timer1.Enabled = false;
                Program.ExitRoom();
            }//end try
            catch (Exception ex)
            {
                Program.MessageError(ex.Source, "Page " + btnitem.Tag.ToString(), ex.Message);
            }
            //frmshow = 0;
            //timer1.Enabled = false;
            //Program.ExitRoom();
        }
Exemple #2
0
        private void showfrm(string pagecode, int tprID, int mhs_id)
        {
            Program.FooterIsclick = false;

            InhCheckupDataContext dbc        = new InhCheckupDataContext();
            mst_room_dtl          currentmrd = new mst_room_dtl();
            var currentRoomdtl = (from t1 in dbc.mst_room_dtls
                                  where t1.mst_room_hdr.mrm_code == pagecode
                                  select t1).FirstOrDefault();

            if (currentRoomdtl != null)
            {
                currentmrd = Program.CurrentRoom;
                //Program.CurrentRoom = null;
                Program.CurrentRoom = currentRoomdtl;
            }
            switch (pagecode)
            {
            case "RG":
                frmScreeningPage frmRG = new frmScreeningPage();
                frmRG.SetTprID    = tprID;
                frmRG.siteitem    = mhs_id;
                frmRG.WindowState = FormWindowState.Maximized;
                frmRG.ShowDialog();
                break;

            case "BM": frmBasicMeasurement frmBM = new frmBasicMeasurement();
                frmBM.SetTprID = tprID;
                frmBM.siteitem = mhs_id;
                frmBM.ShowDialog();
                break;

            case "AB":
                openForm("BKvs2010.Forms.ABIFrm", tprID);
                break;

            case "HS":
                openForm("BKvs2010.Forms.HearingFrm", tprID);
                break;

            case "EN":
            case "EM":
                openForm("BKvs2010.Forms.EyesFrm", tprID);
                break;

            case "SC": frmScreeningPage frmSC = new frmScreeningPage();
                frmSC.SetTprID = tprID; frmSC.siteitem = mhs_id;
                frmSC.ShowDialog();
                break;

            case "PT":
                frmObstetrics frmPT = new frmObstetrics();
                frmPT.SetTprID    = tprID; frmPT.siteitem = mhs_id;
                frmPT.WindowState = FormWindowState.Maximized;
                frmPT.ShowDialog();
                break;

            case "ES":
                openForm("BKvs2010.Forms.ESTFrm", tprID);
                break;

            case "EK":
                openForm("BKvs2010.Forms.EKGFrm", tprID);
                break;

            case "CD":
                frmCarotid_2 frmCD = new frmCarotid_2();
                frmCD.SetTprID = tprID;
                frmCD.siteitem = mhs_id;
                frmCD.ShowDialog(); break;

            case "TE":
                openForm("BKvs2010.Forms.DentalFrm", tprID);
                break;

            case "DM":
                openForm("BKvs2010.Forms.MammogramFrm", tprID);
                break;

            case "DC":
                frmPE_OutQueue frmPEOut = new frmPE_OutQueue();
                frmPEOut.SetTprID    = tprID;
                frmPEOut.WindowState = FormWindowState.Maximized;
                frmPEOut.ShowDialog();
                break;

            case "CC": frmCheckPointC frmCC = new frmCheckPointC(); frmCC.ShowDialog(); break;

            case "XR":
                openForm("BKvs2010.Forms.ChestXrayFrm", tprID);
                break;

            case "UG":
                openForm("BKvs2010.Forms.UGIFrm", tprID);
                break;

            case "PF":
                openForm("BKvs2010.Forms.PFTFrm", tprID);
                break;

            case "OB":
                frmObstetrics frmobg = new frmObstetrics();
                frmobg.SetTprID = tprID;
                frmobg.siteitem = mhs_id;
                frmobg.ShowDialog(); break;

            case "BD":
                openForm("BKvs2010.Forms.BMDFrm", tprID);
                break;

            case "PH":
                frmPHM frmPH = new frmPHM();
                frmPH.SetTprID = tprID;
                frmPH.siteitem = mhs_id;
                frmPH.ShowDialog();
                break;

            case "CB": frmCheckpointB2 frmCB = new frmCheckpointB2(); frmCB.ShowDialog(); break;

            case "US":
                openForm("BKvs2010.Forms.UltrasoundFrm", tprID);
                break;

            case "BK":
                break;
            }

            Program.CurrentRoom   = currentmrd;
            Program.FooterIsclick = true;
            GC.Collect();
        }
Exemple #3
0
        //private void showfrm(string pagecode, int tprID, int mhs_id)
        //{
        //    Program.FooterIsclick = false;

        //    InhCheckupDataContext dbc = new InhCheckupDataContext();
        //    mst_room_dtl currentmrd = new mst_room_dtl();
        //    var currentRoomdtl = (from t1 in dbc.mst_room_dtls
        //                          where t1.mst_room_hdr.mrm_code == pagecode
        //                          select t1).FirstOrDefault();
        //    if (currentRoomdtl != null)
        //    {
        //        currentmrd = Program.CurrentRoom;
        //        //Program.CurrentRoom = null;
        //        Program.CurrentRoom = currentRoomdtl;
        //    }
        //    switch (pagecode)
        //    {
        //        case "RG": frmScreeningPage frmRG = new frmScreeningPage();
        //            frmRG.SetTprID = tprID;
        //            frmRG.siteitem = mhs_id;
        //            frmRG.WindowState = FormWindowState.Maximized;
        //            frmRG.ShowDialog();
        //            break;
        //        case "BM": frmBasicMeasurement frmBM = new frmBasicMeasurement();
        //            frmBM.SetTprID = tprID;
        //            frmBM.siteitem = mhs_id;
        //            frmBM.ShowDialog();
        //            break;
        //        case "AB":
        //            //frmABI2 frmAB = new frmABI2();
        //            //frmAB.SetTprID = tprID;
        //            //frmAB.siteitem = mhs_id;
        //            //frmAB.ShowDialog();
        //            openForm("BKvs2010.Forms.ABIFrm", tprID);
        //            break;
        //        case "HS":
        //            //frmHearing frmHS = new frmHearing();
        //            //frmHS.SetTprID = tprID;
        //            //frmHS.siteitem = mhs_id;
        //            //frmHS.ShowDialog();
        //            openForm("BKvs2010.Forms.HearingFrm", tprID);
        //            break;
        //        case "EN":
        //        case "EM":
        //            //frmEye1 frmEM = new frmEye1();
        //            //frmEM.SetTprID = tprID;
        //            //frmEM.siteitem = mhs_id;
        //            //frmEM.ShowDialog();
        //            openForm("BKvs2010.Forms.EyesFrm", tprID);
        //            break;
        //        case "SC": frmScreeningPage frmSC = new frmScreeningPage();
        //            frmSC.SetTprID = tprID; frmSC.siteitem = mhs_id;
        //            frmSC.ShowDialog();
        //            break;
        //        case "PT": frmObstetrics frmPT = new frmObstetrics();
        //            frmPT.SetTprID = tprID; frmPT.siteitem = mhs_id;
        //            frmPT.WindowState = FormWindowState.Maximized;
        //            frmPT.ShowDialog();
        //            break;
        //        case "ES": frmEST frmES = new frmEST();
        //            frmES.SetTprID = tprID; frmES.siteitem = mhs_id;
        //            frmES.WindowState = FormWindowState.Maximized;
        //            frmES.ShowDialog();
        //            break;
        //        case "EK": frmEKG frmEK = new frmEKG();
        //            frmEK.SetTprID = tprID; frmEK.siteitem = mhs_id;
        //            frmEK.ShowDialog();
        //            break;
        //        case "CD": frmCarotid_2 frmCD = new frmCarotid_2();
        //            frmCD.SetTprID = tprID;
        //            frmCD.siteitem = mhs_id;
        //            frmCD.ShowDialog(); break;
        //        case "TE": frmTeeth frmTE = new frmTeeth();
        //            //frmTE.SetTprID = tprID; frmTE.siteitem = mhs_id;
        //            //frmTE.ShowDialog();
        //            openForm("BKvs2010.Forms.DentalFrm", tprID);
        //            break;
        //        case "DM": frmMammogramPage frmDM = new frmMammogramPage();
        //            frmDM.SetTprID = tprID; frmDM.siteitem = mhs_id;
        //            frmDM.WindowState = FormWindowState.Maximized;
        //            frmDM.ShowDialog();
        //            break;
        //        case "DC":
        //            //break;
        //            if (!_isEditEMR)
        //            {
        //                //frmPE frmPE = new frmPE();
        //                //frmPE.SetTprID = tprID;frmPE.siteitem = mhs_id;
        //                //frmPE.WindowState = FormWindowState.Maximized;
        //                //frmPE.ShowDialog();
        //                //break;
        //            }
        //            else
        //            {
        //                frmPE_OutQueue frmPEOut = new frmPE_OutQueue();
        //                frmPEOut.SetTprID = tprID;
        //                frmPEOut.WindowState = FormWindowState.Maximized;
        //                frmPEOut.ShowDialog();
        //            }
        //            break;
        //        case "CC": /*frmCheckPointC frmCC = new frmCheckPointC(); frmCC.ShowDialog();*/ break;
        //        case "XR": frmChestXRay frmXR = new frmChestXRay();
        //            frmXR.SetTprID = tprID; frmXR.siteitem = mhs_id;
        //            frmXR.WindowState = FormWindowState.Maximized;
        //            frmXR.ShowDialog();
        //            break;
        //        case "UG": frmUgiXRay frmUGI = new frmUgiXRay();
        //            frmUGI.SetTprID = tprID;
        //            frmUGI.siteitem = mhs_id;
        //            frmUGI.WindowState = FormWindowState.Maximized;
        //            frmUGI.ShowDialog();
        //            break;
        //        case "PF": frmPFT frmPFT = new frmPFT();
        //            frmPFT.SetTprID = tprID;
        //            frmPFT.siteitem = mhs_id;
        //            frmPFT.WindowState = FormWindowState.Maximized;
        //            frmPFT.ShowDialog();
        //            break;
        //        case "OB":
        //            frmObstetrics frmobg = new frmObstetrics();
        //            frmobg.SetTprID = tprID;
        //            frmobg.siteitem = mhs_id;
        //            frmobg.ShowDialog(); break;
        //        case "BD": frmBMD frmbd = new frmBMD();
        //            frmbd.SetTprID = tprID;
        //            frmbd.siteitem = mhs_id;
        //            frmbd.ShowDialog(); break;
        //        case "PH": frmPHM frmPH = new frmPHM();
        //            frmPH.SetTprID = tprID;
        //            frmPH.siteitem = mhs_id;
        //            frmPH.ShowDialog(); break;
        //        case "CB": /*frmCheckpointB2 frmCB = new frmCheckpointB2(); frmCB.ShowDialog();*/ break;
        //        case "US": frmUltrasound2 frmus = new frmUltrasound2();
        //            frmus.SetTprID = tprID;
        //            frmus.siteitem = mhs_id;
        //            frmus.ShowDialog(); break;
        //        case "BK": break;
        //    }

        //    Program.CurrentRoom = currentmrd;
        //    Program.FooterIsclick = true;
        //    GC.Collect();
        //}
        private void showfrm(string pagecode, int tprID, int mhs_id)
        {
            Program.FooterIsclick = false;

            InhCheckupDataContext dbc        = new InhCheckupDataContext();
            mst_room_dtl          currentmrd = new mst_room_dtl();
            var currentRoomdtl = (from t1 in dbc.mst_room_dtls
                                  where t1.mst_room_hdr.mrm_code == pagecode
                                  select t1).FirstOrDefault();
            var patientDetail = dbc.trn_patient_regis
                                .Where(x => x.tpr_id == tprID)
                                .Select(x => new
            {
                x.trn_patient.tpt_hn_no,
                x.trn_patient.tpt_othername
            }).FirstOrDefault();

            if (currentRoomdtl != null)
            {
                currentmrd = Program.CurrentRoom;
                //Program.CurrentRoom = null;
                Program.CurrentRoom = currentRoomdtl;
            }
            switch (pagecode)
            {
            case "RG": frmScreeningPage frmRG = new frmScreeningPage();
                frmRG.SetTprID    = tprID;
                frmRG.siteitem    = mhs_id;
                frmRG.WindowState = FormWindowState.Maximized;
                frmRG.ShowDialog();
                break;

            case "BM": frmBasicMeasurement frmBM = new frmBasicMeasurement();
                frmBM.SetTprID = tprID;
                frmBM.siteitem = mhs_id;
                frmBM.ShowDialog();
                break;

            case "AB":
                //openForm("BKvs2010.Forms.ABIFrm", tprID);
                using (DialogABI abi = new DialogABI())
                {
                    abi.Text   = abi.Text + " HN : " + patientDetail.tpt_hn_no + " Name : " + patientDetail.tpt_othername;
                    abi.tpr_id = tprID;
                    abi.ShowDialog();
                }
                break;

            case "HS":
                //openForm("BKvs2010.Forms.HearingFrm", tprID);
                using (DialogAudio audio = new DialogAudio())
                {
                    audio.Text   = audio.Text + " HN : " + patientDetail.tpt_hn_no + " Name : " + patientDetail.tpt_othername;
                    audio.tpr_id = tprID;
                    audio.ShowDialog();
                }
                break;

            case "EN":
            case "EM":
                //openForm("BKvs2010.Forms.EyesFrm", tprID);
                using (DialogEyes eyes = new DialogEyes())
                {
                    eyes.Text   = eyes.Text + " HN : " + patientDetail.tpt_hn_no + " Name : " + patientDetail.tpt_othername;
                    eyes.tpr_id = tprID;
                    eyes.ShowDialog();
                }
                break;

            case "SC": frmScreeningPage frmSC = new frmScreeningPage();
                frmSC.SetTprID = tprID; frmSC.siteitem = mhs_id;
                frmSC.ShowDialog();
                break;

            case "PT":
                //frmObstetrics frmPT = new frmObstetrics();
                //frmPT.SetTprID = tprID; frmPT.siteitem = mhs_id;
                //frmPT.WindowState = FormWindowState.Maximized;
                //frmPT.ShowDialog();
                //openForm("BKvs2010.Forms.GYNFrm", tprID);
                using (DialogPAP pap = new DialogPAP())
                {
                    pap.Text   = pap.Text + " HN : " + patientDetail.tpt_hn_no + " Name : " + patientDetail.tpt_othername;
                    pap.tpr_id = tprID;
                    pap.ShowDialog();
                }
                break;

            case "ES":
                //frmEST frmES = new frmEST();
                //frmES.SetTprID = tprID; frmES.siteitem = mhs_id;
                //frmES.WindowState = FormWindowState.Maximized;
                //frmES.ShowDialog();
                //openForm("BKvs2010.Forms.ESTFrm", tprID);
                break;

            case "EK":
                //frmEKG frmEK = new frmEKG();
                //frmEK.SetTprID = tprID; frmEK.siteitem = mhs_id;
                //frmEK.ShowDialog();'
                //openForm("BKvs2010.Forms.EKGFrm", tprID);
                break;

            case "CD":
                //frmCarotid_2 frmCD = new frmCarotid_2();
                //frmCD.SetTprID = tprID;
                //frmCD.siteitem = mhs_id;
                //frmCD.ShowDialog();
                using (DialogCarotid carotid = new DialogCarotid())
                {
                    carotid.Text   = carotid.Text + " HN : " + patientDetail.tpt_hn_no + " Name : " + patientDetail.tpt_othername;
                    carotid.tpr_id = tprID;
                    carotid.ShowDialog();
                }
                break;

            case "TE":
                //openForm("BKvs2010.Forms.DentalFrm", tprID);
                using (DialogDental dental = new DialogDental())
                {
                    dental.Text   = dental.Text + " HN : " + patientDetail.tpt_hn_no + " Name : " + patientDetail.tpt_othername;
                    dental.tpr_id = tprID;
                    dental.ShowDialog();
                }
                break;

            case "DM":
                //frmMammogramPage frmDM = new frmMammogramPage();
                //frmDM.SetTprID = tprID; frmDM.siteitem = mhs_id;
                //frmDM.WindowState = FormWindowState.Maximized;
                //frmDM.ShowDialog();
                //openForm("BKvs2010.Forms.MammogramFrm", tprID);
                break;

            case "DC":
                ////break;
                //if (!_isEditEMR)
                //{
                //    //frmPE frmPE = new frmPE();
                //    //frmPE.SetTprID = tprID;frmPE.siteitem = mhs_id;
                //    //frmPE.WindowState = FormWindowState.Maximized;
                //    //frmPE.ShowDialog();
                //    //break;
                //}
                //else
                //{
                //    frmPE_OutQueue frmPEOut = new frmPE_OutQueue();
                //    frmPEOut.SetTprID = tprID;
                //    frmPEOut.WindowState = FormWindowState.Maximized;
                //    frmPEOut.ShowDialog();
                //}
                break;

            case "XR":
                //openForm("BKvs2010.Forms.ChestXrayFrm", tprID);
                //frmChestXRay frmXR = new frmChestXRay();
                //frmXR.SetTprID = tprID; frmXR.siteitem = mhs_id;
                //frmXR.WindowState = FormWindowState.Maximized;
                //frmXR.ShowDialog();
                break;

            case "UG":
                //openForm("BKvs2010.Forms.UGIFrm", tprID);
                //frmUgiXRay frmUGI = new frmUgiXRay();
                //frmUGI.SetTprID = tprID;
                //frmUGI.siteitem = mhs_id;
                //frmUGI.WindowState = FormWindowState.Maximized;
                //frmUGI.ShowDialog();
                break;

            case "PF":
                //openForm("BKvs2010.Forms.PFTFrm", tprID);
                //frmPFT frmPFT = new frmPFT();
                //frmPFT.SetTprID = tprID;
                //frmPFT.siteitem = mhs_id;
                //frmPFT.WindowState = FormWindowState.Maximized;
                //frmPFT.ShowDialog();
                using (DialogPFT pft = new DialogPFT())
                {
                    pft.Text   = pft.Text + " HN : " + patientDetail.tpt_hn_no + " Name : " + patientDetail.tpt_othername;
                    pft.tpr_id = tprID;
                    pft.ShowDialog();
                }
                break;

            case "OB":
                //frmObstetrics frmobg = new frmObstetrics();
                //frmobg.SetTprID = tprID;
                //frmobg.siteitem = mhs_id;
                //frmobg.ShowDialog();
                using (DialogPAP pap = new DialogPAP())
                {
                    pap.Text   = pap.Text + " HN : " + patientDetail.tpt_hn_no + " Name : " + patientDetail.tpt_othername;
                    pap.tpr_id = tprID;
                    pap.ShowDialog();
                }
                break;

            case "BD":
                //openForm("BKvs2010.Forms.BMDFrm", tprID);
                //frmBMD frmbd = new frmBMD();
                //frmbd.SetTprID = tprID;
                //frmbd.siteitem = mhs_id;
                //frmbd.ShowDialog();
                break;

            case "PH":
            //frmPHM frmPH = new frmPHM();
            //frmPH.SetTprID = tprID;
            //frmPH.siteitem = mhs_id;
            //frmPH.ShowDialog();
            //break;
            case "US":
                //openForm("BKvs2010.Forms.UltrasoundFrm", tprID);
                //frmUltrasound2 frmus = new frmUltrasound2();
                //frmus.SetTprID = tprID;
                //frmus.siteitem = mhs_id;
                //frmus.ShowDialog();
                break;

            case "BK":
            case "CB":
            case "CC":
                break;
            }

            Program.CurrentRoom   = currentmrd;
            Program.FooterIsclick = true;
            GC.Collect();
        }