Пример #1
0
        public ActionResult OpenPassportEntry(string WorkflowID, int RequestStageID)
        {
            Session["UserName"] = @User.Identity.Name;
            this._UserName      = Session["UserName"] as string ?? "";

            if (_UserName == null || _UserName.Equals(String.Empty))
            {
                ViewBag.ErrorMessage = "You must be logged in to continue.";
                return(RedirectToAction("AwaitingMyApproval", "AwaitingApproval"));
            }

            //now resolve the user profile from AD and Xceed
            StaffADProfile staffADProfile = new StaffADProfile();

            staffADProfile.user_logon_name = _UserName;

            //AD
            ActiveDirectoryQuery activeDirectoryQuery = new ActiveDirectoryQuery(staffADProfile);

            staffADProfile = activeDirectoryQuery.GetStaffProfile();
            if (staffADProfile == null)
            {
                ViewBag.ErrorMessage = "Your profile is not properly setup on the system. Please contact InfoTech.";
                return(RedirectToAction("AwaitingMyApproval", "AwaitingApproval"));
            }

            List <string> approvers  = LINQCalls.getApproverIDs(WorkflowID, RequestStageID);
            bool          isApprover = approvers.Contains(staffADProfile.employee_number);

            //get the request and setup the superPassportModel object

            string routeController = "PassportReviewForm";

            TempData["superPassportModel"] = null;

            if (isApprover)
            {
                routeController = "PassportReviewForm";
            }

            if (!RequestStageID.Equals(-1))
            {
                return(RedirectToAction(routeController, "PassportReview", new { WorkflowID = WorkflowID, editMode = isApprover, myEntries = false }));
            }
            else
            {
                return(RedirectToAction("EditPassport", "PassportInput", new { WorkflowID = WorkflowID, editMode = isApprover, myEntries = true }));
            }
        }