Exemple #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));
        }
Exemple #2
0
        // GET: User Profile [Use to assign profile to user]
        public ActionResult UserProfile(int?Id)
        {
            var viewModel = new ProfileDataAccess().GetAllProfiles("A");

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

                ViewBag.SystemRequest = new tbl_System_Requests {
                    ID = Id.GetValueOrDefault()
                };                                                                              //getSystemRequest;
                var profileUser = CustomHelper.ParseJson <List <ProfileUserVM> >(getSystemRequest.UpdatedData);
                var userData    = new UserDataAccess().GetUserById(profileUser.FirstOrDefault()?.UserID ?? 0);

                ViewBag.ProfileUser = profileUser;
                ViewBag.UserID      = userData.UserLogin;
            }
            var users = new UserDataAccess().GetUsers("A");

            ViewBag.Users = users;
            return(View(viewModel));
        }
Exemple #3
0
        public ActionResult UpdateProfile(tbl_Users request, int?RequestId = null)
        {
            //var flag = new UserDataAccess().UpdateUser(request);
            var getUserDetails   = UserMethods.GetUserDetailsByID(request.ID);
            var getSystemRequest = new SystemRequestDataAccess().GetSystemRequest(RequestId.GetValueOrDefault());

            request.UserPassword          = getUserDetails.UserPassword;
            request.AuthorizationStatus   = getUserDetails.AuthorizationStatus;
            request.AuthorizationComments = getUserDetails.AuthorizationComments;

            var existingJson = getUserDetails == null ? null : CustomHelper.GetJson(getUserDetails);

            var updatedJson = CustomHelper.GetJson(request);
            var row         = new tbl_System_Requests
            {
                ID = RequestId ?? 0,
                AuthorizationStatus   = "P",
                CreatorID             = StateHelper.UserId,
                IsActive              = true,
                ExistingData          = existingJson,
                UpdatedData           = updatedJson,
                RequestType           = Constants.RequestTypes.UserModification,
                AuthorizerID          = getSystemRequest?.AuthorizerID ?? 0,
                AuthorizationComments = getSystemRequest?.AuthorizationComments ?? string.Empty
            };

            var flag = (!RequestId.HasValue || RequestId.GetValueOrDefault() <= 0) ? new SystemRequestDataAccess().AddSystemRequest(row) : new SystemRequestDataAccess().UpdateSystemRequest(row);

            return(Json(new { IsSuccess = flag, ErrorMessage = (flag == true) ? CustomMessages.UserProfileUpdateSuccessfully : CustomMessages.GenericErrorMessage }, JsonRequestBehavior.AllowGet));
        }
Exemple #4
0
        public ActionResult AddUpdateProfilePages(List <ProfilePageVM> request, int?RequestId = null)
        {
            if (request == null)
            {
                return(Json(new { IsSuccess = false, ErrorMessage = CustomMessages.SomethingWentWrong }, JsonRequestBehavior.AllowGet));
            }

            var getSystemRequest = new SystemRequestDataAccess().GetSystemRequest(RequestId.GetValueOrDefault());

            var getProfilePages = new ProfileDataAccess().GetProfilePage(request.FirstOrDefault() != null ? request.FirstOrDefault().ProfileID.GetValueOrDefault() : 0);

            var existingJson = getProfilePages.Count <= 0 ? null : CustomHelper.GetJson(getProfilePages);

            var updatedJson = CustomHelper.GetJson(request);
            var row         = new tbl_System_Requests
            {
                ID = RequestId.GetValueOrDefault(),
                AuthorizationStatus   = "P",
                CreatorID             = StateHelper.UserId,
                IsActive              = true,
                ExistingData          = existingJson,
                UpdatedData           = updatedJson,
                RequestType           = Constants.RequestTypes.ProfilePage,
                AuthorizationComments = getSystemRequest?.AuthorizationComments ?? string.Empty,
                AuthorizerID          = getSystemRequest?.AuthorizerID ?? 0
            };

            var success = (!RequestId.HasValue || RequestId.GetValueOrDefault() <= 0) ? new SystemRequestDataAccess().AddSystemRequest(row): new SystemRequestDataAccess().UpdateSystemRequest(row);

            return(Json(new { IsSuccess = success }, JsonRequestBehavior.AllowGet));
        }
