Esempio n. 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));
        }
Esempio n. 2
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));
        }
Esempio n. 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));
        }
Esempio n. 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));
        }
Esempio n. 5
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));
        }
Esempio n. 6
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));
            }
        }
Esempio n. 7
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));
            }
        }
Esempio n. 8
0
 public bool AddSystemRequest(tbl_System_Requests row)
 {
     try
     {
         using (var db = new SoneriCISEntities())
         {
             db.tbl_System_Requests.Add(row);
             db.SaveChanges();
         }
         return(true);
     }
     catch (Exception ex)
     {
         return(false);
     }
 }
Esempio n. 9
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));
        }
Esempio n. 10
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));
            }
        }
Esempio n. 11
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));
        }
Esempio n. 12
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));
        }
Esempio n. 13
0
 public bool UpdateSystemRequest(tbl_System_Requests row)
 {
     try
     {
         using (var db = new SoneriCISEntities())
         {
             tbl_System_Requests val = db.tbl_System_Requests.Where(a => a.ID == row.ID).FirstOrDefault();
             val.AuthorizationComments = row.AuthorizationComments;
             val.AuthorizationStatus   = row.AuthorizationStatus;
             val.AuthorizerID          = row.AuthorizerID;
             val.CreatorID             = row.CreatorID;
             val.IsActive    = row.IsActive;
             val.RequestType = row.RequestType;
             val.UpdatedData = row.UpdatedData;
             db.SaveChanges();
         }
         return(true);
     }
     catch (Exception ex)
     {
         return(false);
     }
 }
Esempio n. 14
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));
        }