Exemplo n.º 1
0
        private void LuuUser(object sender, ItemClickEventArgs e)
        {
            if (this.isUserTab() && this.userBindingSource.Current != null)
            {
                if (this.ValidateUserFields())
                {
                    QLThuChi.Dao.ThuChi.userRow row = (QLThuChi.Dao.ThuChi.userRow)((DataRowView)this.userBindingSource.Current).Row;

                    if (this.txtUserPassword.Text != "")
                    {
                        row.Password = CommonUtil.GetMd5Hash(this.txtUserPassword.Text.Trim());
                    }

                    this.userBindingSource.EndEdit();
                    this.thuChi.user.GetChanges();
                    this.userTableAdapter.Update(this.thuChi.user);
                    this.thuChi.user.AcceptChanges();

                    this.iUserXoa.Enabled = true;
                    this.gcUser.Enabled   = true;
                }
            }
            else if (this.userBindingSource.Current == null)
            {
                var confirmResult = MessageBox.Show("Không có Nhân viên nào trong danh sách hiện tại. Bạn có tạo một Nhân viên mới không ?", "Confirm",
                                                    MessageBoxButtons.YesNo, MessageBoxIcon.Question);

                if (confirmResult == DialogResult.Yes)
                {
                    this.iUserThem_ItemClick(sender, e);
                }
            }
        }
Exemplo n.º 2
0
        private void iUserThem_ItemClick(object sender, ItemClickEventArgs e)
        {
            if (this.isUserTab() && !this.IsCurrentUserAddingNew)
            {
                DataRowView rowView             = (DataRowView)this.userBindingSource.AddNew();
                QLThuChi.Dao.ThuChi.userRow row = rowView.Row as QLThuChi.Dao.ThuChi.userRow;
                row.FullName = "";
                row.Code     = "";
                row.Password = "";
                row.IsAdmin  = false;

                this.iUserXoa.Enabled = false;
                this.gcUser.Enabled   = false;
            }
        }
Exemplo n.º 3
0
 private void FrmCTTMNhanVien_Load(object sender, EventArgs e)
 {
     if (this.IsAdmin)
     {
         // TODO: This line of code loads data into the 'thuChi.user' table. You can move, or remove it, as needed.
         this.userTableAdapter.Fill(this.thuChi.user);
         QLThuChi.Dao.ThuChi.userRow row = this.thuChi.user.NewuserRow();
         row.FullName = MaNhanVienTatCa;
         row.Code     = MaNhanVienTatCa;
         row.Password = "";
         row.IsAdmin  = false;
         this.thuChi.user.Rows.InsertAt(row, 0);
         this.txtMaNhanVien.Text = MaNhanVienTatCa;
     }
     else
     {
         this.userTableAdapter.getUserByUserId(this.thuChi.user, this.UserId);
     }
 }