コード例 #1
0
        public ActionResult Edit(PartsManagement 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.MasterParts.FGCode;
            string opno   = tblmp.MasterParts.OperationNo;
            int    mid    = hdnpid;
            bool   check  = ValidationCheckForInsertion(partno, opno, mid);

            if (check == true)
            {
                var item = db.tblparts.Find(mid);
                item.FGCode         = partno;
                item.OperationNo    = opno;
                item.IdealCycleTime = tblmp.MasterParts.IdealCycleTime;
                item.StdMinorLoss   = tblmp.MasterParts.StdMinorLoss;
                item.UnitDesc       = tblmp.MasterParts.UnitDesc;
                db.SaveChanges();
            }
            ViewBag.Unit = new SelectList(db.tblunits.Where(p => p.IsDeleted == 0), "U_ID", "UnitDesc");
            return(RedirectToAction("Index"));
        }
コード例 #2
0
        // GET: PartsManagement
        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();

            PartsManagement PM     = new PartsManagement();
            tblpart         mp     = new tblpart();
            List <tblpart>  mplist = new List <tblpart>();

            PM.MasterParts     = mp;
            mplist             = db.tblparts.Where(m => m.IsDeleted == 0).ToList();
            PM.MasterPartsList = mplist;
            ViewBag.Unit       = new SelectList(db.tblunits.Where(p => p.IsDeleted == 0), "U_ID", "UnitDesc");
            // ViewData["txtShow"] = "";
            //ViewBag.text = "";
            return(View(PM));
        }
コード例 #3
0
        public ActionResult Create(PartsManagement tblmp)
        {
            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.MasterParts.FGCode;
            string opno   = tblmp.MasterParts.OperationNo;
            bool   check  = ValidationCheckForInsertion(partno, opno);

            if (check == true)
            {
                tblmp.MasterParts.CreatedOn = DateTime.Now;
                tblmp.MasterParts.CreatedBy = UserID;
                tblmp.MasterParts.IsDeleted = 0;
                db.tblparts.Add(tblmp.MasterParts);
                db.SaveChanges();
            }
            ViewBag.Unit = new SelectList(db.tblunits.Where(p => p.IsDeleted == 0), "U_ID", "UnitDesc");
            return(RedirectToAction("Index"));
        }