Example #1
0
 public Settings(User CurrentUsr, Main_Menu menu)
 {
     InitializeComponent();
     this.CurrentUser   = CurrentUsr;
     this.Menu          = menu;
     this.Username.Text = this.CurrentUser.UserName;
     this.Type.Text     = this.CurrentUser.Type;
     this.NameText.Text = this.CurrentUser.Name;
     this.Old_Label.Hide();
     this.New_Label.Hide();
     this.Repeat_Label.Hide();
     this.RepeatText.Hide();
     this.NewText.Hide();
     this.OldText.Hide();
     this.ApplyPrivileges();
 }
Example #2
0
 public Add_Edit_User(int isAdd, User CurrUser, Main_Menu menu, Settings S)
 {
     InitializeComponent();
     this.Menu        = menu;
     this.CurrentUser = CurrUser;
     sett             = S;
     IsAdd            = isAdd;
     if (isAdd == 1)
     {
         this.Text = "Add User";
         this.Delete.Hide();
     }
     else
     {
         this.Text = "Edit User";
         this.HandleText.Enabled   = false;
         this.PassWordText.Enabled = false;
         this.NameText.Enabled     = false;
     }
 }
Example #3
0
        private void Login_Button_Click(object sender, EventArgs e)
        {
            // Login Code Starts Here ...
            DBManager  Manager   = new DBManager();
            SqlCommand myCommand = new SqlCommand();

            myCommand.Connection  = Manager.myConnection;
            myCommand.CommandText = StoredProcedures.Login;
            myCommand.CommandType = System.Data.CommandType.StoredProcedure;
            myCommand.Parameters.AddWithValue("@username", User_Name.Text);
            myCommand.Parameters.AddWithValue("@password", Pass_Word.Text);
            SqlDataReader myReader = myCommand.ExecuteReader();
            int           count    = 0;

            while (myReader.Read())
            {
                count++;
                CurrentUser.Name     = myReader.GetString(2);
                CurrentUser.Type     = myReader.GetString(3);
                CurrentUser.PassWord = myReader.GetString(1);
                CurrentUser.UserName = myReader.GetString(0);
            }
            if (count == 1)
            {
                Hide();
                Main_Menu MainMenu = new Main_Menu(CurrentUser);
                MainMenu.ShowDialog();
                Close();
            }
            else
            {
                MessageBox.Show("Invalid Username Or Password.");
                this.User_Name.Text = "";
                this.Pass_Word.Text = "";
            }

            // Login Code Ends Here ...
        }