Exemplo n.º 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();
     }
 }
Exemplo n.º 2
0
        private static void SaveBillToDbQueueManage(Bill billObj)
        {
            string billXml = billObj.SerializeXml <Bill>().ToString();

            try
            {
                ErrorEnum errType   = ErrorEnum.Other;
                string    errMsg    = string.Empty;
                bool      isSuccess = false;

                SaveBillToDb(billXml, out errType, out errMsg, out isSuccess);
                if (!isSuccess && (errType.Equals(ErrorEnum.Networkfailure)))
                {
                    SaveBillToDb(billXml, out errType, out errMsg, out isSuccess);
                    if (!isSuccess)
                    {
                        Logger.LogError("Bill couldn't be saved due to network failure: " + Environment.NewLine + billXml);
                    }
                }
            }
            catch (Exception ex)
            {
                Logger.LogError(ex);
            }
        }