Esempio n. 1
0
 public void Delete(DTO_TypePro ex)
 {
     sqlCm.Connection  = cnnTypePro.OpenConnection();
     sqlCm.CommandText = "XoaLoaiSP";
     sqlCm.CommandType = CommandType.StoredProcedure;
     sqlCm.Parameters.AddWithValue("@maLoai", ex.MaLoai);
     sqlCm.ExecuteReader();
     sqlCm.Parameters.Clear();
 }
Esempio n. 2
0
 public void Update(DTO_TypePro ex)
 {
     sqlCm.Connection  = cnnTypePro.OpenConnection();
     sqlCm.CommandText = "SuaLoaiSP";
     sqlCm.CommandType = CommandType.StoredProcedure;
     sqlCm.Parameters.AddWithValue("@ghiChu", ex.GhiChu);
     sqlCm.Parameters.AddWithValue("@maLSP", ex.MaLoai);
     sqlCm.Parameters.AddWithValue("@tenLSP", ex.TenLoai);
     sqlCm.ExecuteNonQuery();
     sqlCm.Parameters.Clear();
 }
Esempio n. 3
0
 private void btnDeleteProduct_Click(object sender, EventArgs e)
 {
     if (dataGridView1.Rows.Count > 0)
     {
         BLL_TypePro bltp = new BLL_TypePro();
         DTO_TypePro ex   = new DTO_TypePro();
         txtLoaiSP.Text = dataGridView1.CurrentRow.Cells["Mã loại sản phẩm"].Value.ToString();
         ex.MaLoai      = Convert.ToInt32(txtLoaiSP.Text);
         MessageBox.Show("Bạn có chắn chắn muốn xóa loại sản phẩm này!", "", MessageBoxButtons.YesNo);
         bltp.Delete(ex);
         ShowDgv();
     }
     else
     {
         MessageBox.Show("Hãy chọn sản phẩm để xóa");
     }
 }
Esempio n. 4
0
        private void btnUpdateProduct_Click(object sender, EventArgs e)
        {
            BLL_TypePro bltp = new BLL_TypePro();
            DTO_TypePro ex   = new DTO_TypePro();

            if (Edit == false)
            {
                try
                {
                    ex.TenLoai = txtTenLoaiSP.Text;
                    ex.GhiChu  = txtNote.Text;
                    bltp.InsertType(ex);
                    MessageBox.Show("Thêm thành công!");
                    ShowDgv();
                }
                catch
                {
                    MessageBox.Show("Thêm thất bại!");
                }
            }
            if (Edit == true)
            {
                try {
                    ex.MaLoai  = Convert.ToInt32(txtLoaiSP.Text);
                    ex.TenLoai = txtTenLoaiSP.Text;
                    ex.GhiChu  = txtNote.Text;
                    bltp.Update(ex);
                    MessageBox.Show("Sửa thành công!");
                    ShowDgv();
                }
                catch
                {
                    MessageBox.Show("Sửa thất bại");
                }
            }
        }
Esempio n. 5
0
 public void Delete(DTO_TypePro ex)
 {
     dttp.Delete(ex);
 }
Esempio n. 6
0
 public void Update(DTO_TypePro ex)
 {
     dttp.Update(ex);
 }
Esempio n. 7
0
 public void InsertType(DTO_TypePro ex)
 {
     dttp.Insert(ex);
 }