private void btnAddMainStaff_Click(object sender, RoutedEventArgs e)
        {
            StaffDAO sd = new StaffDAO();

            DTO.Entity.Staff staff = new DTO.Entity.Staff
            {
                Name       = txtFullName.Text,
                Address    = txtAddress.Text,
                Email      = txtEmail.Text,
                Username   = txtUsername.Text,
                Password   = txtPassword.Password,
                Permission = cbxPermission.SelectedIndex
            };

            bool flag = sd.Add(staff);

            if (flag == true)
            {
                MessageBox.Show("Thêm Nhân viên thành công.");
            }
            else
            {
                MessageBox.Show("Thêm Nhân viên thất bại.");
            }
        }
Exemple #2
0
 private void btnStaffRefresh_Click(object sender, RoutedEventArgs e)
 {
     DTO.Entity.Staff staff = new DTO.Entity.Staff();
     ChangeInput(staff);
     btnUpdateMainStaff.Visibility = Visibility.Hidden;
     btnUpdateUser.Visibility      = Visibility.Hidden;
     btnStaffAdd.Visibility        = Visibility.Visible;
     liNewPassword.Visibility      = Visibility.Hidden;
     txtPassword.Text    = string.Empty;
     txtNewPassword.Text = string.Empty;
 }
Exemple #3
0
        private void ChangeInput(DTO.Entity.Staff staff)
        {
            txtId.Text       = staff.Id.ToString();
            txtFullName.Text = staff.Name;
            txtEmail.Text    = staff.Email;
            txtAddress.Text  = staff.Address;

            if (staff.Permission.HasValue == false)
            {
                cbxPermission.SelectedIndex = -1;
            }
            else
            {
                cbxPermission.SelectedIndex = staff.Permission.Value;
            }

            txtUsername.Text = staff.Username;
        }
Exemple #4
0
        private void btnUpdateMainStaff_Click(object sender, RoutedEventArgs e)
        {
            StaffDAO sd = new StaffDAO();

            DTO.Entity.Staff staff = new DTO.Entity.Staff
            {
                Id         = Convert.ToInt32(txtId.Text),
                Name       = txtFullName.Text,
                Address    = txtAddress.Text,
                Email      = txtEmail.Text,
                Permission = cbxPermission.SelectedIndex
            };
            if (new StaffDAO().UpdateInfo(staff))
            {
                grdStaff.ItemsSource = new StaffDAO().GetAll();
                MessageBox.Show("Cập nhật thông tin cá nhân thành công!!!");
            }
            else
            {
                MessageBox.Show("Cập nhật thông tin cá nhân không thành công!!!");
            }
        }
Exemple #5
0
        private void btnStaffAdd_Click(object sender, RoutedEventArgs e)
        {
            StaffDAO sd = new StaffDAO();

            DTO.Entity.Staff staff = new DTO.Entity.Staff
            {
                Name       = txtFullName.Text,
                Address    = txtAddress.Text,
                Email      = txtEmail.Text,
                Permission = cbxPermission.SelectedIndex,
                Username   = txtUsername.Text,
                Password   = txtPassword.Password
            };
            if (new StaffDAO().Add(staff))
            {
                grdStaff.ItemsSource = new StaffDAO().GetAll();
                MessageBox.Show("Thêm người dùng thành công!!!");
            }
            else
            {
                MessageBox.Show("Thêm người dùng không thành công!!!");
            }
        }