Exemple #5
0
        public ActionResult FilterAuthorizeCardChargesScreen(FilterAccountTypeVM request, string RequestType)
        {
            if (RequestType == "Add")
            {
                List <CardChargesVM> viewModel = ReviewMethods.FilterCardChargesRequestDetails(request, "R");
                return(PartialView("_partialReviewAuthorizeCardChargesAddView", viewModel));
            }
            else
            {
                //fetch from system requests
                List <tbl_System_Requests> lst = new SystemRequestDataAccess().GetAllSystemRequests("R", Constants.RequestTypes.CardCharges_SystemRequest);

                List <CardChargesVM> lstData = new List <CardChargesVM>();
                for (int i = 0; i < lst.Count; i++)
                {
                    CardChargesVM item = new CardChargesVM();
                    item = CustomHelper.ParseJson <CardChargesVM>(lst[i].UpdatedData);
                    var cardChargesData = new CardChargesDataAccess().GetCardChargeDetailsById(item.ID);
                    item.Title                 = lst[i].ID.ToString();//setting title as ID so it could be used at hyperlink
                    item.AccountTypeName       = cardChargesData.tbl_Account_Types.Name;
                    item.CardTypeName          = cardChargesData.tbl_Card_Types.Title;
                    item.AuthorizationComments = lst[i].AuthorizationComments;
                    lstData.Add(item);
                }

                return(PartialView("_partialReviewAuthorizeCardChargesUpdateView", lstData));
            }
        }
Exemple #6
0
        public ActionResult AddProfileModificationRequest(tbl_Profile request, int?RequestId = null)
        {
            var getProfile       = new ProfileDataAccess().GetProfileById(request.ID);
            var getSystemRequest = new SystemRequestDataAccess().GetSystemRequest(RequestId.GetValueOrDefault());

            request.AuthorizationStatus   = getProfile.AuthorizationStatus;
            request.AuthorizationComments = getProfile.AuthorizationComments;

            var existingJson = getProfile == null ? null : CustomHelper.GetJson(getProfile);
            var updatedJson  = CustomHelper.GetJson(request);

            var row = new tbl_System_Requests
            {
                ID = RequestId.GetValueOrDefault(),
                AuthorizationStatus   = "P",
                CreatorID             = StateHelper.UserId,
                IsActive              = true,
                ExistingData          = existingJson,
                UpdatedData           = updatedJson,
                RequestType           = Constants.RequestTypes.ProfileModification,
                AuthorizationComments = getSystemRequest?.AuthorizationComments,
                AuthorizerID          = getSystemRequest?.AuthorizerID
            };

            var success = (!RequestId.HasValue || RequestId.GetValueOrDefault() <= 0) ? new SystemRequestDataAccess().AddSystemRequest(row) : new SystemRequestDataAccess().UpdateSystemRequest(row);

            return(Json(new { IsSuccess = success }, JsonRequestBehavior.AllowGet));
        }
