protected void copy_ServerClick(object sender, EventArgs e) { var bid = (sender as HtmlInputButton).Attributes["match"].GlobalId(); var bidx = DataContext.GlobalId(); foreach (var item in DataContext.DepotCheck.Where(o => o.BatchId == bid).ToList()) { var jsons = item.CodeJson.FromJson<List<InMemoryCheck>>(); jsons.ForEach(o => { o.In = false; }); var itemx = new DepotCheck { BatchId = bidx, BatchOrdinal = item.BatchOrdinal, CodeJson = jsons.ToJson(), DepotId = item.DepotId, Name = item.Name, State = 1, Time = DateTime.Now }; DataContext.DepotCheck.Add(itemx); } DataContext.SaveChanges(); view.Rebind(); }
protected void coding_ServerClick(object sender, EventArgs e) { if (cName.Text.Trim().None()) { NotifyError(ap, "请输入盘库任务的名称"); return; } var codes = ____v.InnerText.FromJson<List<InMemoryCheck>>(); if (codes.Count == 0) { NotifyError(ap, "请选择要盘库的物资"); return; } var bid = DataContext.GlobalId(); var bo = 0; var bt = DateTime.Now; for (var i = 0; i <= codes.Count / 20; i++) { bo++; var dc = new DepotCheck { DepotId = Depot.Id, BatchId = bid, BatchOrdinal = bo, Name = cName.Text.Trim(), CodeJson = codes.Skip(i * 20).Take(20).ToList().ToJson(), Time = bt, State = 1 }; DataContext.DepotCheck.Add(dc); } DataContext.SaveChanges(); Response.Redirect("~/DepotScan/CheckList?DepotId={0}".Formatted(Depot.Id)); }
protected void coding_ServerClick(object sender, EventArgs e) { if (cName.Text.None()) { NotifyError(ap, "请输入盘库任务的名称"); return; } var codes = new List<InMemoryCheck>(); view.Items.ForEach(o => { var inner = o.FindControl("viewx") as RadListView; var h = o.FindControl("h") as HtmlInputHidden; if (inner.Items.Count > 0) { inner.Items.ForEach(i => { var cbi = i.FindControl("checkx") as CheckBox; var lbl = i.FindControl("lbl") as Label; if (cbi.Checked) { codes.Add(new InMemoryCheck { Code = cbi.Attributes["CC"], In = false, Name = h.Value, Ordinal = int.Parse(cbi.Attributes["ORD"]), Place = lbl.Text }); } }); } }); if (codes.Count == 0) { NotifyError(ap, "请选择要盘库的物资"); return; } var bid = DataContext.GlobalId(); var bo = 0; var bt = DateTime.Now; for (var i = 0; i <= codes.Count / 40; i++) { bo++; var dc = new DepotCheck { DepotId = Depot.Id, BatchId = bid, BatchOrdinal = bo, Name = cName.Text.Trim(), CodeJson = codes.Skip(i * 40).Take(40).ToList().ToJson(), Time = bt, State = 1 }; DataContext.DepotCheck.Add(dc); } DataContext.SaveChanges(); Response.Redirect("~/DepotScan/CheckList?DepotId={0}".Formatted(Depot.Id)); }