public static LabelSet TransferByGenAndKill(LabelSet X, GenSet gen, KillSet kill) { if (X == null) { return(ToLabelSet(gen)); } return(new LabelSet(X.Except(ToLabelSet(kill)).Union(ToLabelSet(gen)))); }
public ActionResult Edit([Bind(Include = "GenSetID,SiteID,Serial,UnitID,Capacity,StatusID,DateDelivered,DateInstalled,ACLoading,Remarks,UpdateDate")] GenSet genSet) { if (ModelState.IsValid) { db.Entry(genSet).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("GetDetails", "Inventories", new { id = genSet.SiteID })); } ViewBag.SiteID = new SelectList(db.Sites, "SiteID", "SiteFullName", genSet.SiteID); ViewBag.UnitID = new SelectList(db.Units.Where(u => u.Category == "GenSet"), "UnitID", "BrandModel", genSet.UnitID); ViewBag.StatusID = new SelectList(db.UnitStatus, "StatusID", "Status", genSet.StatusID); return(View(genSet)); }
// GET: GenSets/Delete/5 public ActionResult Delete(int?gid) { if (gid == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } GenSet genSet = db.GenSets.Find(gid); if (genSet == null) { return(HttpNotFound()); } return(View(genSet)); }
public static KillSet GetKillSet(GenSet bblock, List <GenSet> others) { var ret = new KillSet(); foreach (var oblock in others) { foreach (var def in bblock) { if (oblock.ContainsKey(def.Key)) { ret[oblock[def.Key]] = def.Key; } } } return(ret); }
public static GenSet GetGenSet(BaseBlock bblock) { var ret = new GenSet(); foreach (var line in bblock.Code.AsEnumerable().Reverse()) { if (ThreeAddrOpType.IsDefinition(line.OpType)) { if (!ret.ContainsKey(line.Accum)) { ret[line.Accum] = int.Parse(line.Label); } } } return(ret); }
public ActionResult Create([Bind(Include = "GenSetID,SiteID,Serial,UnitID,Capacity,StatusID,DateDelivered,DateInstalled,ACLoading,Remarks,UpdateDate")] GenSet genSet) { var sid = (int)Session["siteid"]; ViewBag.SiteCode = sid; if (ModelState.IsValid) { db.GenSets.Add(genSet); db.SaveChanges(); return(RedirectToAction("GetDetails", "Inventories", new { id = sid })); } ViewBag.SiteID = new SelectList(db.Sites.Where(s => s.SiteID == sid), "SiteID", "SiteFullName", genSet.SiteID); ViewBag.UnitID = new SelectList(db.Units.Where(u => u.Category == "GenSet"), "UnitID", "BrandModel", genSet.UnitID); ViewBag.StatusID = new SelectList(db.UnitStatus, "StatusID", "Status", genSet.StatusID); return(View(genSet)); }
// GET: GenSets/Edit/5 public ActionResult Edit(int?gid) { if (gid == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } GenSet genSet = db.GenSets.Find(gid); if (genSet == null) { return(HttpNotFound()); } ViewBag.SiteID = new SelectList(db.Sites, "SiteID", "SiteFullName", genSet.SiteID); ViewBag.UnitID = new SelectList(db.Units.Where(u => u.Category == "GenSet"), "UnitID", "BrandModel", genSet.UnitID); ViewBag.StatusID = new SelectList(db.UnitStatus, "StatusID", "Status", genSet.StatusID); return(View(genSet)); }
public ActionResult DeleteConfirmed(int gid) { GenSet genSet = db.GenSets.Find(gid); Session["UnitID"] = genSet.UnitID; Session["Serial"] = genSet.Serial; Site site = db.Sites.Find(genSet.SiteID); Session["SiteID"] = site.SiteCode; Session["SiteName"] = site.SiteName; SiteDetail siteDetail = db.SiteDetails.Find(genSet.SiteID); Session["Cluster"] = siteDetail.ClusterID; Session["Address"] = siteDetail.HouseLotNo; Employee employee = db.Employees.Find(siteDetail.EmployeeNo); db.GenSets.Remove(genSet); db.SaveChanges(); return(RedirectToAction("Create", "ArdaItems", new { id = genSet.UnitID })); }
public static LabelSet ToLabelSet(GenSet s) { return(new LabelSet(s.Select(kp => kp.Value))); }