public bool DeleteNhaCC(DTO_NhaCC a)
 {
     try
     {
         NhaCC delete = db.NhaCCs.Where(p => p.MaNCC.ToString().Equals(a.MaNCC)).SingleOrDefault();
         db.NhaCCs.DeleteOnSubmit(delete);
         db.SubmitChanges();
         return(true);
     }
     catch
     {
         return(false);
     }
 }
Exemplo n.º 2
0
 private void btnSua_Click(object sender, EventArgs e)
 {
     try
     {
         DTO_NhaCC ncc = new DTO_NhaCC(int.Parse(txtMaNCC.Text), txtTenNCC.Text, txtDiachi.Text, txtsdt.Text);
         bUS_NhaCC.UpdateNhaCC(ncc);
         MessageBox.Show("Sửa thành công");
         LoadData();
     }
     catch (Exception)
     {
         MessageBox.Show("sửa thất bại");
     }
 }
Exemplo n.º 3
0
 private void btnLuu_Click(object sender, EventArgs e)
 {
     try
     {
         DTO_NhaCC ncc = new DTO_NhaCC(txtTenNCC.Text, txtDiachi.Text, txtsdt.Text);
         bUS_NhaCC.InsertNhaCC(ncc);
         MessageBox.Show("Thêm thành công");
         LoadData();
     }
     catch (Exception)
     {
         MessageBox.Show("Thêm thất bại");
     }
 }
 public bool UpdateNhaCC(DTO_NhaCC a)
 {
     try
     {
         NhaCC update = db.NhaCCs.Where(p => p.MaNCC.ToString().Equals(a.MaNCC)).SingleOrDefault();
         update.TenNCC = a.TenNCC;
         update.diachi = a.Diachi;
         update.sdt    = a.SDT;
         db.SubmitChanges();
         return(true);
     }
     catch
     {
         return(false);
     }
 }
 public bool InsertNhaCC(DTO_NhaCC a)
 {
     try
     {
         NhaCC insert = new NhaCC();
         insert.TenNCC = a.TenNCC;
         insert.diachi = a.Diachi;
         insert.sdt    = a.SDT;
         db.NhaCCs.InsertOnSubmit(insert);
         db.SubmitChanges();
         return(true);
     }
     catch
     {
         return(false);
     }
 }
Exemplo n.º 6
0
        private void btnXoa_Click(object sender, EventArgs e)
        {
            try
            {
                DialogResult r = MessageBox.Show("Bạn có muốn xóa?", "Thông báo", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                if (r == DialogResult.Yes)
                {
                    DTO_NhaCC ncc = new DTO_NhaCC(int.Parse(txtMaNCC.Text));
                    bUS_NhaCC.DeleteNhaCC(ncc);
                    MessageBox.Show("Xóa thành công.");
                    LoadData();
                }
            }

            catch (Exception)
            {
                MessageBox.Show("Xóa thất bại");
            }
        }
Exemplo n.º 7
0
 public bool DeleteNhaCC(DTO_NhaCC a)
 {
     return(dalNCC.DeleteNhaCC(a));
 }
Exemplo n.º 8
0
 public bool UpdateNhaCC(DTO_NhaCC a)
 {
     return(dalNCC.UpdateNhaCC(a));
 }
Exemplo n.º 9
0
 public bool InsertNhaCC(DTO_NhaCC a)
 {
     return(dalNCC.InsertNhaCC(a));
 }