Example #1
0
 // Tìm kiếm danh sách Clothes theo nhiều trường
 public DataTable showClothesByOptions(int _c,string _ColorID, string _sizeID, string _pricemin,string _pricemax )
 {
     ConnectDB db = new ConnectDB();
     if (_c ==1)
     {   
         SqlParameter[] a = new SqlParameter[3];
         a[0] = new SqlParameter("@Top", "");
         a[1] = new SqlParameter("@where", "ColorID =" + _ColorID);
         a[2] = new SqlParameter("@order", "[Order] Desc");
         DataTable dt = db.ReturnDataTable("Clothes_SelectByTop", a);
         return dt;
     }
     if(_c==2)
     {
         SqlParameter[] a = new SqlParameter[3];
         a[0] = new SqlParameter("@Top", "");
         a[1] = new SqlParameter("@where", "SizeID =" + _sizeID);
         a[2] = new SqlParameter("@order", "[Order] Desc");
         DataTable dt = db.ReturnDataTable("Clothes_SelectByTop", a);
         return dt;
     }
     if(_c==3)
     {
         SqlParameter[] a = new SqlParameter[3];
         a[0] = new SqlParameter("@Top", "");
         a[1] = new SqlParameter("@where", "PriceOut >=" + _pricemin+" and PriceOut<="+_pricemax);
         a[2] = new SqlParameter("@order", "[Order] Desc");
         DataTable dt = db.ReturnDataTable("Clothes_SelectByTop", a);
         return dt;
     }
     return null;
 }
Example #2
0
 public static Cloth FindClothByID(string _id)
 {
     Cloth temp = new Cloth();
     temp.id = _id;
     ConnectDB db = new ConnectDB();
     SqlParameter[] a = new SqlParameter[1];
     a[0] = new SqlParameter("@ID", "" + temp.id + "");
     DataTable dt = db.ReturnDataTable("Clothes_SelectByID", a);
     DataRow dr = dt.Rows[0];
     temp.colorID = dr["ID"].ToString();
     temp.name = dr["Name"].ToString();
     temp.groupClothesID = dr["GroupClothesID"].ToString();
     temp.description = dr["Description"].ToString();
     temp.priceIn = dr["PriceIn"].ToString();
     temp.priceOut = dr["PriceOut"].ToString();
     temp.newPrice = dr["NewPrice"].ToString();
     temp.sex = dr["Sex"].ToString();
     temp.colorID = dr["ColorID"].ToString();
     temp.sizeID = dr["SizeID"].ToString();
     temp.images = dr["Images"].ToString();
     temp.materialID = dr["MaterialID"].ToString();
     temp.quantity = "1"; // Trường hợp truy vấn để thêm vào giỏ nên số lượng cần lấy là 1
     temp.order = dr["Order"].ToString();
     temp.status = dr["Status"].ToString();
     return temp;
 }
Example #3
0
 //ham khoi tao cho truong hop them Clothes vao Bag
 public Clothes(string _id)
 {
     this.ID = _id;
     ConnectDB db = new ConnectDB();
     SqlParameter[] a = new SqlParameter[1];
     a[0] = new SqlParameter("@ID", "" + this.ID + "");
     DataTable dt = db.ReturnDataTable("Clothes_SelectByID", a);
     DataRow dr = dt.Rows[0];
     this.ColorID = dr["ID"].ToString();
     this.Name = dr["Name"].ToString();
     this.GroupClothesID = dr["GroupClothesID"].ToString();
     this.Description = dr["Description"].ToString();
     this.PriceIn = dr["PriceIn"].ToString();
     this.PriceOut = dr["PriceOut"].ToString();
     this.NewPrice = dr["NewPrice"].ToString();
     this.Sex = dr["Sex"].ToString();
     this.ColorID = dr["ColorID"].ToString();
     this.SizeID = dr["SizeID"].ToString();
     this.Images = dr["Images"].ToString();
     this.MaterialID = dr["MaterialID"].ToString();
     //this.Quantity = dr["Quantity"].ToString();
     this.Quantity = "1"; // Trường hợp truy vấn để thêm vào giỏ nên để là 1
     this.Order = dr["Order"].ToString();
     this.Status = dr["Status"].ToString();
 }
Example #4
0
 public DataTable ShowDetailOrder(string ID)
 {
     ConnectDB db = new ConnectDB();
     SqlParameter[] a = new SqlParameter[1];
     a[0] = new SqlParameter("@ID", ID);
     DataTable detailOrder = db.ReturnDataTable("OrderDetail_SelectByOrderID", a);
     return detailOrder;
 }
Example #5
0
 // Hiển thị danh sách đơn đặt hàng
 public DataTable ShowListOrder()
 {
     ConnectDB db = new ConnectDB();
     SqlParameter[] a = new SqlParameter[3];
     a[0] = new SqlParameter("@Top", "");
     a[1] = new SqlParameter("@where", "Status = 1");
     a[2] = new SqlParameter("@order", "ID desc");
     DataTable dtListOrder = db.ReturnDataTable("Order_SelectByTop", a);
     return dtListOrder;
 }
Example #6
0
 // Hàm lấy danh sách sản phẩm theo nhóm sản phẩm, truyền vào nhóm sản phẩm
 public DataTable showClothesByGroup(string _groupID)
 {
     ConnectDB db = new ConnectDB();
     SqlParameter[] a = new SqlParameter[3];
     a[0] = new SqlParameter("@Top", "");
     a[1] = new SqlParameter("@where", "GroupClothesID ="+_groupID+"");
     a[2] = new SqlParameter("@order", "[Order] Desc");
     DataTable dt = db.ReturnDataTable("Clothes_SelectByTop", a);
     return dt;
 }
Example #7
0
 // Hàm lấy danh sách sản phẩm mới truyền vào số lượng sản phẩm muốn lấy
 public DataTable showNewClothes(int _sl)
 {
     ConnectDB db = new ConnectDB();
     SqlParameter[] a = new SqlParameter[3];
     a[0] = new SqlParameter("@Top", ""+_sl+"");
     a[1] = new SqlParameter("@where", "status =1 and New = 1");
     a[2] = new SqlParameter("@order", "[Order] Desc");
     DataTable dt = db.ReturnDataTable("Clothes_SelectByTop", a);
     return dt;
 }
Example #8
0
 public DataTable ShowDetail()
 {
     ConnectDB db = new ConnectDB();
     SqlParameter[] a = new SqlParameter[1];
     a[0] = new SqlParameter("@ID", "" + this.id + "");
     DataTable dtClothDetail = db.ReturnDataTable("Clothes_SelectByID", a);
     return dtClothDetail;
 }
Example #9
0
 public DataTable ShowDetail(string ID)
 {
     ConnectDB db = new ConnectDB();
     SqlParameter[] a = new SqlParameter[1];
     a[0] = new SqlParameter("@ID", ID);
     DataTable detailCustomer = db.ReturnDataTable("Customer_SelectByID", a);
     return detailCustomer;
 }
Example #10
0
 // Hàm lấy danh sách nhóm sản phẩm, truyền vào số lượng cần lấy
 public DataTable ShowGroup(int _sl)
 {
     ConnectDB db = new ConnectDB();
     SqlParameter[] a = new SqlParameter[3];
     a[0] = new SqlParameter("@Top", "" + _sl + "");
     a[1] = new SqlParameter("@where", "");
     a[2] = new SqlParameter("@order", "");
     DataTable dt = db.ReturnDataTable("GroupClothes_SelectByTop", a);
     return dt;
 }