Example #1
0
        //Gettimg Machine category list
        public ActionResult CellsList()
        {
            if ((Session["UserId"] == null) || (Session["UserId"].ToString() == String.Empty))
            {
                return(RedirectToAction("Login", "Login", null));
            }
            ViewBag.plant = new SelectList(db.tblplants.Where(p => p.IsDeleted == 0), "PlantID", "PlantName").ToList();
            ViewBag.shop  = new SelectList(db.tblshops.Where(d => d.IsDeleted == 0), "ShopId", "ShopName").ToList();
            CellsModel pa = new CellsModel();
            tblcell    mp = new tblcell();

            pa.Cells     = mp;
            pa.cellslist = db.tblcells.Where(m => m.IsDeleted == 0).ToList();
            return(View(pa));
            //var MachineCategory = db.mastermachinecategory_tbl.Where(x => x.IsDeleted == 0).ToList();
            //return View(MachineCategory);
        }
Example #2
0
        public ActionResult EditCellDetails(CellsModel objcell, int shop = 0, int Plant = 0)
        {
            if ((Session["UserId"] == null) || (Session["UserId"].ToString() == String.Empty))
            {
                return(RedirectToAction("Login", "Login", null));
            }
            ViewBag.Logout = Session["Username"].ToString().ToUpper();
            ViewBag.roleid = Session["RoleID"];
            String Username = Session["Username"].ToString();
            int    UserID   = Convert.ToInt32(Session["UserID"]);
            //Cell name validation
            string cellname = objcell.Cells.CellName.ToString();
            int    cellid   = objcell.Cells.CellID;

            using (i_facility_shaktiEntities1 db = new i_facility_shaktiEntities1())
            {
                var doesThisdeptExists = db.tblcells.Where(m => m.IsDeleted == 0 && m.PlantID == Plant && m.ShopID == shop && m.CellName == cellname && m.CellID != cellid).ToList();
                if (doesThisdeptExists.Count == 0)
                {
                    var objCell = db.tblcells.Find(objcell.Cells.CellID);

                    objCell.PlantID         = Plant;
                    objCell.ShopID          = shop;
                    objCell.CellName        = objcell.Cells.CellName;
                    objCell.CellDesc        = objcell.Cells.CellDesc;
                    objCell.CelldisplayName = objcell.Cells.CelldisplayName;
                    db.Entry(objCell).State = EntityState.Modified;
                    db.SaveChanges();
                    return(RedirectToAction("CellsList"));
                }
                else
                {
                    ViewBag.Plant        = new SelectList(db.tblplants.Where(m => m.IsDeleted == 0), "PlantID", "PlantName", objcell.Cells.PlantID).ToList();
                    ViewBag.DepartmentID = new SelectList(db.tblshops.Where(m => m.IsDeleted == 0), "DepartmentID", "DepartmentDisplayName", objcell.Cells.ShopID).ToList();
                    Session["Error"]     = "Machine Name" + " " + objcell.Cells + " " + "already exists for this Department.";
                    return(View(objcell));
                }
            }
        }
Example #3
0
        public ActionResult CreateCells(CellsModel tblp, int shop = 0, int Plant = 0)
        {
            if ((Session["UserId"] == null) || (Session["UserId"].ToString() == String.Empty))
            {
                return(RedirectToAction("Login", "Login", null));
            }
            ViewBag.Logout = Session["Username"].ToString().ToUpper();
            ViewBag.roleid = Session["RoleID"];
            int UserID = 1; //Convert.ToInt32(Session["UserId"]);
            //Cell name validation
            string cellname = tblp.Cells.ToString();
            // var shop= tblp.Cells.ShopID;
            var PlantId = tblp.Cells.PlantID;

            using (i_facility_shaktiEntities1 db = new i_facility_shaktiEntities1())
            {
                var doesThisShopExists = db.tblcells.Where(m => m.IsDeleted == 0 && m.PlantID == Plant && m.ShopID == shop && m.CellName == cellname).ToList();
                if (doesThisShopExists.Count == 0)
                {
                    tblp.Cells.CreatedBy = UserID;
                    tblp.Cells.CreatedOn = DateTime.Now;
                    tblp.Cells.ShopID    = shop;
                    tblp.Cells.PlantID   = PlantId;
                    tblp.Cells.IsDeleted = 0;
                    db.tblcells.Add(tblp.Cells);
                    db.SaveChanges();
                    return(RedirectToAction("CellsList"));
                }
                else
                {
                    ViewBag.Plant    = new SelectList(db.tblplants.Where(m => m.IsDeleted == 0), "PlantID", "PlantName", Plant);
                    ViewBag.Shop     = new SelectList(db.tblshops.Where(m => m.IsDeleted == 0), "ShopId", "ShopName", shop);
                    Session["Error"] = "Machine Name" + " " + tblp.Cells + " " + " already exists for this Plant/Department.";
                    return(View(tblp));
                }
            }
        }
Example #4
0
 // Start is called before the first frame update
 void Start()
 {
     _cellsModel = GetComponent <CellsModel>();
     _cellsView  = GetComponent <CellsView>();
 }