Exemple #7
0
        public ActionResult FilterAuthorizeAccountTypeScreen(FilterAccountTypeVM request, string RequestType)
        {
            if (RequestType == "Add")
            {
                List <AccountTypeVM> viewModel = ReviewMethods.FilterAccountTypeRequestDetails(request, "R");
                return(PartialView("_partialReviewAuthorizeAccountTypeAddView", viewModel));
            }
            else
            {
                //fetch from system requests
                List <tbl_System_Requests> lst = new SystemRequestDataAccess().GetAllSystemRequests("R", Constants.RequestTypes.AccountTypes_SystemRequest);

                List <AccountTypeVM> lstData = new List <AccountTypeVM>();
                for (int i = 0; i < lst.Count; i++)
                {
                    AccountTypeVM item = new AccountTypeVM();
                    item      = CustomHelper.ParseJson <AccountTypeVM>(lst[i].UpdatedData);
                    item.Code = lst[i].ID.ToString();//setting code as ID so it could be used at hyperlink
                    item.AuthorizationComments = lst[i].AuthorizationComments;
                    lstData.Add(item);
                }

                return(PartialView("_partialReviewAuthorizeAccountTypeUpdateView", lstData));
            }
        }
Exemple #8
0
        public ActionResult AddUpdateUserProfile(List <ProfileUserVM> request, int?RequestId = null)
        {
            var getUserProfile   = new ProfileDataAccess().GetUserProfiles(request.FirstOrDefault() == null ? 0 : request.FirstOrDefault().UserID.GetValueOrDefault());
            var getSystemRequest = new SystemRequestDataAccess().GetSystemRequest(RequestId.GetValueOrDefault());

            var existingJson = getUserProfile.Count <= 0 ? null : CustomHelper.GetJson(getUserProfile);

            var updatedJson = CustomHelper.GetJson(request);
            var row         = new tbl_System_Requests
            {
                ID = RequestId.GetValueOrDefault(),
                AuthorizationStatus   = "P",
                CreatorID             = StateHelper.UserId,
                IsActive              = true,
                ExistingData          = existingJson,
                UpdatedData           = updatedJson,
                RequestType           = Constants.RequestTypes.UserProfile,
                AuthorizationComments = getSystemRequest?.AuthorizationComments ?? string.Empty,
                AuthorizerID          = getSystemRequest?.AuthorizerID ?? 0
            };

            var success = (!RequestId.HasValue || RequestId.GetValueOrDefault() <= 0) ? new SystemRequestDataAccess().AddSystemRequest(row) : new SystemRequestDataAccess().UpdateSystemRequest(row);

            return(Json(new { IsSuccess = success }, JsonRequestBehavior.AllowGet));
        }
Exemple #9
0
        public ActionResult AuthorizeExistingUser(int?Id)
        {
            var viewModel = new SystemRequestDataAccess().GetSystemRequest(Id.GetValueOrDefault());

            ViewBag.UserDetails = CustomHelper.ParseJson <UserVM>(viewModel.UpdatedData);
            if (viewModel.AuthorizationStatus != "P")
            {
                return(RedirectToAction("AuthorizeUser"));
            }

            return(View(viewModel));
        }
