Esempio n. 1
0
        public bool insertNhom(Entities.tblNhom nh)
        {
            bool   check = false;
            string sql   = "sp_tblNhom_Insert";

            try
            {
                con = ds.getConnect();
                cmd = new SqlCommand(sql, con);
                con.Open();
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.CommandText = sql;
                cmd.Connection  = con;
                cmd.Parameters.Add("@manhom", SqlDbType.NVarChar).Value  = nh.Manhom;
                cmd.Parameters.Add("@tennhom", SqlDbType.NVarChar).Value = nh.Tennhom;
                cmd.ExecuteNonQuery();
                check = true;
            }
            catch (Exception ex)
            {
                ex.ToString();
            }
            finally
            {
                cmd.Dispose();
                con.Close();
            }
            return(check);
        }
Esempio n. 2
0
        public bool deleteNhom(Entities.tblNhom nh)
        {
            bool   check = false;
            string sql   = "sp_tblNhom_Delete";

            try
            {
                con = ds.getConnect();
                cmd = new SqlCommand(sql, con);
                con.Open();
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.Add("@id", SqlDbType.Int).Value = nh.Id;
                cmd.ExecuteNonQuery();
                check = true;
            }
            catch (Exception ex)
            {
                ex.ToString();
            }
            finally
            {
                cmd.Dispose();
                con.Close();
            }
            return(check);
        }
Esempio n. 3
0
 private void btnSave_Click(object sender, EventArgs e)
 {
     if (int.TryParse(lblID.Text, out _ID))
     {
     }
     if (int.TryParse(lblIDNhom.Text, out _id))
     {
     }
     if (CheckObject())
     {
         Entities.tblTaiKhoan kh = new Entities.tblTaiKhoan();
         kh.Id          = _ID;
         kh.Idnhom      = _id;
         kh.Tentaikhoan = txtTenTaiKhoan.Text;
         kh.Matkhau     = txtMatKhau.Text;
         kh.Hoten       = txtHoTen.Text;
         kh.Namsinh     = dtpNamSinh.Value;
         kh.Gioitinh    = cbGioiTinh.Text;
         kh.Diachi      = txtDiaChi.Text;
         kh.Email       = txtEmail.Text;
         kh.Dienthoai   = txtDienThoai.Text;
         Entities.tblNhom nh = new Entities.tblNhom();
         nh.Id      = _id;
         nh.Manhom  = lblMaNhom.Text;
         nh.Tennhom = cbQuyen.Text;
         if (flag == "add")
         {
             bool check = bllTaiKhoan.insertTaiKhoan(kh);
             bllNhom.insertNhom(nh);
             if (check)
             {
                 MessageBox.Show("Thêm thành công.", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
             }
             ReLoad();
         }
         else if (flag == "update")
         {
             bool check = bllTaiKhoan.updateTaiKhoan(kh);
             bllNhom.updateNhom(nh);
             if (check)
             {
                 MessageBox.Show("Cập nhật thành công.", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
             }
             ReLoad();
         }
         else if (flag == "delete")
         {
             bool check = bllTaiKhoan.deleteTaiKhoan(kh);
             if (check)
             {
                 MessageBox.Show("Xóa thành công.", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
             }
             ReLoad();
         }
         ReLoad();
         dgvTaiKhoan_SelectionChanged(sender, e);
     }
 }
Esempio n. 4
0
 private void btnSave_Click(object sender, EventArgs e)
 {
     if (int.TryParse(lblID.Text, out _ID))
     {
     }
     if (CheckObject())
     {
         Entities.tblNhom kh = new Entities.tblNhom();
         kh.Id      = _ID;
         kh.Manhom  = txtMaNhom.Text;
         kh.Tennhom = txtTenNhom.Text;
         if (flag == "add")
         {
             bool check = bllNhom.insertNhom(kh);
             if (check)
             {
                 MessageBox.Show("Thêm thành công.", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
             }
             ReLoad();
         }
         else if (flag == "update")
         {
             bool check = bllNhom.updateNhom(kh);
             if (check)
             {
                 MessageBox.Show("Cập nhật thành công.", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
             }
             ReLoad();
         }
         else if (flag == "delete")
         {
             bool check = bllNhom.deleteNhom(kh);
             if (check)
             {
                 MessageBox.Show("Xóa thành công.", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
             }
             ReLoad();
         }
         ReLoad();
         dgvNhom_SelectionChanged(sender, e);
     }
 }
Esempio n. 5
0
 public bool deleteNhom(Entities.tblNhom nh)
 {
     return(dal.deleteNhom(nh));
 }
Esempio n. 6
0
 public bool updateNhom(Entities.tblNhom nh)
 {
     return(dal.updateNhom(nh));
 }
Esempio n. 7
0
 public bool insertNhom(Entities.tblNhom nh)
 {
     return(dal.insertNhom(nh));
 }