示例#1
0
 public void ThemSanPham(string masp, string tensp, float dongia, string maquicach, string maloai)
 {
     using (SqlCommand cmd = new SqlCommand("SP_THEMSANPHAM"))
     {
         cmd.CommandType = CommandType.StoredProcedure;
         cmd.Parameters.Add("@MASP", SqlDbType.Char).Value      = masp;
         cmd.Parameters.Add("@TENSP", SqlDbType.Char).Value     = tensp;
         cmd.Parameters.Add("@DONGIA", SqlDbType.Float).Value   = dongia;
         cmd.Parameters.Add("@MAQUICACH", SqlDbType.Char).Value = maquicach;
         cmd.Parameters.Add("@MALOAI", SqlDbType.Char).Value    = maloai;
         try
         {
             CDATABASE.ThucThiLenh(cmd);
             DevExpress.XtraEditors.XtraMessageBox.Show("Thêm sản phẩm thành công!", "Thông Báo!");
         }
         catch (Exception ex)
         {
             DevExpress.XtraEditors.XtraMessageBox.Show("Lỗi!" + ex.Message, "Thông báo!");
         }
     }
 }
示例#2
0
 //Lay ma qui cach tu ten qui cach
 public string LayMaQuiCachTuTenQuiCach(string ten)
 {
     dt = CDATABASE.ExecuteBang("SELECT MAQUICACH FROM QUICACH WHERE QUICACH='" + ten + "'");
     s  = dt.Rows[0]["MAQUICACH"].ToString();
     return(s);
 }
示例#3
0
 //Lay qui cach
 public DataTable LayQuiCach()
 {
     return(CDATABASE.ExecuteBang("SELECT * FROM QUICACH"));
 }
示例#4
0
 public DataTable HienThiSPTheoLoaiSP(string tenloai)
 {
     return(CDATABASE.ExecuteBang("SELECT MASP, TENSP, DONGIA, QUICACH FROM SANPHAM A, LOAISANPHAM B, QUICACH C WHERE A.MALOAI=B.MALOAI AND A.MAQUICACH=C.MAQUICACH AND B.TENLOAI=N'" + tenloai + "'"));
 }
示例#5
0
 //CDATABASE db = new CDATABASE();
 public DataTable LaySP()
 {
     return(CDATABASE.ExecuteBang("SELECT A.MASP, TENSP, MOTASP, DONGIA, TENLOAI, QUICACH FROM  SANPHAM A, LOAISANPHAM B, QUICACH C WHERE A.MALOAI=B.MALOAI AND A.MAQUICACH=C.MAQUICACH"));
 }
示例#6
0
 //Lay ma loai san pham tu ten loai san pham
 public string LayMaLoaiTuTenLoai(string ten)
 {
     dt = CDATABASE.ExecuteBang("SELECT MALOAI FROM LOAISANPHAM WHERE TENLOAI=N'" + ten + "'");
     s  = dt.Rows[0]["MALOAI"].ToString();
     return(s);
 }
示例#7
0
 //Lay danh sach loai san pham
 public DataTable LayLoaiSP()
 {
     return(CDATABASE.ExecuteBang("SELECT * FROM LOAISANPHAM"));
 }