Exemple #10
0
        public ActionResult AddUpdateCardType(tbl_Card_Types request, List <tbl_Card_Types> upgradeTypes, int?RequestId = null)
        {
            if (RequestId.HasValue)
            {
                var getSystemRequest = new SystemRequestDataAccess().GetSystemRequest(RequestId.GetValueOrDefault(), "R");
                var CardTypeDetails  = CardTypeMethods.GetCardTypeById(request.ID);
                CardTypeDetails.tbl_Card_Upgrade_Types1 = new List <tbl_Card_Upgrade_Types>();
                CardTypeDetails.tbl_Card_Charges        = new List <tbl_Card_Charges>();
                var existingJson = CardTypeDetails == null ? null : CustomHelper.GetJson(CardTypeDetails);

                upgradeTypes.ForEach(e => request.tbl_Card_Upgrade_Types.Add(new tbl_Card_Upgrade_Types {
                    ParentCardType = e.ID, ChildCardType = request.ID
                }));

                var updatedJson         = CustomHelper.GetJson(request);
                tbl_System_Requests row = new tbl_System_Requests();
                if (RequestId.GetValueOrDefault() <= 0)
                {
                    row = new tbl_System_Requests
                    {
                        AuthorizationStatus = "P",
                        CreatorID           = StateHelper.UserId,
                        IsActive            = true,
                        ExistingData        = existingJson,
                        UpdatedData         = updatedJson,
                        RequestType         = Constants.RequestTypes.CardTypes_SystemRequest
                    };
                }
                else
                {
                    row                       = getSystemRequest;
                    row.CreatorID             = StateHelper.UserId;
                    row.AuthorizationStatus   = "P";
                    row.AuthorizationComments = string.Empty;
                    row.UpdatedData           = updatedJson;
                    row.ExistingData          = existingJson;
                }

                var SystemRequestFlag = (RequestId.HasValue && RequestId.GetValueOrDefault() <= 0) ? new SystemRequestDataAccess().AddSystemRequest(row) : new SystemRequestDataAccess().UpdateSystemRequest(row);

                return(Json(new { IsSuccess = SystemRequestFlag, ErrorMessage = SystemRequestFlag == true ? string.Empty : CustomMessages.GenericErrorMessage, Response = SystemRequestFlag }, JsonRequestBehavior.AllowGet));
            }
            else
            {
                request.IsActive = true;
                upgradeTypes     = upgradeTypes ?? new List <tbl_Card_Types>();
                //New Card Type
                var response = request.ID <= 0 ? new CardTypesDataAccess().AddCardType(request, upgradeTypes) : new CardTypesDataAccess().UpdateCardType(request, upgradeTypes);

                return(Json(new { IsSuccess = response, ErrorMessage = response == true ? string.Empty : CustomMessages.GenericErrorMessage, Response = response }, JsonRequestBehavior.AllowGet));
            }
        }
Exemple #11
0
        public ActionResult AuthorizeExistingProfile(int?Id)
        {
            var viewModel = new SystemRequestDataAccess().GetSystemRequest(Id.GetValueOrDefault(), "P");

            if (viewModel == null)
            {
                return(RedirectToAction("AuthorizeProfile", "SystemAuthorization"));
            }

            ViewBag.ProfileData = viewModel.UpdatedData == null ? null : CustomHelper.ParseJson <tbl_Profile>(viewModel.UpdatedData);

            return(View(viewModel));
        }
Exemple #12
0
        public ActionResult AddUpdateAccountType(tbl_Account_Types request, int?RequestId = null)
        {
            if (IsDuplicateCode(request.ID, request.Code))
            {
                return(Json(new { IsSuccess = false, ErrorMessage = CustomMessages.DuplicateAccountCode }, JsonRequestBehavior.AllowGet));
            }

            //existing account type modification requests to be handled through System Request Section
            if (RequestId.HasValue /*request.ID != 0*/)
            {
                var getSystemRequest   = new SystemRequestDataAccess().GetSystemRequest(RequestId.GetValueOrDefault(), "R");
                var AccountTypeDetails = new AccountTypeDataAccess().GetAccountTypeDetailsById(request.ID);
                var existingJson       = AccountTypeDetails == null ? null : CustomHelper.GetJson(AccountTypeDetails);

                var updatedJson         = CustomHelper.GetJson(request);
                tbl_System_Requests row = new tbl_System_Requests();
                if (RequestId.GetValueOrDefault() <= 0)
                {
                    row = new tbl_System_Requests
                    {
                        AuthorizationStatus = "P",
                        CreatorID           = StateHelper.UserId,
                        IsActive            = true,
                        ExistingData        = existingJson,
                        UpdatedData         = updatedJson,
                        RequestType         = Constants.RequestTypes.AccountTypes_SystemRequest
                    };
                }
                else
                {
                    row                       = getSystemRequest;
                    row.CreatorID             = StateHelper.UserId;
                    row.AuthorizationStatus   = "P";
                    row.AuthorizationComments = string.Empty;
                    row.UpdatedData           = updatedJson;
                    row.ExistingData          = existingJson;
                }

                var SystemRequestFlag = (RequestId.HasValue && RequestId.GetValueOrDefault() <= 0) ? new SystemRequestDataAccess().AddSystemRequest(row) : new SystemRequestDataAccess().UpdateSystemRequest(row);

                return(Json(new { IsSuccess = SystemRequestFlag, ErrorMessage = SystemRequestFlag == true ? string.Empty : CustomMessages.GenericErrorMessage, Response = SystemRequestFlag }, JsonRequestBehavior.AllowGet));
            }
            else
            {
                request.IsActive = true;
                //New Account Type
                var response = request.ID <= 0 ? new AccountTypeDataAccess().AddAccountType(request) : new AccountTypeDataAccess().UpdateAccountType(request);
                return(Json(new { IsSuccess = response, ErrorMessage = response == true ? string.Empty : CustomMessages.GenericErrorMessage, Response = response }, JsonRequestBehavior.AllowGet));
            }
        }
