Example #1
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));
        }
Example #2
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));
        }
Example #3
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));
        }
Example #4
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));
        }
Example #5
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));
            }
        }
Example #6
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));
            }
        }
Example #7
0
        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));
            }
        }