Exemplo n.º 1
0
 private void gr_btn_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e)
 {
     if (e.Button.Caption.ToUpper().Equals("DELETE"))
     {
         int    introw         = gridView1.FocusedRowHandle;
         string strNguoiDungID = string.Empty;
         if (introw >= 0)
         {
             strNguoiDungID = gridView1.GetRowCellValue(introw, "NguoiDungID").ToString();
         }
         if ((strNguoiDungID != string.Empty) && (!strNguoiDungID.ToUpper().Equals("ADMIN")))
         {
             if (MessageBox.Show("Bạn muốn xóa người sử dụng này?", "Xác nhận", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.Yes)
             {
                 NguoiDungController.Del(strNguoiDungID);
                 gridControl1.DataSource = NguoiDungController.GetList();
                 //if ((gridView1.RowCount>introw )&&(introw>0))
                 //{
                 //    gridView1.FocusedRowHandle = introw - 1;
                 //}
             }
         }
         else
         {
             if (strNguoiDungID.ToUpper().Equals("ADMIN"))
             {
                 MessageBox.Show("Không được xóa user ADMIN", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                 return;
             }
         }
     }
 }
Exemplo n.º 2
0
 private void frmCauHinh_Load(object sender, EventArgs e)
 {
     KhoiTaoLuoi();
     gridControl1.DataSource = NguoiDungController.GetList();
     setTrangThaiNut();
     //
     LayThongTinShop();
     // load roles
     cbbRoles.Properties.Items.Add(Utility.QUANLY);
     cbbRoles.Properties.Items.Add(Utility.NHANVIEN);
 }
Exemplo n.º 3
0
        private void GhiThongTinNGuoiDung()
        {
            NguoiDung itemNguoiDung = new NguoiDung();

            itemNguoiDung.NguoiDungID  = txtNguoiDungID.Text.Trim();
            itemNguoiDung.MatKhau      = txtMatKhau.Text.Trim();
            itemNguoiDung.TenNguoiDung = txtTenNguoiDung.Text.Trim();
            itemNguoiDung.Roles        = cbbRoles.EditValue.ToString();
            if (strMode.ToUpper().Equals("ADD"))
            {
                NguoiDungController.Add(itemNguoiDung);
            }
            else
            {
                if (strMode.ToUpper().Equals("EDIT"))
                {
                    NguoiDungController.Edit(itemNguoiDung);
                }
            }
            gridControl1.DataSource = NguoiDungController.GetList();
        }
Exemplo n.º 4
0
 private void frmNguoiDung_Load(object sender, EventArgs e)
 {
     KhoiTaoLuoi();
     gridControl1.DataSource = NguoiDungController.GetList();
 }