Exemple #13
0
        public ActionResult AuthorizeProfilePage(int?Id)
        {
            var viewModel = new SystemRequestDataAccess().GetSystemRequest(Id.GetValueOrDefault(), "P");

            if (viewModel == null)
            {
                return(RedirectToAction("AuthorizeProfile", "SystemAuthorization"));
            }

            var lstData = CustomHelper.ParseJson <List <ProfilePageVM> >(viewModel.UpdatedData);

            ViewBag.ProfilePermissions = lstData;
            ViewBag.ProfileId          = new UserDataAccess().GetUserById(lstData.FirstOrDefault().ProfileID.GetValueOrDefault());

            return(View(viewModel));
        }
Exemple #14
0
        public ActionResult UpdateUserProfile(int?Id)
        {
            var viewModel = new tbl_System_Requests();
            var result    = new UserDataAccess().GetAllUsersForAdmin();

            ViewBag.GetAllUsers = result ?? new List <tbl_Users>();
            if (Id.HasValue)
            {
                viewModel = new SystemRequestDataAccess().GetSystemRequest(Id.GetValueOrDefault(), "R");
                if (viewModel == null)
                {
                    return(RedirectToAction("DashboardView", "Base"));
                }

                ViewBag.UserDetails = CustomHelper.ParseJson <tbl_Users>(viewModel.UpdatedData);
            }
            return(View(viewModel));
        }
