예제 #1
0
 //them loai san pham
 public bool themLoaiSP(ET_LoaiSP sp)
 {
     try
     {
         _cn.Open();
         SqlCommand cmd = new SqlCommand("sp_themLoaiSP", _cn);
         cmd.CommandText = "sp_themLoaiSP";
         cmd.CommandType = CommandType.StoredProcedure;
         SqlParameter p_ma = new SqlParameter("@MaLoaiSP", sp.MaTL);
         cmd.Parameters.Add(p_ma);
         SqlParameter p_ten = new SqlParameter("@TenLoaiSP", sp.TenTL);
         cmd.Parameters.Add(p_ten);
         if (cmd.ExecuteNonQuery() > 0)
         {
             return(true);
         }
         else
         {
             return(false);
         }
     }
     catch (Exception ex)
     {
         return(false);
     }
     finally
     {
         _cn.Close();
     }
 }
예제 #2
0
 private void btnCapNhat_Click(object sender, EventArgs e)
 {
     if (txtMa.Text != "" && txtTen.Text != "")
     {
         ET_LoaiSP lsp = new ET_LoaiSP(txtMa.Text, txtTen.Text);
         if (bLSP.SuaLSP(lsp) == true)
         {
             MessageBox.Show("Sua thanh cong ");
         }
         else
         {
             MessageBox.Show("Sua khong thanh cong ");
         }
         load();
     }
     else
     {
         MessageBox.Show("Kiểm tra lại thông tin nhập");
     }
 }
예제 #3
0
 private void btnThem_Click(object sender, EventArgs e)
 {
     if (txtMa.Text != "" && txtTen.Text != "")
     {
         ET_LoaiSP lsp = new ET_LoaiSP(txtMa.Text, txtTen.Text);
         if (bLSP.ThemLSP(lsp) == true)
         {
             MessageBox.Show("Them thanh cong ");
             txtMa.Text  = "";
             txtTen.Text = "";
         }
         else
         {
             MessageBox.Show("Them khong thanh cong ");
         }
         load();
     }
     else
     {
         MessageBox.Show("Kiểm tra thông tin nhập");
     }
 }
예제 #4
0
 public bool SuaLSP(ET_LoaiSP b)
 {
     return(loaiSP.capNhapLoaiSP(b));
 }
예제 #5
0
 public bool ThemLSP(ET_LoaiSP b)
 {
     return(loaiSP.themLoaiSP(b));
 }