Пример #1
0
        private void EditPanel_Add(object sender, EventArgs e)
        {
            try
            {
                User User = new User();
                User.ShowDialog();
                Fill_Users_LB();
            }
            catch
            {

            }
        }
Пример #2
0
        private void EditPanel_Edit(object sender, EventArgs e)
        {
            try
            {
                if(Users_LB.SelectedIndex != -1)
                {
                    User User = new User(Edit_Mode.Edit, Users_LB.SelectedValue);
                    User.ShowDialog();
                    Fill_Users_LB();
                }
            }
            catch
            {

            }
        }
Пример #3
0
        private void Hyperlink_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                //Change Password
                //select the user information giving the username 
                DB db = new DB("users");
                db.AddCondition("user_name", User_name_TB.Text.Trim());
                DataRow User = db.SelectRow("select * from users");

                //check if user is exist
                if(User != null)
                {
                    //check if password hashcode match
                    if(Password_TB.Password.GetHashCode().ToString() == User["user_pass"].ToString())
                    {
                        //set global variables
                        App.User_Id = User["User_Id"];
                        //open change password window
                        User u = new User(Edit_Mode.Change_Password, User["User_Id"]);
                        this.Hide();
                        u.ShowDialog();
                        //show Login window
                        this.ShowDialog();
                    }
                    else
                    {
                        Message.Show("كلمة المرور غير صحيحة", MessageBoxButton.OK, 10);
                    }
                }
                else
                {
                    Message.Show("إسم المستخدم غير صحيح", MessageBoxButton.OK, 10);
                }
            }
            catch
            {

            }
        }