Exemple #1
0
 private static void ApplicationStart()
 {
     if (!Network.IsInternetConnected)
     {
         DialogConfirm.ShowInformationDialog("Internet is not there. Please connect to internet, then open again.", "Stone Age !!");
         Application.ExitThread();
         Application.Exit();
     }
     else
     {
         //DialogConfirm.ShowInfohScreen("Application is checking your system..." + Environment.NewLine + "Please Wait");
         try
         {
             ErrorEnum errType   = ErrorEnum.Other;
             string    errMsg    = string.Empty;
             bool      isSuccess = false;
             DBSaveManager.ApplicationStartDbFetch(out errType, out errMsg, out isSuccess);
             if (isSuccess)
             {
                 if (User.IsSuperadmin)
                 {
                     Application.Run(new FrmUserSelector());
                 }
                 else
                 {
                     Application.Run(new FrmLogin());
                 }
             }
             else if (errType.Equals(ErrorEnum.IpNotAllowed))
             {
                 DialogConfirm.ShowInformationDialog("Your IP is not allowed." + Environment.NewLine + " Please contact administrator to add your IP : " + Network.GetPublicIpAddress(), "IP not Allowed!");
             }
             else if (errType.Equals(ErrorEnum.MacNotAllowed))
             {
                 DialogConfirm.ShowInformationDialog("Your machine is not allowed." + Environment.NewLine + " Please contact administrator to add your machine : " + Network.GetActiveMACAddress(), "Machine not Allowed");
             }
             else
             {
                 Application.Run(new FrmSetup());
             }
         }
         catch (Exception ex)
         {
             Logger.LogError(ex);
         }
         //Thread mstDataThread = new Thread(new ThreadStart(FetchMasterData));
         //mstDataThread.Start();
     }
 }
Exemple #2
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            MasterDataHelper.FetchMasterData();
            string msg = string.Empty;

            if (UserHelper.DoLogin(User.LoginId, User.Password, User.AllowedMacId.Split(',').FirstOrDefault(), out msg))
            {
                Logger.LogInfo("Logged in disguise as user \"" + User.LoginId + "\"");
                FormHelper.OpenFrmRationcardHome();
                this.Visible = false;
            }
            else
            {
                Logger.LogInfo("unsuccessful Loging in disguise as user \"" + User.LoginId + "\"" + Environment.NewLine + msg);
                DialogConfirm.ShowInformationDialog("Couldnot login.", "Autologin");
            }
        }