Пример #1
0
        private void ConnectToArchive(MenuAction action)
        {
            if (!BaseFormManager.CloseAll(true))
            {
                return;
            }
            //bool archiveConnection = false;
            if (action.MenuItem != null && action.MenuItem is BarCheckItem)
            {
                if (!BaseFormManager.ArchiveMode)
                {
                    if (!ConnectToArchiveDatabase())
                    {
                        ConnectToStanadardDatabase();
                    }
                }
                else
                {
                    ConnectToStanadardDatabase();
                }
            }

            ReloadMenu();
            MenuAction a = MenuActionManager.Instance.FindAction("MenuConnectToArchive");

            if (a != null && a.MenuItem != null && a.MenuItem is BarCheckItem)
            {
                (a.MenuItem as BarCheckItem).Checked = BaseFormManager.ArchiveMode;
            }
        }
Пример #2
0
 private void MainForm_FormClosing(object sender, FormClosingEventArgs e)
 {
     if (m_AskForExit &&
         WinUtils.ConfirmMessage(EidssMessages.Get("msgCloseApp", "Close application?"),
                                 EidssMessages.Get("lbCloseAppCaption", "Close Application")) == false)
     {
         e.Cancel = true;
     }
     if (e.Cancel == false)
     {
         if (!BaseFormManager.CloseAll(true))
         {
             e.Cancel = true;
         }
     }
     if (e.Cancel == false)
     {
         ExitApp(false);
     }
 }
Пример #3
0
        private bool Login()
        {
            if (!BaseFormManager.CloseAll(true))
            {
                return(true);
            }
            if (m_ActivityMonitor != null)
            {
                m_ActivityMonitor.Enabled = false;
            }
            var manager = new EidssSecurityManager();

            manager.LogOut();
            Visible = false;
            if (!LoginForm.DefaultLogin())
            {
                ExitApp(true);
                return(false);
            }

            //reset connection
            UpdateMessenger.SetConnection((SqlConnection)ConnectionManager.CreateNew().Connection);

            //check for can run application
            if (!UpdateMessenger.CanRunApplication(ModelUserContext.ClientID, AppCode))
            {
                ErrorForm.ShowMessageDirect(EidssMessages.Get("ApplicationMustBeClosed"));
                ExitApp(true);
                return(false);
            }

            if (m_Server == null)
            {
                try
                {
                    RemotingServer.Init();
                    RemoteEventManager.Singleton.MainForm = this;
                    m_Server = RemoteEventManager.Singleton;
                }
                catch (Exception)
                {
                    ErrorForm.ShowMessageDirect(EidssMessages.Get("errRemotingSockeError",
                                                                  "Unable to start server for communication with EIDSS Client Agent. Please check that no EIDSS application is started in other Windows session or ask adminisrtators to correct TCP port used by EIDSS. If you see this message, you will be not able to open EIDSS form directly from EIDSS Client Agent. Other EIDSS functionality is not changed."));
                }
            }
            CommonResourcesCache.Reset();
            EIDSS_LookupCacheHelper.Init();
            BaseForm.ReplicationNeeded         = EidssSiteContext.Instance.RealSiteType != SiteType.CDR;
            CustomCultureHelper.CurrentCountry = EidssSiteContext.Instance.CountryID;
            if (EidssSiteContext.Instance.IsAzerbaijanCustomization)
            {
                panel1.BackgroundImage = Properties.Resources.EIDSS_AZ_Background;
                Appearance.BackColor   = Color.White;
            }
            else if (EidssSiteContext.Instance.IsIraqCustomization)
            {
                panel1.BackgroundImage = Properties.Resources.EIDSS_IQ_Background;
                Appearance.BackColor   = Color.White;
                //Appearance.BackColor =Color.FromArgb(96,199,242);
            }
            else if (EidssSiteContext.Instance.IsThaiCustomization)
            {
                panel1.BackgroundImage = Properties.Resources.EIDSS_TH_Logo;
                Appearance.BackColor   = Color.White;
                //Appearance.BackColor =Color.FromArgb(96,199,242);
            }
            else
            {
                panel1.BackgroundImage = Properties.Resources.EIdss_background;
                Appearance.BackColor   = Color.FromArgb(184, 199, 230);
            }
            //eidss.model.Core.EidssSiteContext.Instance.CountryID = EIDSS.model.Core.EidssSiteContext.Instance.CountryID;
            Splash.ShowSplash();
            if (!ReloadMenu())
            {
                return(false);
            }
            Visible = true;
            InitAutoLogoutMonitor();

            if (BaseSettings.ScanFormsMode)
            {
                MessageBox.Show("Change config setting 'ScanFormsMode' to false!!", "ScanFormsMode = true!!");
            }

            return(true);
        }