Пример #1
0
 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))));
 }
Пример #2
0
        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));
        }
Пример #3
0
        // 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));
        }
Пример #4
0
        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);
        }
Пример #5
0
        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);
        }
Пример #6
0
        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));
        }
Пример #7
0
        // 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));
        }
Пример #8
0
        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 }));
        }
Пример #9
0
 public static LabelSet ToLabelSet(GenSet s)
 {
     return(new LabelSet(s.Select(kp => kp.Value)));
 }