Exemple #1
0
        private void InitSettings()
        {
            try
            {
                Application.DoEvents();
                Cursor = Cursors.WaitCursor;

                ConfigurationManagerEx.Load();

                miOnline.Visibility = (ConfigurationManagerEx.OfflineMode ? BarItemVisibility.Always : BarItemVisibility.Never);
                //new Thread(delegate()
                //{
                //    if (InvokeRequired)
                //    {
                //        BeginInvoke((ThreadStart)delegate()
                //        {
                //code here
                //});
                //    }
                //}).Start();
            }
            catch (Exception ex)
            {
                ExceptionHelper.Show(this, ex, "კონფიგურაციის ჩატვირთვა ვერ მოხერხდა", MessageBoxIcon.Error);
            }
            finally
            {
                Cursor = Cursors.Default;
            }
        }
Exemple #2
0
        private void OnSwitchFormSkinStyle_Click(object sender, ItemClickEventArgs e)
        {
            if (SkinManager.AllowFormSkins)
            {
                SkinManager.DisableFormSkins();
                miAllowFormSkins.Checked = false;
            }
            else
            {
                SkinManager.EnableFormSkins();
                miAllowFormSkins.Checked = true;
            }
            LookAndFeelHelper.ForceDefaultLookAndFeelChanged();


            if (sender is frmMain)
            {
                return;
            }
            try
            {
                ConfigurationManagerEx.AllowFormSkins = SkinManager.AllowFormSkins;
                ConfigurationManagerEx.Save();
            }
            catch (Exception ex)
            {
                ExceptionHelper.Show(this, ex, "შეცდომა თემის ჩართვის შენახვისას", MessageBoxIcon.Error);
            }
        }
Exemple #3
0
        private void OnSkinClick(object sender, ItemClickEventArgs e)
        {
            var skinName = e.Item.Caption.Replace(skinMask, string.Empty);

            UserLookAndFeel.Default.SetSkinStyle(skinName);
            barManager.GetController().PaintStyleName = "Skin";
            miPaintStyle.Caption    = e.Item.Caption;
            miPaintStyle.Hint       = miPaintStyle.Caption;
            miPaintStyle.ImageIndex = -1;

            if (sender is frmMain)
            {
                return;
            }

            try
            {
                ConfigurationManagerEx.SkinName = skinName;
                ConfigurationManagerEx.Save();
            }
            catch (Exception ex)
            {
                ExceptionHelper.Show(this, ex, "შეცდომა თემის შენახვისას", MessageBoxIcon.Error);
            }
        }
 static Bootstrap()
 {
     ServiceLogManager.SetProvider(() => new Log4NetServiceLog("Dagent"));
     ServiceLocatorManager.SetProvider(() => new UnityServiceLocator()) // new MicroServiceLocator())
     .Register(r =>
     {
         ConfigurationManagerEx.GetSection <HostingSection>("hosting").Configure(r);
         var appSection = ConfigurationManagerEx.GetSection <AppSection>("appSection").Configure(r);
         if (appSection.Log4Net)
         {
             XmlConfigurator.Configure();
         }
         HostingEnvironment.Initialize();
     });
     var o = ServiceLocatorManager.Current;
 }
