Exemple #1
0
        public void StartApplication()
        {
            App.ConfigurationManager = new BeSmartMRP.Business.Agents.ConfigurationAgent();
#if !xd_RUNMODE_DEBUG
            Application.ThreadException += new System.Threading.ThreadExceptionEventHandler(Application_ThreadException);
#endif

#if !xd_RUNMODE_DEBUG
            Application.ApplicationExit += new EventHandler(Application_ApplicationExit);
#endif

            this.pmLoadConfig();

            WS.Data.Agents.cDBMSAgent pobjSQLUtil = new WS.Data.Agents.cDBMSAgent(App.ConnectionString, App.DatabaseReside);

            App.PermissionManager           = new BeSmartMRP.Business.Agents.SecurityAgent();
            App.PermissionManager.SQLHelper = pobjSQLUtil;
            //App.PermissionManager = new BeSmartMRP.Business.Agents.SecurityAgent(App.ConnectionString, App.DatabaseReside);
            //App.PermissionManager.ModuleID = App.AppID;
            //App.PermissionManager.ConnectionString2 = App.xd_Access_ConnectionString;

#if xd_VERSION_DEMO
            if (XD_EXPIREDATE.CompareTo(DateTime.Now) < 0)
            {
                MessageBox.Show("Database is Access Deny", "Error Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
                Application.Exit();
            }
            else
            {
                using (BeSmartMRP.DialogForms.frmLogin dlg = new BeSmartMRP.DialogForms.frmLogin())
                {
                    if (dlg.ShowDialog() == DialogResult.OK)
                    {
                        Application.Run(App.ofrmMainMenu);
                        //Application.Run(new Form1());
                    }
                    else
                    {
                        Application.Exit();
                    }
                }
            }
#else
            using (BeSmartMRP.DialogForms.frmLogin dlg = new BeSmartMRP.DialogForms.frmLogin())
            {
                if (dlg.ShowDialog() == DialogResult.OK)
                {
                    Application.Run(App.ofrmMainMenu);
                }
                else
                {
                    Application.Exit();
                }
            }
#endif
        }
 private void pmGetLogin()
 {
     using (DialogForms.frmLogin dlg = new DialogForms.frmLogin())
     {
         if (dlg.ShowDialog() == DialogResult.OK)
         {
             //App.ofrmMainMenu.statusStrip1.Items[2].Text = "LOGIN : " + App.AppUserName.TrimEnd();
             this.pmGetCorp();
         }
         else
         {
             Application.Exit();
         }
     }
 }