public void add_Discount(promotion_dto getJsonResults)
        {
            SqlParameter[] parm = new SqlParameter[]
            {
                new SqlParameter("@maSanPham", SqlDbType.NVarChar, 50),
                new SqlParameter("@phantram", SqlDbType.Int),
                new SqlParameter("@ngayApDung", SqlDbType.DateTime),
                new SqlParameter("@ngayKetThuc", SqlDbType.DateTime),
            };

            parm[0].Value = getJsonResults.maSanPham;
            parm[1].Value = getJsonResults.percent;
            parm[2].Value = DateTime.Parse(getJsonResults.batDau.ToString());
            parm[3].Value = DateTime.Parse(getJsonResults.ketThuc.ToString());

            DataAccessHelper.ExecuteNonQuery(DataAccessHelper.ConnectionString, CommandType.StoredProcedure, "addDiscount", parm);
        }
        public object getDiscount(string page)
        {
            DataTable dt  = new DataTable();
            string    sql = string.Format(@"select gg.*,sp.tensanpham from gia_giam gg,san_pham sp  where
			 gg.masanpham=sp.MaSanPham
                            order by magiagiam ASC Offset 10 * ({0} - 1) Rows Fetch next 10 rows only", page);

            dt = DataAccessHelper.log(sql);
            IList <promotion_dto> li = new List <promotion_dto>();

            foreach (DataRow dr in dt.Rows)
            {
                promotion_dto or = new promotion_dto();
                // tên số lượng giá bán thành tiền ngày mua
                or.maGiaGiam  = dr[0].ToString();
                or.maSanPham  = dr[1].ToString();
                or.percent    = int.Parse(dr[2].ToString());
                or.batDau     = DateTime.Parse(dr[3].ToString());
                or.ketThuc    = DateTime.Parse(dr[4].ToString());
                or.tenSanPham = dr[5].ToString();
                li.Add(or);
            }
            return(li);
        }
 public void add_Discount(promotion_dto getJsonResults)
 {
     ad.add_Discount(getJsonResults);
 }