public bool ValidarSKUSHD(DataTable dt) { List <hd_skushomedelivery> listaSKUSHD = new List <hd_skushomedelivery>(); List <hd_skushomedelivery> listabusauqeda = db.hd_skushomedelivery.ToList(); List <skus> listabusquedasku = db.skus.ToList(); foreach (DataRow row in dt.Rows) { string sku = row[0].ToString().Trim().ToUpper(); var busquedaskuhd = listabusauqeda.Where(x => x.skus.codigobarras == sku).FirstOrDefault(); if (busquedaskuhd == null) { int idskuhd = listabusquedasku.Where(x => x.codigobarras == sku).FirstOrDefault().id; var skusinagregar = listaSKUSHD.Where(x => x.skus_Id == idskuhd).FirstOrDefault(); if (skusinagregar == null) { hd_skushomedelivery hd_sku = new hd_skushomedelivery(); hd_sku.QRCode = false; hd_sku.QtyManual = false; hd_sku.skus_Id = idskuhd; listaSKUSHD.Add(hd_sku); } } } db.hd_skushomedelivery.AddRange(listaSKUSHD); db.SaveChanges(); return(true); }
public async Task AgregarSKUSHDDesdeSKUS() { await Task.Run(() => { DB_A3F19C_producccionEntities dbSKUS = new DB_A3F19C_producccionEntities(); var skus = dbSKUS.skus.ToList(); List <hd_skushomedelivery> lista = new List <hd_skushomedelivery>(); foreach (var item in skus) { var skumaster = dbSKUS.hd_skushomedelivery.Where(x => x.skus_Id.Equals(item.id)).FirstOrDefault(); if (skumaster == null) { hd_skushomedelivery wh = new hd_skushomedelivery(); wh.QtyManual = false; wh.QRCode = false; wh.skus_Id = item.id; lista.Add(wh); } } dbSKUS.hd_skushomedelivery.AddRange(lista); dbSKUS.SaveChangesAsync(); }); }
public ActionResult DeleteConfirmed(long id) { hd_skushomedelivery hd_skushomedelivery = db.hd_skushomedelivery.Find(id); db.hd_skushomedelivery.Remove(hd_skushomedelivery); db.SaveChanges(); return(RedirectToAction("Index")); }
// GET: hd_skushomedelivery/Details/5 public ActionResult Details(long?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } hd_skushomedelivery hd_skushomedelivery = db.hd_skushomedelivery.Find(id); if (hd_skushomedelivery == null) { return(HttpNotFound()); } return(View(hd_skushomedelivery)); }
public ActionResult Edit(hd_skushomedelivery hd_skushomedelivery) { hd_skushomedelivery.QRCode = hd_skushomedelivery.QrCodeValor; hd_skushomedelivery.QtyManual = hd_skushomedelivery.QtyManualValor; if (ModelState.IsValid) { db.Entry(hd_skushomedelivery).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.skus_Id = new SelectList(db.skus, "id", "SKU", hd_skushomedelivery.skus_Id); return(View(hd_skushomedelivery)); }
public ActionResult Create(hd_skushomedelivery hd_skushomedelivery) { hd_skushomedelivery.QRCode = hd_skushomedelivery.QrCodeValor; hd_skushomedelivery.QtyManual = hd_skushomedelivery.QtyManualValor; if (ModelState.IsValid) { db.hd_skushomedelivery.Add(hd_skushomedelivery); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.skus_Id = new SelectList(db.skus, "id", "SKU", hd_skushomedelivery.skus_Id); return(View(hd_skushomedelivery)); }
// GET: hd_skushomedelivery/Edit/5 public ActionResult Edit(long?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } hd_skushomedelivery hd_skushomedelivery = db.hd_skushomedelivery.Find(id); hd_skushomedelivery.QrCodeValor = (bool)hd_skushomedelivery.QRCode; hd_skushomedelivery.QtyManualValor = (bool)hd_skushomedelivery.QtyManual; if (hd_skushomedelivery == null) { return(HttpNotFound()); } ViewBag.skus_Id = new SelectList(db.skus, "id", "SKU", hd_skushomedelivery.skus_Id); return(View(hd_skushomedelivery)); }
// GET: hd_skushomedelivery public ActionResult Index() { var hd_skushomedelivery = db.hd_skushomedelivery.Include(h => h.skus).ToList(); List <hd_skushomedelivery> lista = new List <hd_skushomedelivery>(); foreach (var item in hd_skushomedelivery) { hd_skushomedelivery hd_s = new hd_skushomedelivery(); hd_s.Id = item.Id; hd_s.QrCodeValor = (bool)item.QRCode; hd_s.QtyManualValor = (bool)item.QtyManual; hd_s.skus = item.skus; lista.Add(hd_s); } return(View(lista)); }