Esempio n. 1
0
        public ActionResult Edit(StdToolLife tblmp, int hdnpid = 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 = Convert.ToInt32(Session["UserId"]);
            string partno = tblmp.tblStdToolLife.FGCode;
            string opno   = tblmp.tblStdToolLife.OperationNo;
            string ToolNo = tblmp.tblStdToolLife.ToolNo;
            int    mid    = hdnpid;
            bool   check  = ValidationCheckForInsertion(partno, opno, ToolNo, mid);

            if (check == true)
            {
                tblStdToolLife obj = db.tblStdToolLives.Find(mid);
                obj.StdToolLife = tblmp.tblStdToolLife.StdToolLife;
                obj.OperationNo = tblmp.tblStdToolLife.OperationNo;
                obj.ModifiedOn  = DateTime.Now;;
                obj.ModifiedBy  = UserID;
                obj.FGCode      = tblmp.tblStdToolLife.FGCode;
                obj.ToolNo      = tblmp.tblStdToolLife.ToolNo;
                obj.ToolName    = tblmp.tblStdToolLife.ToolName;
                obj.CTCode      = tblmp.tblStdToolLife.CTCode;
                db.SaveChanges();
            }
            return(RedirectToAction("Index"));
        }
Esempio n. 2
0
        // GET: ToolLifeManagement
        public ActionResult Index()
        {
            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();

            StdToolLife           STL      = new StdToolLife();
            tblStdToolLife        tstl     = new tblStdToolLife();
            List <tblStdToolLife> tstlList = new List <tblStdToolLife>();

            tstlList = db.tblStdToolLives.Where(m => m.IsDeleted == false).ToList();
            STL.tblStdToolLifeList = tstlList;
            return(View(STL));
        }
Esempio n. 3
0
        public ActionResult Create(StdToolLife tblstl)
        {
            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 = Convert.ToInt32(Session["UserId"]);
            string partno = tblstl.tblStdToolLife.FGCode;
            string opno   = tblstl.tblStdToolLife.OperationNo;
            string ToolNo = tblstl.tblStdToolLife.ToolNo;
            bool   check  = ValidationCheckForInsertion(partno, opno, ToolNo);

            if (check == true)
            {
                tblstl.tblStdToolLife.CreatedOn = DateTime.Now;
                tblstl.tblStdToolLife.CreatedBy = UserID;
                tblstl.tblStdToolLife.IsDeleted = false;
                db.tblStdToolLives.Add(tblstl.tblStdToolLife);
                db.SaveChanges();
            }
            return(RedirectToAction("Index"));
        }