Beispiel #1
0
        public async Task <IHttpActionResult> PutChiTietNhapHang(int id, ChiTietNhapHang chiTietNhapHang)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != chiTietNhapHang.id)
            {
                return(BadRequest());
            }

            db.Entry(chiTietNhapHang).State = EntityState.Modified;

            try
            {
                await db.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!ChiTietNhapHangExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
Beispiel #2
0
 public ActionResult UpdateChiTietNhapHang(ChiTietNhapHang chiTietNhapHang)
 {
     if (chiTietNhapHang == null)
     {
         return(BadRequest());
     }
     _repository.UpdateChiTietNhapHangAsync(chiTietNhapHang);
     return(Ok("Update ChiTietNhapHang Successful!"));
 }
Beispiel #3
0
 public int UpdateQuantity(ChiTietNhapHang obj)
 {
     SqlParameter[] param =
     {
         new SqlParameter("IDNhapHang", obj.IDNhapHang),
         new SqlParameter("IDSanPham",  obj.IDSanPham),
         new SqlParameter("SoLuong",    obj.SoLuong)
     };
     return(DBConnect.Instance.ExecuteSQL("sp_ChiTietNhapHang_Update_Quantity", param));
 }
Beispiel #4
0
        public async Task <IHttpActionResult> GetChiTietNhapHang(int id)
        {
            ChiTietNhapHang chiTietNhapHang = await db.ChiTietNhapHang.FindAsync(id);

            if (chiTietNhapHang == null)
            {
                return(NotFound());
            }

            return(Ok(chiTietNhapHang));
        }
Beispiel #5
0
        public async Task <IHttpActionResult> PostChiTietNhapHang(ChiTietNhapHang chiTietNhapHang)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.ChiTietNhapHang.Add(chiTietNhapHang);
            await db.SaveChangesAsync();

            return(CreatedAtRoute("DefaultApi", new { id = chiTietNhapHang.id }, chiTietNhapHang));
        }
Beispiel #6
0
 public int Insert(ChiTietNhapHang obj)
 {
     SqlParameter[] param =
     {
         new SqlParameter("IDNhapHang",  obj.IDNhapHang),
         new SqlParameter("IDSanPham",   obj.IDSanPham),
         new SqlParameter("SoLuong",     obj.SoLuong),
         new SqlParameter("DonGia",      obj.DonGia),
         new SqlParameter("IDDonViTinh", obj.IDDonViTinh)
     };
     return(DBConnect.Instance.ExecuteSQL("sp_ChiTietNhapHang_Insert", param));
 }
Beispiel #7
0
        public async Task <IHttpActionResult> DeleteChiTietNhapHang(int id)
        {
            ChiTietNhapHang chiTietNhapHang = await db.ChiTietNhapHang.FindAsync(id);

            if (chiTietNhapHang == null)
            {
                return(NotFound());
            }

            db.ChiTietNhapHang.Remove(chiTietNhapHang);
            await db.SaveChangesAsync();

            return(Ok(chiTietNhapHang));
        }
Beispiel #8
0
 private void buttonThanhToanNhapHang_Click(object sender, EventArgs e)
 {
     if (maskedTextBoxMaPhieuNhap.Text.Length == 0)
     {
         MessageBox.Show("Chưa tạo phiếu nhập");
     }
     else
     {
         for (int i = 0; i < dataGridViewThongTinHoaDonNhapHang.Rows.Count - 1; i++)
         {
             ChiTietNhapHang a = new ChiTietNhapHang(int.Parse(maskedTextBoxMaPhieuNhap.Text), int.Parse(dataGridViewThongTinHoaDonNhapHang.Rows[i].Cells[0].Value.ToString()), int.Parse(dataGridViewThongTinHoaDonNhapHang.Rows[i].Cells[1].Value.ToString()), int.Parse(dataGridViewThongTinHoaDonNhapHang.Rows[i].Cells[2].Value.ToString()), int.Parse(dataGridViewThongTinHoaDonNhapHang.Rows[i].Cells[3].Value.ToString()));
             ctnh.Add(a);
             hh.CapNhatThemSoLuong(int.Parse(dataGridViewThongTinHoaDonNhapHang.Rows[i].Cells[0].Value.ToString()), int.Parse(dataGridViewThongTinHoaDonNhapHang.Rows[i].Cells[1].Value.ToString()));
         }
     }
 }
 public int UpdateQuantity(ChiTietNhapHang obj)
 {
     return(dao.UpdateQuantity(obj));
 }
 public int Insert(ChiTietNhapHang obj)
 {
     return(dao.Insert(obj));
 }