Exemple #15
0
        public static List <SystemRequestVM> GetSystemRequestForProfile(string AuthorizationStatus, string RequestType)
        {
            List <SystemRequestVM> lstData = new List <SystemRequestVM>();

            if (RequestType.ToLower().Contains("register"))
            {
                var rows = new ProfileDataAccess().GetAllProfiles(AuthorizationStatus);
                if (rows.Count > 0)
                {
                    using (var db = new SoneriCISEntities())
                    {
                        lstData = (from r in rows
                                   let l = (from l in db.tbl_User_Log where l.EntityID == r.ID select l).FirstOrDefault()
                                           select new SystemRequestVM
                        {
                            ProfileName = r.Title,
                            RequestDate = l.ActionTimestamp.GetValueOrDefault(),
                            ID = r.ID,
                            RequestType = "Profile_Register"
                        }).ToList();
                    }
                }
            }
            else
            {
                var rows = new SystemRequestDataAccess().GetAllSystemRequests(AuthorizationStatus, RequestType);

                using (var db = new SoneriCISEntities())
                {
                    lstData = (from r in rows
                               let l = (from l in db.tbl_User_Log where l.EntityID == r.ID select l).FirstOrDefault()
                                       select new SystemRequestVM
                    {
                        ProfileName = (RequestType == Constants.RequestTypes.ProfileModification) ? Helpers.CustomHelper.ParseJson <tbl_Profile>(r.UpdatedData)?.Title ?? string.Empty : Helpers.CustomHelper.ParseJson <List <ProfilePageVM> >(r.UpdatedData).FirstOrDefault()?.ProfileName ?? string.Empty,
                        RequestDate = l.ActionTimestamp.GetValueOrDefault(),
                        ID = r.ID,
                        RequestType = r.RequestType
                    }).ToList();
                }
            }

            return(lstData);
        }
        public ActionResult AddUpdateCardCharges(tbl_Card_Charges request, List <tbl_Regional_Charges> regionRequest = default(List <tbl_Regional_Charges>), int?RequestId = null)
        {
            //existing account type modification requests to be handled through System Request Section
            if (RequestId.HasValue)
            {
                var getSystemRequest    = new SystemRequestDataAccess().GetSystemRequest(RequestId.GetValueOrDefault(), "R");
                var CardChargesDetails  = CardChargesMethod.GetCardChargeDetail(request.ID);
                var existingJson        = CardChargesDetails == null ? null : CustomHelper.GetJson(CardChargesDetails);
                var updatedJson         = CustomHelper.GetJson(request);
                tbl_System_Requests row = new tbl_System_Requests();
                if (RequestId.GetValueOrDefault() <= 0)
                {
                    row = new tbl_System_Requests
                    {
                        AuthorizationStatus = "P",
                        CreatorID           = StateHelper.UserId,
                        IsActive            = true,
                        ExistingData        = existingJson,
                        UpdatedData         = updatedJson,
                        RequestType         = Constants.RequestTypes.CardCharges_SystemRequest
                    };
                }
                else
                {
                    row                       = getSystemRequest;
                    row.CreatorID             = StateHelper.UserId;
                    row.AuthorizationStatus   = "P";
                    row.AuthorizationComments = string.Empty;
                    row.UpdatedData           = updatedJson;
                    row.ExistingData          = existingJson;
                }

                var SystemRequestFlag = (RequestId.HasValue && RequestId.GetValueOrDefault() <= 0) ? new SystemRequestDataAccess().AddSystemRequest(row) : new SystemRequestDataAccess().UpdateSystemRequest(row);

                return(Json(new { IsSuccess = SystemRequestFlag, ErrorMessage = SystemRequestFlag == true ? string.Empty : CustomMessages.GenericErrorMessage, Response = SystemRequestFlag }, JsonRequestBehavior.AllowGet));
            }
            else
            {
                request.IsActive = true;
                var response = request.ID <= 0 ? new CardChargesDataAccess().AddCardCharges(request) : new CardChargesDataAccess().UpdateCardCharges(request);
                return(Json(new { IsSuccess = response, ErrorMessage = response == true ? string.Empty : CustomMessages.GenericErrorMessage, Response = response }, JsonRequestBehavior.AllowGet));
            }
        }
Exemple #17
0
        // GET: Update Profile [Use to edit/update profile]
        public ActionResult UpdateProfile(int?Id)
        {
            var systemRequest = new tbl_System_Requests();

            if (Id.HasValue)
            {
                systemRequest = new SystemRequestDataAccess().GetSystemRequest(Id.GetValueOrDefault(), "R");
                if (systemRequest == null)
                {
                    return(RedirectToAction("DashboardView", "Base"));
                }

                ViewBag.ProfileDetails = CustomHelper.ParseJson <tbl_Profile>(systemRequest.UpdatedData);
            }

            ViewBag.SystemRequest = systemRequest;
            var viewModel = new ProfileDataAccess().GetAllProfiles("A");

            return(View(viewModel));
        }
Exemple #18
0
        public static List <SystemRequestVM> GetSystemRequestForUser(string AuthorizationStatus, string RequestType)
        {
            List <SystemRequestVM> lstData = new List <SystemRequestVM>();
            var rows = new SystemRequestDataAccess().GetAllSystemRequests(AuthorizationStatus, RequestType);

            using (var db = new SoneriCISEntities())
            {
                lstData = (from r in rows
                           let l = (from l in db.tbl_User_Log where l.EntityID == r.ID && l.EntityName == "tbl_System_Requests" select l).FirstOrDefault()
                                   select new SystemRequestVM
                {
                    UserName = (RequestType == Constants.RequestTypes.UserModification) ? Helpers.CustomHelper.ParseJson <tbl_Users>(r.UpdatedData)?.UserName ?? string.Empty : Helpers.CustomHelper.ParseJson <List <ProfileUserVM> >(r.UpdatedData).FirstOrDefault()?.UserName ?? string.Empty,
                    RequestDate = l?.ActionTimestamp ?? new DateTime(),
                    ID = r.ID,
                    RequestType = r.RequestType
                }).ToList();
            }

            return(lstData);
        }
