コード例 #1
0
        public ActionResult Index()
        {
            /* Check so that you are logged in
             * and not trying to reach this the wrong way */

            if (Session["user"] == null)
            {
                return(RedirectToAction("Index", "Home"));
            }
            else
            {
                loggedInUser user = Session["user"] as loggedInUser;

                //Check so the user is the correct userlevel to access admin
                if (user.userlevel != "rst")
                {
                    return(RedirectToAction("Index", user.lastView));
                }

                //If there is an Errortext return the ErrorView
                if (user.errorText != "")
                {
                    ViewBag.errorText = user.errorText;
                    user.errorText    = "";
                    return(View("ErrorView"));
                }

                user.lastView = "Admin";
                user.updateShift();
                user.selectSetting.Machno = user.Machno;
                ViewBag.procFunc          = user.selectSetting.makeDistinctProcFunc();
                return(View(user.selectSetting));
            }
        }
コード例 #2
0
        public ActionResult DDSFreq()
        {
            /* Check so that you are logged in
             * and not trying to reach this the wrong way */

            if (Session["user"] == null)
            {
                return(RedirectToAction("Index", "Home"));
            }
            else
            {
                loggedInUser user = Session["user"] as loggedInUser;

                //Check so the user is the correct userlevel to access admin
                if (user.userlevel != "rst")
                {
                    return(RedirectToAction("Index", user.lastView));
                }

                //If there is an Errortext return the ErrorView
                if (user.errorText != "")
                {
                    ViewBag.errorText = user.errorText;
                    user.errorText    = "";
                    return(View("ErrorView"));
                }

                user.lastView = "Admin";
                user.updateShift();
                var allActiveMachineSettings = new SettingFrequensFunctions();
                return(View(allActiveMachineSettings.getAllConnections(user.Machno)));
            }
        }
コード例 #3
0
        public ActionResult Index()
        {
            /* Check so that you are logged in
             * and not trying to reach this the wrong way */

            if (Session["user"] == null)
            {
                return(RedirectToAction("Index", "Home"));
            }
            else
            {
                loggedInUser user = Session["user"] as loggedInUser;

                //If there is an Errortext return the ErrorView
                if (user.errorText != "")
                {
                    ViewBag.errorText = user.errorText;
                    user.errorText    = "";
                    return(View("ErrorView"));
                }

                user.lastView = "DDS";
                user.updateShift();
                dds.updateDDS(user.Machno, user.selShift.shiftno);
                if (dds.DDSDone.Count() != 0)
                {
                    ViewData["DDSDone"] = dds.DDSDone;
                }
                return(View(dds.DDSTodo));
            }
        }
コード例 #4
0
        //First page
        public ActionResult Index()
        {
            //Already logged in, show View
            if (Session["user"] != null)
            {
                loggedInUser user = (Session["user"]) as loggedInUser;
                if (user.errorText != "")
                {
                    ViewBag.errorText = user.errorText;
                    user.errorText    = "";
                    return(View("ErrorView"));
                }
                user.updateShift();
                s5Func.update5S(user);
                user.lastView = "Home";
                ViewBag.tot   = s5Func.numTodo + s5Func.numDone;
                ViewBag.done  = s5Func.numDone;
                return(View(user));
            }

            //Get windows user and check database if that user is allowed to login
            string winuser = System.Environment.UserName;
            var    myUser  = (from u in context.myuser where u.winuser == winuser select u).FirstOrDefault();

            //Setup the user
            if (myUser != null)
            {
                loggedInUser user = new loggedInUser(myUser);
                Session["user"] = user;
                MachinePartialView();
                s5Func.update5S(user);
                if (user.errorText != "")
                {
                    ViewBag.errorText = user.errorText;
                    return(View("ErrorView"));
                }
                ViewBag.tot  = s5Func.numTodo + s5Func.numDone;
                ViewBag.done = s5Func.numDone;
                return(View(user));
            }

            //If you where not authurized to login on that computer, send error View.
            ViewBag.errorText = "You are not authorized to login in and/or the user database is inaccessable";
            return(View("ErrorView"));
        }