예제 #1
0
        private void btluu_Click(object sender, EventArgs e)
        {
            NguoiDungObj NDObj = new NguoiDungObj();

            addData(NDObj);
            if (flagLuu == 0)
            {
                if (ndCtr.AddData(NDObj))
                {
                    MessageBox.Show("Thêm thành công!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                {
                    MessageBox.Show("Thêm không thành công!", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            else
            {
                if (ndCtr.UpdData(NDObj))
                {
                    MessageBox.Show("Sửa thành công!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                {
                    MessageBox.Show("Sửa không thành công!", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            QuanLyNguoiDung_Load(sender, e);
        }
예제 #2
0
 private void addData(NguoiDungObj nd)
 {
     nd.MatKhau = txtmk1.Text.Trim();
     if (cbGT.SelectedIndex == 0)
     {
         nd.GioiTinh = "Nam";
     }
     else
     {
         nd.GioiTinh = "Nữ";
     }
     nd.TenND       = txtTk.Text.Trim();
     nd.HoTen       = txtHT.Text.Trim();
     nd.SoDienthoai = txtDT.Text.Trim();
     nd.Email       = txtEmail.Text.Trim();
     nd.Email       = txtEmail.Text.Trim();
 }
예제 #3
0
 public bool UpdData(NguoiDungObj ndObj)
 {
     cmd.CommandText = "Update tb_DangNhap set TenND =  N'" + ndObj.TenND + "',HoTen=N'" + ndObj.HoTen + "', GioiTinh = N'" + ndObj.GioiTinh + "', SoDienthoai = N'" + ndObj.SoDienthoai + "',Email = '" + ndObj.Email + "',PhanQuyen = '" + ndObj.PhanQuyen + "' Where MatKhau = '" + ndObj.MatKhau + "'";
     cmd.CommandType = CommandType.Text;
     cmd.Connection  = con.Connection;
     try
     {
         con.OpenConn();
         cmd.ExecuteNonQuery();
         return(true);
     }
     catch (Exception ex)
     {
         string mex = ex.Message;
         cmd.Dispose();
         con.CloseConn();
     }
     return(false);
 }
예제 #4
0
 public bool AddData(NguoiDungObj ndObj)
 {
     cmd.CommandText = "Insert into tb_DangNhap values ('" + ndObj.TenND + "',N'" + ndObj.MatKhau + "',N'" + ndObj.HoTen + "',N'" + ndObj.GioiTinh + "','" + ndObj.SoDienthoai + "','" + ndObj.Email + "','" + ndObj.PhanQuyen + "')";
     cmd.CommandType = CommandType.Text;
     cmd.Connection  = con.Connection;
     try
     {
         con.OpenConn();
         cmd.ExecuteNonQuery();
         return(true);
     }
     catch (Exception ex)
     {
         string mex = ex.Message;
         cmd.Dispose();
         con.CloseConn();
     }
     return(false);
 }
예제 #5
0
 public bool UpdData(NguoiDungObj ndObj)
 {
     return(ndMod.UpdData(ndObj));
 }
예제 #6
0
 public bool AddData(NguoiDungObj ndObj)
 {
     return(ndMod.AddData(ndObj));
 }