Пример #1
0
        public ActionResult AuthorizeProfilePageRequest(tbl_System_Requests request)
        {
            var systemRequest = new SystemRequestDataAccess().GetSystemRequest(request.ID);

            if (systemRequest.CreatorID == StateHelper.UserId)
            {
                return(Json(new { IsSuccess = false, ErrorMessage = CustomMessages.SameCreatorAndsAuthorizer }, JsonRequestBehavior.AllowGet));
            }
            if (request.AuthorizationStatus == "A")
            {
                var lstData      = CustomHelper.ParseJson <List <ProfilePageVM> >(systemRequest.UpdatedData);
                var profilePages = lstData.Select(e => new tbl_Profile_Page
                {
                    ProfileID = e.ProfileID,
                    PageID    = e.PageID
                }).ToList();

                ProfileMethods.AddProfilePages(profilePages);
            }

            systemRequest.AuthorizationStatus   = request.AuthorizationStatus;
            systemRequest.AuthorizationComments = request.AuthorizationComments;
            systemRequest.AuthorizerID          = StateHelper.UserId;

            var success = new SystemRequestDataAccess().UpdateSystemRequest(systemRequest);

            return(Json(new { IsSuccess = success, ErrorMessage = (!success) ? CustomMessages.GenericErrorMessage : CustomMessages.AuthorizedSucessfully, Response = success }, JsonRequestBehavior.AllowGet));
        }
Пример #2
0
        public ActionResult GetPageProfileDetails(int?ProfileId)
        {
            var data         = ProfileMethods.GetAllProfilePages(ProfileId.GetValueOrDefault());
            var pageProfiles = data.Select(e => new { PageID = e.ID, SectionID = e.SectionID });

            return(Json(new { IsSuccess = (pageProfiles == null) ? false : true, Response = new { ProfilePagesData = pageProfiles }, ErrorMessage = (pageProfiles == null) ? CustomMessages.NoDataFound : string.Empty }, JsonRequestBehavior.AllowGet));
        }
Пример #3
0
        public ActionResult GetUserByUserId(string UserId)
        {
            var data         = new UserDataAccess().GetUserByUserID(UserId);
            var userProfiles = ProfileMethods.GetProfileUsers(data.ID).Select(e => e.ProfileID);
            var response     = new UserVM
            {
                ID       = data?.ID ?? 0,
                UserName = data?.UserName
            };

            return(Json(new { IsSuccess = (data == null) ? false : true, Response = new { ProfileData = userProfiles, UserData = response }, ErrorMessage = (data == null) ? CustomMessages.UserNotExists : string.Empty }, JsonRequestBehavior.AllowGet));
        }
Пример #4
0
        // GET: Profile Pages [Use to assign pages to profile]
        public ActionResult ProfilePages(int?Id)
        {
            var viewModel = ProfileMethods.GetAllPages();

            if (Id.HasValue)
            {
                var getSystemRequest = new SystemRequestDataAccess().GetSystemRequest(Id.GetValueOrDefault(), "R");
                if (getSystemRequest == null)
                {
                    return(RedirectToAction("PageProfileReview", "SystemReview"));
                }

                ViewBag.SystemRequest = new tbl_System_Requests {
                    ID = Id.GetValueOrDefault()
                };                                                                              //getSystemRequest;
                var pageProfile = CustomHelper.ParseJson <List <ProfilePageVM> >(getSystemRequest.UpdatedData);

                ViewBag.PageProfile = pageProfile;
            }

            ViewBag.Profiles = new ProfileDataAccess().GetAllProfiles("A");
            return(View(viewModel));
        }