public void addPrice(Price_DTO pr)
        {
            SqlParameter[] parm = new SqlParameter[]
            {
                new SqlParameter("@maSanPham", SqlDbType.NVarChar, 50),
                new SqlParameter("@giaBan", SqlDbType.Int),
                new SqlParameter("@ngayApDung", SqlDbType.DateTime),
                new SqlParameter("@ngayKetThuc", SqlDbType.DateTime),
            };

            parm[0].Value = pr.maSanPham;
            parm[1].Value = pr.gia;
            parm[2].Value = DateTime.Parse(pr.ngayBatDau.ToString());
            parm[3].Value = DateTime.Parse(pr.ngayKetThuc.ToString());

            DataAccessHelper.ExecuteNonQuery(DataAccessHelper.ConnectionString, CommandType.StoredProcedure, "addPrice", parm);
        }
        public IList <Price_DTO> listgia(DataTable dt)
        {
            List <Price_DTO> li = new List <Price_DTO>();

            foreach (DataRow dr in dt.Rows)
            {
                Price_DTO pr = new Price_DTO();
                pr.maGiaBan   = dr[0].ToString();
                pr.maSanPham  = dr[1].ToString();
                pr.gia        = int.Parse(dr[2].ToString());
                pr.ngayBatDau = DateTime.Parse(dr[3].ToString());
                try { pr.ngayKetThuc = DateTime.Parse(dr[4].ToString()); }
                catch { }
                pr.tenSanPham = dr[5].ToString();
                li.Add(pr);
            }
            return(li);
        }
Beispiel #3
0
 public void editPrice(Price_DTO getJsonResults)
 {
     ad.editPrice(getJsonResults);
 }
Beispiel #4
0
 public void addPrice(Price_DTO getJsonResults)
 {
     ad.addPrice(getJsonResults);
 }