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(); } }
// Проверка уровня Администратора для снятия ограничения блокировок по заявкам public static int DostupAdmin(string UserName) { int Result = 0; int IdGroup = 0; Class_SQL.OpenConnection(); IdGroup = Convert.ToInt32(Class_SQL.SelectString("select isnull(SECURITY_GROUP_ID,1) from aurora.ils.dbo.USER_PROFILE where USER_NAME = N'" + UserName + "'")); if ((Class_SQL.SelectString("select isnull(SECURITY_GROUP,'n/a' ) from aurora.ils.dbo.SECURITY_GROUP where OBJECT_ID=" + IdGroup)) == "Administrators") { Result = 1; } Class_SQL.CloseConnection(); return(Result); }