Exemplo n.º 1
0
        private static double ProverkaUser(string UserName)
        {
            double Result = 0;

            Result = Class_SQL.SelectFloat("select count(*) from bi.dbo.ABS_USER_PROFILE where active= 'Y' and user_name=N'" + UserName + "'");


            Console.WriteLine("Уровень доступа =  " + Result);
            return(Result);
        }
Exemplo n.º 2
0
        private void Load_User()
        {
            if (this.ComboBox_Reg_Login.SelectedIndex != -1)
            {
                string stLogin = this.ComboBox_Reg_Login.SelectedValue.ToString().ToLower();

                string stPassword = this.Reg_Textbox_Password.Text;

                if (!string.IsNullOrEmpty(stLogin))
                {
                    if (!string.IsNullOrEmpty(stPassword))
                    {
                        double d = 0;

                        string stPass = null;

                        d = Class_SQL.SelectFloat("select count(*) from bi.dbo.ABS_USER_PROFILE where active= 'Y' and DOSTUP_ABS = N'Y' and USER_NAME = N'" + stLogin + "'");

                        stPass = Class_SQL.SelectString("select PASSWORD from bi.dbo.ABS_USER_PROFILE where active= 'Y' and DOSTUP_ABS = N'Y' and USER_NAME = N'" + stLogin + "'");

                        if (stPass == Class_SQL.SelectString("select SNT.dbo.svc_md5_ngen(N'" + stPassword + "')"))

                        {
                            this.Hide();
                            FirstForm f2 = new FirstForm(stLogin);
                            f2.Show();
                        }
                        else
                        {
                            MessageBox.Show("Не верно указан логин или пароль.", "АБС", MessageBoxButtons.OK, MessageBoxIcon.Error);
                            this.Reg_Textbox_Password.Focus();
                        }
                    }
                    else
                    {
                        MessageBox.Show("Поле Пароль не заполнено.", "АБС", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        this.Reg_Textbox_Password.Focus();
                    }
                }
                else
                {
                    MessageBox.Show("Поле Логин не заполнено.", "АБС", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    this.Reg_Textbox_Password.Focus();
                }
            }
            else
            {
                MessageBox.Show("Поле Логин не заполнено.", "АБС", MessageBoxButtons.OK, MessageBoxIcon.Error);
                this.ComboBox_Reg_Login.Focus();
            }
        }