コード例 #1
0
        private void LoadIQTools(bool refresh)
        {
            SetControlPropertyThreadSafe(cmdLogin, "Enabled", false);
            SetControlPropertyThreadSafe(picLoad, "Image", Properties.Resources.progress4);

            if (ForceUpgrade())
            {
                refresh = true;
                SetControlPropertyThreadSafe(lblLoad, "Text", "Updating IQTools DB, Please Wait...");

                Entity.ForceUpgrade();
            }

            SetControlPropertyThreadSafe(lblLoad, "Text", "Loading, Please Wait...");
            string connectionString = Entity.GetConnString();
            int    i  = 0;
            Entity en = new Entity();

            ClsUtility.Init_Hashtable();
            try
            {
                if (emrType == "iqcare")
                {
                    try
                    {
                        if (refresh)
                        {
                            Entity.DropIQToolsObjects(emrType, serverType);
                            Entity.CreateIQToolsObjects(emrType, serverType);
                            if (Entity.DecryptMstPatient())
                            {
                                ClsUtility.Init_Hashtable();
                                try
                                {
                                    try
                                    {
                                        i = (int)en.ReturnObject(connectionString, ClsUtility.theParams
                                                                 , "pr_RefreshIQTools"
                                                                 , ClsUtility.ObjectEnum.ExecuteNonQuery, "mssql");
                                    }
                                    catch (Exception ex) { MessageBox.Show(ex.Message); }
                                    ClsUtility.Init_Hashtable();
                                }
                                catch (Exception ex)
                                {
                                    //EH.LogError(ex.Message, "<<frmLoad:loadIQTools()>>", serverType);
                                    //clsGbl.IQDirection = "connect";
                                    MessageBox.Show(ex.Message);
                                }
                            }
                        }

                        Form tmp = new frmMain();
                        AccessContol();
                        Application.Run(tmp);
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.Message);
                        MessageBox.Show("There Was A Problem Accessing The EMR Database, Data May Not Have Been Loaded Into IQTools"
                                        , "IQTools Connection Error", MessageBoxButtons.OKCancel, MessageBoxIcon.Error);
                        SetControlPropertyThreadSafe(cmdLogin, "Enabled", true);
                        SetControlPropertyThreadSafe(picLoad, "Image", null);
                        SetControlPropertyThreadSafe(lblLoad, "Text", "");
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("IQTools Could Not Connect To The EMR Database, Please Configure IQTools. Error Message=" + ex.Message
                                , "IQTools Connection Error", MessageBoxButtons.OKCancel, MessageBoxIcon.Error);
                SetControlPropertyThreadSafe(cmdLogin, "Enabled", true);
                SetControlPropertyThreadSafe(picLoad, "Image", null);
                SetControlPropertyThreadSafe(lblLoad, "Text", "");
            }
        }
コード例 #2
0
ファイル: frmLogin.cs プロジェクト: moshonk/IQTools
        private void LoadIQTools(bool refresh)
        {
            SetControlPropertyThreadSafe(cmdLogin, "Enabled", false);
            SetControlPropertyThreadSafe(picLoad, "Image", Properties.Resources.progress4);
            SetControlPropertyThreadSafe(lblLoad, "Text", "Loading, Please Wait...");
            string connectionString = Entity.GetConnString();
            int    i  = 0;
            Entity en = new Entity();

            ClsUtility.Init_Hashtable();
            try
            {
                if (emrType == "iqcare")
                {
                    try
                    {
                        if (refresh)
                        {
                            //If IQTools Updated
                            //Entity.CreateIQToolsDB("microsoft sql server", serverUserName, server, serverPassword, iqtoolsDB, "iqcare")
                            //
                            Entity.DropIQToolsObjects(emrType, serverType);
                            Entity.CreateIQToolsObjects(emrType, serverType);
                            if (Entity.DecryptMstPatient())
                            {
                                ClsUtility.Init_Hashtable();
                                try
                                {
                                    DataRow fDr = null;
                                    {
                                        fDr = (DataRow)en.ReturnObject(connectionString, ClsUtility.theParams
                                                                       , "SELECT TOP 1 FacilityName FROM mst_Facility WHERE DeleteFlag = 0"
                                                                       , ClsUtility.ObjectEnum.DataRow, "mssql");
                                        ClsUtility.AddParameters("@FacilityName", SqlDbType.Text, fDr[0].ToString());
                                        ClsUtility.AddParameters("@EMR", SqlDbType.Text, "iqcare");
                                        ClsUtility.AddParameters("@EMRVersion", SqlDbType.Text, clsGbl.EmrVersion);
                                        ClsUtility.AddParameters("@VisitPK", SqlDbType.Int, 0);
                                        ClsUtility.AddParameters("@PatientPK", SqlDbType.Int, 0);
                                        ClsUtility.AddParameters("@RefreshFlag", SqlDbType.Int, 1);

                                        try
                                        {
                                            i = (int)en.ReturnObject(connectionString, ClsUtility.theParams
                                                                     , "pr_RefreshIQTools"
                                                                     , ClsUtility.ObjectEnum.ExecuteNonQuery, "mssql");
                                        }
                                        catch (Exception ex) { MessageBox.Show(ex.Message); }
                                        ClsUtility.Init_Hashtable();
                                    }
                                }
                                catch (Exception ex)
                                {
                                    //EH.LogError(ex.Message, "<<frmLoad:loadIQTools()>>", serverType);
                                    //clsGbl.IQDirection = "connect";
                                    MessageBox.Show(ex.Message);
                                }
                            }
                        }

                        Form tmp = new frmMain();
                        AccessContol();
                        Application.Run(tmp);
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.Message);
                        MessageBox.Show("There Was A Problem Accessing The EMR Database, Data May Not Have Been Loaded Into IQTools"
                                        , "IQTools Connection Error", MessageBoxButtons.OKCancel, MessageBoxIcon.Error);
                        SetControlPropertyThreadSafe(cmdLogin, "Enabled", true);
                        SetControlPropertyThreadSafe(picLoad, "Image", null);
                        SetControlPropertyThreadSafe(lblLoad, "Text", "");
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("IQTools Could Not Connect To The EMR Database, Please Configure IQTools. Error Message=" + ex.Message
                                , "IQTools Connection Error", MessageBoxButtons.OKCancel, MessageBoxIcon.Error);
                SetControlPropertyThreadSafe(cmdLogin, "Enabled", true);
                SetControlPropertyThreadSafe(picLoad, "Image", null);
                SetControlPropertyThreadSafe(lblLoad, "Text", "");
            }
        }