예제 #1
0
        public void LoginCommand()
        {
            bool flagToLogin = true;
            bool IsDone      = true;

            flag     = true;
            ErrorMes = "";

            if (PasswordSecond == String.Empty || PasswordSecond == null)
            {
                flagToLogin = false;
                ErrorMes    = Properties.Resources.emptyfield;
            }
            if (flagToLogin && canreg)
            {
                SqlConnect spam = new SqlConnect();
                string     Pass = firstHash(PasswordSecond).ToString();
                IsDone = spam.GiveUsersRecords(PhoneNumberLog, Pass);
                if (IsDone)
                {
                    Properties.Settings.Default.User   = PhoneNumberLog;
                    Properties.Settings.Default.UserId = spam.GetIdUserByName(PhoneNumberLog);
                    Properties.Settings.Default.Save();
                    MainWindow sp = new MainWindow();
                    sp.Show();
                    CloseAction2();
                }
            }
            if (!IsDone)
            {
                ErrorMes = Properties.Resources.nosuchuser;
            }
            flag   = false;
            canreg = true;
        }
예제 #2
0
        public void LoginCommand()
        {
            bool fl     = true;
            bool IsDone = true;

            ErrorMes = "";
            flag     = true;
            Login   += " ";
            int x1 = Login.Length - 1;

            Login = Login.Substring(0, x1);

            if (PasswordFieldText == String.Empty || PasswordFieldText == null)
            {
                fl       = false;
                ErrorMes = Properties.Resources.emptyfield;
            }
            if (fl && canreg)
            {
                SqlConnect spam = new SqlConnect();
                string     Pass = firstHash(PasswordFieldText).ToString();
                IsDone = spam.GiveUsersRecords(Login, Pass);
                if (IsDone)
                {
                    Properties.Settings.Default.Language = "en";
                    LocalizeDictionary.Instance.SetCurrentThreadCulture = true;
                    LocalizeDictionary.Instance.Culture = new CultureInfo("en");
                    Properties.Settings.Default.User    = Login;
                    Properties.Settings.Default.UserId  = spam.GetIdUserByName(Login);
                    Properties.Settings.Default.Save();
                    MainWindow sp = new MainWindow();
                    sp.WindowStartupLocation = WindowStartupLocation.CenterScreen;
                    sp.Show();
                    CloseAction2();
                }
            }
            if (!IsDone)
            {
                ErrorMes = Properties.Resources.nosuchuser;
            }

            flag   = false;
            canreg = true;
        }