Exemple #5
0
        private void LogIn()
        {
            if (IsValidForm())
            {
                try
                {
                    Application.DoEvents();
                    Cursor = Cursors.WaitCursor;

                    string passwordHash1 = (_PasswordHash1.Length == 0 ? CryptoHelper.Encrypt(Password, ConfigurationManagerEx.Salt, HashAlgorithmType.SHA1) : _PasswordHash1);
                    string passwordHash2 = CryptoHelper.Encrypt(passwordHash1, ConfigurationManagerEx.Salt, HashAlgorithmType.SHA1);

                    var table = UserManager.LogIn(Username, passwordHash2);

                    if (table.Count > 0)
                    {
                        if (table[0].UserStatus == (byte)DatabaseStatus.Blocked)
                        {
                            throw new Exception("მომხმარებელი დაბლოკილია.");
                        }

                        if (table[0].UserStatus == (byte)DatabaseStatus.Pending)
                        {
                            throw new Exception("მომხმარებელი არ არის დადასტურებული.");
                        }

                        if (table[0].BranchStatus == (byte)DatabaseStatus.Blocked)
                        {
                            throw new Exception("ოფისი, რომელშიც იმყოფება მომხმარებელი დაბლოკილია.");
                        }

                        var loginUserName = chkSave.Checked ? Username : string.Empty;
                        var loginPassword = chkSave.Checked ? passwordHash1 : string.Empty;
                        if (ConfigurationManagerEx.LoginUserName != loginUserName || ConfigurationManagerEx.LoginPassword != loginPassword)
                        {
                            ConfigurationManagerEx.LoginUserName = loginUserName;
                            ConfigurationManagerEx.LoginPassword = loginPassword;
                            ConfigurationManagerEx.Save();
                        }

                        var permission     = UserManager.GetUserPermission(table[0].UserID);
                        var userPermission = new Dictionary <string, int>();
                        foreach (DS_User.SP_GetUserPermissionRow row in permission.Rows)
                        {
                            if (!userPermission.ContainsKey(row.ObjectID.ToString()))
                            {
                                userPermission.Add(row.ObjectID.ToString(), row.Logical);
                            }
                            else
                            {
                                userPermission[row.ObjectID.ToString()] |= row.Logical;
                            }
                        }


                        GlobalVariable.IsLogged           = true;
                        BaseGlobalVariable.UserID         = table[0].UserID;
                        GlobalVariable.Username           = Username;
                        BaseGlobalVariable.Password       = Password;
                        GlobalVariable.BranchID           = table[0].BranchID;
                        BaseGlobalVariable.ServerDateTime = table[0].ServerDateTime.AddMilliseconds(-table[0].ServerDateTime.Millisecond);
                        BaseGlobalVariable.Permissions    = userPermission;

                        //GlobalVariable.PersonID = PersonManager.FindPersonID(GlobalVariable.UserID);
                        //if (GlobalVariable.PersonID != 0)
                        //{
                        //    DS_Person.T_PersonDataTable person = PersonManager.GetPerson(GlobalVariable.PersonID);
                        //    if (person.Count > 0)
                        //    {
                        //        GlobalVariable.FullName = person[0].FullName;
                        //        GlobalVariable.JobTitle = person[0].JobTitle;
                        //    }
                        //}


                        var myCompany = PersonManager.GetMyCompany(0, !ConfigurationManagerEx.OfflineMode);
                        if (myCompany.Count > 0)
                        {
                            GlobalVariable.MyCompanyName                        = myCompany[0].MyCompanyName;
                            GlobalVariable.MyCompanyTaxCode                     = myCompany[0].TaxCode;
                            GlobalVariable.MyCompanyDirectorName                = myCompany[0].DirectorName;
                            GlobalVariable.MyCompanyCountryCode                 = myCompany[0].CountryCode;
                            GlobalVariable.MyCompanyCountryName                 = myCompany[0].CountryName;
                            GlobalVariable.MyCompanyCity                        = myCompany[0].City;
                            GlobalVariable.MyCompanyPostalCode                  = myCompany[0].PostalCode;
                            GlobalVariable.MyCompanyAddress                     = myCompany[0].Address;
                            GlobalVariable.MyCompanyPhone                       = myCompany[0].Phone;
                            GlobalVariable.MyCompanyFax                         = myCompany[0].Fax;
                            GlobalVariable.MyCompanyBankName                    = myCompany[0].BankName;
                            GlobalVariable.MyCompanyBankCode                    = myCompany[0].BankCode;
                            GlobalVariable.MyCompanyBankAccountNumber           = myCompany[0].BankAccountNumber;
                            GlobalVariable.VATPayerFlag                         = myCompany[0].VATPayerFlag;
                            GlobalVariable.MyCompanyConditionalUnitCurrencyCode = myCompany[0].ConditionalUnitCurrencyCode;
                            GlobalVariable.MyCompanyDefaultTradingCurrencyCode  = myCompany[0].DefaultTradingCurrencyCode;
                        }

                        DialogResult = DialogResult.OK;
                    }
                    else if (GlobalVariable.AdminLogIn(Username, Password))
                    {
                        DialogResult = DialogResult.OK;
                    }
                    else
                    {
                        lblStatus.Text = "სახელი ან პაროლი არასწორია";
                        txtPassword.SelectAll();
                    }
                }
                catch (Exception ex)
                {
                    ExceptionHelper.Show(this, ex, "სისტემაში შესვლა ვერ მოხერხდა", MessageBoxIcon.Error);
                }
                finally
                {
                    Cursor = Cursors.Default;
                }
            }
        }
Exemple #6
0
 internal static WebExSection GetSection()
 {
     return(ConfigurationManagerEx.GetSection <WebExSection>("webEx"));
 }