Exemple #19
0
        public ActionResult AuthorizeExistingProfileRequest(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 <tbl_Profile>(systemRequest.UpdatedData);
                new ProfileDataAccess().UpdateProfile(lstData);
            }

            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));
        }
Exemple #20
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));
        }
        public ActionResult AddUpdateCardChargesForUpdateRequest(int?Id)
        {
            CardChargesVM viewModel = new CardChargesVM();

            ViewBag.RequestId = Id ?? 0;

            ViewBag.AccountTypes = new AccountTypeDataAccess().GetAccountTypes("A");
            ViewBag.CardTypes    = new CardTypesDataAccess().GetCardTypes("A");
            ViewBag.CardCharges  = new CardChargesDataAccess().GetCardChargesActiveInactive("A");

            if (Id.HasValue)
            {
                var getSystemRequest = new SystemRequestDataAccess().GetSystemRequest(Id.GetValueOrDefault(), "R");
                viewModel = getSystemRequest == null ? null : CustomHelper.ParseJson <CardChargesVM>(getSystemRequest.UpdatedData);
                if (Id.GetValueOrDefault() > 0 && viewModel == null)
                {
                    return(RedirectToAction("ReviewCardChargesScreen", "Review"));
                }
            }

            ViewBag.Regions     = new RegionDataAccess().GetAllRegions();
            ViewBag.RequestType = "Update";
            return(View("AddUpdateCardCharges", viewModel));
        }
Exemple #22
0
        public ActionResult AuthorizeExistingUserRequest(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 data = CustomHelper.ParseJson <UserVM>(systemRequest.UpdatedData);
                var user = new tbl_Users
                {
                    ID                    = data.ID,
                    IsActive              = data.IsActive,
                    RoleTitle             = data.RoleTitle,
                    UserLogin             = data.UserLogin,
                    UserName              = data.UserName,
                    UserPassword          = data.UserPassword,
                    AuthorizationStatus   = data.AuthorizationStatus,
                    AuthorizationComments = data.AuthorizationComments,
                    ExpiryDate            = data.ExpiryDate,
                    EmpCode               = data.EmpCode
                };

                new UserDataAccess().UpdateUser(user);
            }

            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));
        }
Exemple #23
0
        // GET: AddUpdateAccountTypes
        public ActionResult AddUpdateAccountTypeForUpdateRequest(int?Id)
        {
            AccountTypeVM viewModel = new AccountTypeVM();

            ViewBag.RequestId = Id ?? 0;

            if (Id.HasValue)
            {
                var getSystemRequest = new SystemRequestDataAccess().GetSystemRequest(Id.GetValueOrDefault(), "R");
                viewModel            = getSystemRequest == null ? null : CustomHelper.ParseJson <AccountTypeVM>(getSystemRequest.UpdatedData);
                ViewBag.AccountTypes = new AccountTypeDataAccess().GetAccountTypesActiveInActive("A");
                if (Id.GetValueOrDefault() > 0 && viewModel == null)
                {
                    return(RedirectToAction("ReviewAccountTypeScreen", "Review"));
                }
            }
            else
            {
                ViewBag.AccountTypes = new AccountTypeDataAccess().GetAccountTypesActiveInActive("A");
            }

            ViewBag.RequestType = "Update";
            return(View("AddUpdateAccountType", viewModel));
        }