Пример #1
0
        public ActionResult Reset(int DockingID, int LocationID)
        {
            int UserID = GetLoggedInUID();


            Location loc  = _repo.GetLocation(LocationID);
            Docking  dock = _repo.GetDockingByID(DockingID);


            bool rslt = false;

            if (dock.IsActive == true && loc.IsOcuppied == true)
            {
                loc.IsOcuppied = false;
                loc.LastUpdate = DateTime.Now.ConvertToEST();

                dock.IsActive     = false;
                dock.LastUpdate   = DateTime.Now.ConvertToEST();
                dock.LastUpdateBy = UserID;

                rslt = _repo.UpdateLocationDock(loc, dock);
            }

            return(Json(Url.Action("GetTimerList", "Admin")));
        }
Пример #2
0
        public ActionResult EndFreeze(FreezeDownViewModel fdvm)
        {
            try
            {
                User user = new User()
                {
                    UserName = fdvm.UserName,
                    Password = fdvm.Password
                };

                int UserID = _repo.IsValidUser(user);
                if (UserID == 0)
                {
                    Response.StatusCode = (int)HttpStatusCode.BadRequest;
                    return(Json("Invalid UserName or Password", MediaTypeNames.Text.Plain));
                }

                string CartLine     = fdvm.LineNumberEnd;
                int    CartNumber   = fdvm.CartNumberEnd.GetValueOrDefault();
                string LocationCode = fdvm.LocationCode;

                int CartID     = _repo.GetCartID(CartLine, CartNumber);
                int LocationID = _repo.GetLocationID(LocationCode);

                Location loc  = _repo.GetLocation(LocationID);
                Docking  dock = _repo.GetDocking(CartID, LocationID);

                bool rslt = false;

                if (dock.IsActive == true && loc.IsOcuppied == true)
                {
                    loc.IsOcuppied = false;
                    loc.LastUpdate = DateTime.Now.ConvertToEST();

                    dock.IsActive     = false;
                    dock.LastUpdate   = DateTime.Now.ConvertToEST();
                    dock.LastUpdateBy = UserID;

                    rslt = _repo.UpdateLocationDock(loc, dock);
                }

                return(Json(Url.Action("Index", "Timer")));
            }
            catch (Exception ex)
            {
                TempData["FreezeDownError"] = ex;
                return(RedirectToAction("ShowError", "Error"));
            }
        }