public ActionResult Chonhang(FormCollection collection) { Phieunhap ddh = new Phieunhap(); Nhanvien nv = (Nhanvien)Session["Taikhoan"]; List <Nhap> gh = Layds(); ddh.NhanVien = nv.MaNV; ddh.Ngaylap = DateTime.Now; kho.Phieunhaps.InsertOnSubmit(ddh); kho.SubmitChanges(); foreach (var item in gh) { CTPHIEUNHAP ctpx = new CTPHIEUNHAP(); ctpx.Manhap = ddh.MaNhap; ctpx.MaMH = item.iMaMH; ctpx.SoluongNhap = item.iSoluong; ctpx.Gianhap = item.dDonggia; ctpx.Tongtien = item.dThanhtien; kho.CTPHIEUNHAPs.InsertOnSubmit(ctpx); //ctdh.Masach = item.iMasach; //ctdh.Soluong = item.iSoluong; //ctdh.Dongia = (decimal)item.dDonggia; //data.CTDATHANGs.InsertOnSubmit(ctdh); } kho.SubmitChanges(); Session["Nhap"] = null; return(RedirectToAction("Xacnhan", "Nhap")); }
public bool Them_NL(Phieunhap pn) { string query = $"Insert into Nguyenlieu(MaNL, tenNL,donvitinh) values(N'{pn._manl}',N'{pn._tennl}',N'{pn._donvitinh}')"; Load_DB(query); return(true); }
public bool Sua_PN(Phieunhap pn) { string query = $"update Phieunhap set Manhap=N'{pn._manhap}', MaNV=N'{pn._manv}',ngaynhap=N'{pn._ngaynhap}' Where Manhap=N'{pn._manhap}' "; Load_DB(query); return(true); }
public bool Sua_NL(Phieunhap pn) { string query = $"update Nguyenlieu set MaNL=N'{pn._manl}', tenNL=N'{pn._tennl}',donvitinh=N'{pn._donvitinh}' Where MaNL=N'{pn._manl}' "; Load_DB(query); return(true); }
public bool Them_NVK(Phieunhap pn) { string query = $"Insert into Nhanvien(MaNV, tennv,soDT) values(N'{pn._manv}',N'{pn._tennv}',N'{pn._soDT}')"; Load_DB(query); return(true); }
public bool Sua_NVK(Phieunhap pn) { string query = $"update Nhanvien set MaNV=N'{pn._manv}', tennv=N'{pn._tennv}',soDT=N'{pn._soDT}' Where MaNV=N'{pn._manv}' "; Load_DB(query); return(true); }
public bool addSach(Phieunhap phieunhap,CTPN[] ctpn) { try {//phieunhap.NgayNhap = DateTime.Today; NoNXB no = new NoNXB(); Kho kho = new Kho(); //tao dl ao no.NgayNhap = phieunhap.NgayNhap; no.IdNXB = phieunhap.IdNXB; kho.NgayGhi = phieunhap.NgayNhap; foreach (var i in ctpn) //code ctpn in here { Sach sach = db.Saches.Find(i.IdSach); kho.IdSach = sach.IdSach; kho.SL = i.SoLuong; no.TienNo = i.SoLuong * sach.GiaNhap; UpdateNo(no); UpdateKho(kho); phieunhap.CTPNs.Add(i); db.SaveChanges(); } db.Phieunhaps.Add(phieunhap); db.SaveChanges(); return true; } catch (Exception ex) { return false; } }
public bool Them_PN(Phieunhap pn) { string query = $"Insert into Phieunhap(Manhap, MaNV,ngaynhap) values(N'{pn._manhap}',N'{pn._manv}',N'{pn._ngaynhap}')"; Load_DB(query); return(true); }
public ActionResult DeleteConfirmed(string id) { Phieunhap phieunhap = db.Phieunhaps.Find(id); db.Phieunhaps.Remove(phieunhap); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "Maphieunhap,Ngaytao,MaNCC")] Phieunhap phieunhap) { if (ModelState.IsValid) { db.Entry(phieunhap).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.MaNCC = new SelectList(db.NhaCCs, "MaNCC", "TenNCC", phieunhap.MaNCC); return(View(phieunhap)); }
public ActionResult Edit([Bind(Include = "IdPn,NgayNhap,NguoiGiao,IdNXB,NguoiNhan")] Phieunhap phieunhap) { if (ModelState.IsValid) { db.Entry(phieunhap).State = System.Data.Entity.EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.IdNXB = new SelectList(db.NXBs, "IdNXB", "TenNXB", phieunhap.IdNXB); return(View(phieunhap)); }
public ActionResult Create([Bind(Include = "Maphieunhap,Ngaytao,MaNCC")] Phieunhap phieunhap) { if (ModelState.IsValid) { db.Phieunhaps.Add(phieunhap); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.MaNCC = new SelectList(db.NhaCCs, "MaNCC", "TenNCC", phieunhap.MaNCC); return(View(phieunhap)); }
// GET: Phieunhaps/Details/5 public ActionResult Details(string id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Phieunhap phieunhap = db.Phieunhaps.Find(id); if (phieunhap == null) { return(HttpNotFound()); } return(View(phieunhap)); }
public ActionResult Create([Bind(Include = "IdPn,NgayNhap,NguoiGiao,IdNXB,NguoiNhan")] Phieunhap phieunhap , [Bind(Prefix = "ct")] CTPN[] ctpn) { if (ModelState.IsValid) { if (bus.addSach(phieunhap, ctpn)) { return(RedirectToAction("Index")); } } ViewBag.IdNXB = new SelectList(db.NXBs, "IdNXB", "TenNXB", phieunhap.IdNXB); return(View(phieunhap)); }
public async Task <IActionResult> OnGetAsync(int?id) { if (id == null) { return(NotFound()); } Phieunhap = await _context.Phieunhap.FirstOrDefaultAsync(m => m.ID == id); if (Phieunhap == null) { return(NotFound()); } return(Page()); }
// GET: Phieunhaps/Edit/5 public ActionResult Edit(string id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Phieunhap phieunhap = db.Phieunhaps.Find(id); if (phieunhap == null) { return(HttpNotFound()); } ViewBag.MaNCC = new SelectList(db.NhaCCs, "MaNCC", "TenNCC", phieunhap.MaNCC); return(View(phieunhap)); }
// GET: Phieunhaps/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Phieunhap phieunhap = db.Phieunhaps.Find(id); if (phieunhap == null) { return(HttpNotFound()); } ViewBag.IdNXB = new SelectList(db.NXBs, "IdNXB", "TenNXB", phieunhap.IdNXB); return(View(phieunhap)); }
public async Task <IActionResult> OnPostAsync(int?id) { if (id == null) { return(NotFound()); } Phieunhap = await _context.Phieunhap.FindAsync(id); if (Phieunhap != null) { _context.Phieunhap.Remove(Phieunhap); await _context.SaveChangesAsync(); } return(RedirectToPage("./Index")); }
public bool Them_NVK(Phieunhap pn) { return(dal.Them_NVK(pn)); }
public bool Sua_NVK(Phieunhap pn) { return(dal.Sua_NVK(pn)); }
public bool Them_PN(Phieunhap pn) { return(dal.Them_PN(pn)); }
public bool Sua_PN(Phieunhap pn) { return(dal.Sua_PN(pn)); }
public ActionResult Create(FormCollection collection, Phieunhap pn) { kho.Phieunhaps.InsertOnSubmit(pn); kho.SubmitChanges(); return(RedirectToAction("Index", "Phieunhap")); }
public bool Them_NL(Phieunhap nl) { return(dal.Them_NL(nl)); }