public Result IsCreateAccountMessageEntityValid(CreateAccountMessageEntity createAccountMessageEntity)
 {
     if (createAccountMessageEntity == null)
     {
         return(KatavuccolPortalUtility.GetResult(ResultStatus.Success, katavuccolPortalWebErrorCode.CreateAccountMessageEntityIsEmpty, KatavuccolPortalWebConstants.CreateAccountMessageEntityIsEmpty));
     }
     return(new Result()
     {
         ResultStatus = ResultStatus.Success
     });
 }
 public Result IsCredentialTypeIdValid(GetCredentialTypeMsgEntity getCredentialTypeMsgEntity)
 {
     if (string.IsNullOrWhiteSpace(getCredentialTypeMsgEntity.CredentialTypeId))
     {
         return(KatavuccolPortalUtility.GetResult(resultStatus: ResultStatus.Fail, errorCode: katavuccolPortalWebErrorCode.CredentialTypeIdIsEmpty,
                                                  message: "CredentialTypeId is null"));
     }
     return(new Result()
     {
         ResultStatus = ResultStatus.Success
     });
 }
 public Result IsUserIdValid(CreateCredentialTypeMsgEntity createCredentialTypeMsgEntity)
 {
     if (string.IsNullOrWhiteSpace(createCredentialTypeMsgEntity.UserId))
     {
         return(KatavuccolPortalUtility.GetResult(resultStatus: ResultStatus.Fail, errorCode: katavuccolPortalWebErrorCode.UserIdIsEmpty.ToString(),
                                                  message: "UserId is null"));
     }
     return(new Result()
     {
         ResultStatus = ResultStatus.Success
     });
 }
 public Result IsNameValid(CreateCategoryBusinessMsgEntity createCategoryBusinessMsgEntity)
 {
     if (string.IsNullOrWhiteSpace(createCategoryBusinessMsgEntity.CategoryName))
     {
         return(KatavuccolPortalUtility.GetResult(resultStatus: ResultStatus.Fail, errorCode: katavuccolPortalWebErrorCode.NameIsEmpty.ToString(),
                                                  message: "CategoryName is null"));
     }
     return(new Result()
     {
         ResultStatus = ResultStatus.Success
     });
 }
 public Result IsCreateCategoryValid(CreateCategoryBusinessMsgEntity createCategoryBusinessMsgEntity)
 {
     if (createCategoryBusinessMsgEntity == null)
     {
         return(KatavuccolPortalUtility.GetResult(resultStatus: ResultStatus.Fail, errorCode: katavuccolPortalWebErrorCode.CreateCredentialTypeMsgEntityIsEmpty.ToString(),
                                                  message: "CreateCategorymsgEntity is null"));
     }
     return(new Result()
     {
         ResultStatus = ResultStatus.Success
     });
 }
 public Result IsGetCredentialTypeMsgEntityValid(GetCredentialTypeMsgEntity getCredentialTypeMsgEntity)
 {
     if (getCredentialTypeMsgEntity == null)
     {
         return(KatavuccolPortalUtility.GetResult(resultStatus: ResultStatus.Fail, errorCode: katavuccolPortalWebErrorCode.GetCredentialTypeMsgEntityIsEmpty.ToString(),
                                                  message: "GetCredentialTypeMsgEntity is null"));
     }
     return(new Result()
     {
         ResultStatus = ResultStatus.Success
     });
 }
Пример #7
0
 public Result IsEmailAddressValid(string emailAddress)
 {
     try
     {
         MailAddress mailAddress = new MailAddress(emailAddress);
         return(new Result()
         {
             ResultStatus = ResultStatus.Success
         });
     }
     catch (Exception ex)
     {
     }
     return(KatavuccolPortalUtility.GetResult(ResultStatus.Fail, katavuccolPortalWebErrorCode.EmailAddressIsInValidFormat, "in valid email address"));
 }
Пример #8
0
        public Result GetCredentialType(GetCredentialTypeMsgEntity getCredentialTypeMsgEntity)
        {
            var credentialType = baseCredentialTypeService.GetCredentialTypeById(getCredentialTypeMsgEntity.CredentialTypeId);

            if (credentialType == null)
            {
                return(KatavuccolPortalUtility.GetResult(ResultStatus.Fail, errorCode: katavuccolPortalWebErrorCode.CredentialTypeIdIsInValid));
            }
            getCredentialTypeMsgEntity.CredentialType = credentialType;

            return(new Result()
            {
                ResultStatus = ResultStatus.Success
            });
        }
Пример #9
0
        public Result IsUserIdValid(CreateCredentialTypeMsgEntity createCredentialTypeMsgEntity)
        {
            var userDetail = new UserDetailMsgEntity();

            //baseLoginServiceBusinessService.getUserDetail(createCredentialTypeMsgEntity.UserId);
            if (userDetail == null)
            {
                return(KatavuccolPortalUtility.GetResult(resultStatus: ResultStatus.Fail, errorCode: katavuccolPortalWebErrorCode.UserIdInValid.ToString()));
            }
            createCredentialTypeMsgEntity.UserDetail = userDetail;

            return(new Result()
            {
                ResultStatus = ResultStatus.Success
            });
        }
        public Result IsUserNameValid(CreateAccountMessageEntity createAccountMessageEntity)
        {
            if (createAccountMessageEntity.UserName.IsEmpty())
            {
                return(KatavuccolPortalUtility.GetResult(ResultStatus.Success, katavuccolPortalWebErrorCode.UserNameIsEmpty, KatavuccolPortalWebConstants.UserNameIsEmpty));
            }

            if (baseProfileBusinessServiceValidator.IsUserNameValid(createAccountMessageEntity.UserName))
            {
                return(KatavuccolPortalUtility.GetResult(ResultStatus.Success, katavuccolPortalWebErrorCode.UserNameIsInValidFormat, KatavuccolPortalWebConstants.UserNameIsInValidFormat));
            }
            return(new Result()
            {
                ResultStatus = ResultStatus.Success
            });
        }
        public Result IsNameValid(CreateAccountMessageEntity createAccountMessageEntity)
        {
            if (createAccountMessageEntity.FirstName.IsEmpty())
            {
                return(KatavuccolPortalUtility.GetResult(ResultStatus.Success, katavuccolPortalWebErrorCode.FirstNameIsEmpty, KatavuccolPortalWebConstants.FirstNameIsEmpty));
            }

            if (createAccountMessageEntity.LastName.IsEmpty())
            {
                return(KatavuccolPortalUtility.GetResult(ResultStatus.Success, katavuccolPortalWebErrorCode.LastNameIsEmpty, KatavuccolPortalWebConstants.LastNameIsEmpty));
            }

            return(new Result()
            {
                ResultStatus = ResultStatus.Success
            });
        }
        public Result IsEmailAddressValid(CreateAccountMessageEntity createAccountMessageEntity)
        {
            if (createAccountMessageEntity.EmailAddress.IsEmpty())
            {
                return(KatavuccolPortalUtility.GetResult(ResultStatus.Success, katavuccolPortalWebErrorCode.EmailAddressIsEmpty, KatavuccolPortalWebConstants.EmailAddressIsEmpty));
            }

            Result result = baseProfileBusinessServiceValidator.IsEmailAddressValid(createAccountMessageEntity.EmailAddress);

            if (result.ResultStatus == ResultStatus.Success)
            {
                return(new Result()
                {
                    ResultStatus = ResultStatus.Success
                });
            }
            return(KatavuccolPortalUtility.GetResult(ResultStatus.Fail, katavuccolPortalWebErrorCode.EmailAddressIsInValidFormat, KatavuccolPortalWebConstants.EmailAddressIsInValidFormat));
        }
Пример #13
0
        public Result IsPhoneNumberValid(string phoneNumber, out PhoneNumber phoneNumberRes)
        {
            phoneNumberRes = null;
            string defaultRegion = "US";

            try
            {
                phoneNumberRes = phoneNumberUtil.Parse(phoneNumber, defaultRegion);
                return(new Result {
                    ResultStatus = ResultStatus.Success
                });
            }
            catch (Exception ex)
            {
            }

            return(KatavuccolPortalUtility.GetResult(ResultStatus.Fail, katavuccolPortalWebErrorCode.PhoneNumberIsInValidFormat));
        }
        public Result IsPhoneValid(CreateAccountMessageEntity createAccountMessageEntity)
        {
            if (createAccountMessageEntity.PhoneNumber.IsEmpty())
            {
                return(KatavuccolPortalUtility.GetResult(ResultStatus.Success));
            }

            Result result = baseProfileBusinessServiceValidator.IsPhoneNumberValid(createAccountMessageEntity.PhoneNumber, out PhoneNumber parsedPhoneNumber);

            if (result.ResultStatus == ResultStatus.Success)
            {
                createAccountMessageEntity.ParsedPhoneNumber = parsedPhoneNumber;
                return(new Result()
                {
                    ResultStatus = ResultStatus.Success
                });
            }
            return(KatavuccolPortalUtility.GetResult(ResultStatus.Success, katavuccolPortalWebErrorCode.PhoneNumberIsInValidFormat, KatavuccolPortalWebConstants.PhoneNumberIsInValidFormat));
        }
 public Result VerifyCreateCategory(CreateCategoryBusinessMsgEntity createCategoryBusinessMsgEntity)
 {
     try
     {
         string url     = string.Format("http://localhost:8080/Katavuccol/" + createCategoryBusinessMsgEntity.CategoryName);
         string details = CallRestMethod(url);
         if (details == createCategoryBusinessMsgEntity.CategoryName)
         {
             return(KatavuccolPortalUtility.GetResult(resultStatus: ResultStatus.Fail, errorCode: katavuccolPortalWebErrorCode.CategoryNameExists.ToString(),
                                                      message: "CategoryName already exists"));
         }
     }
     catch (Exception ex)
     {
     }
     return(new Result()
     {
         ResultStatus = ResultStatus.Success
     });
 }
        public Result IsPasswordValid(CreateAccountMessageEntity createAccountMessageEntity)
        {
            if (createAccountMessageEntity.Password.IsEmpty())
            {
                return(KatavuccolPortalUtility.GetResult(ResultStatus.Success, katavuccolPortalWebErrorCode.PasswordIsEmpty, KatavuccolPortalWebConstants.PasswordIsEmpty));
            }

            if (createAccountMessageEntity.Password == createAccountMessageEntity.ConfirmPassword)
            {
                return(KatavuccolPortalUtility.GetResult(ResultStatus.Success, katavuccolPortalWebErrorCode.PasswordAndConfirmPasswordNotMatch, KatavuccolPortalWebConstants.PasswordAndConfirmPasswordNotMatch));
            }

            if (baseProfileBusinessServiceValidator.IsPasswordValid(createAccountMessageEntity.Password))
            {
                return(KatavuccolPortalUtility.GetResult(ResultStatus.Success, katavuccolPortalWebErrorCode.PasswordIsInValidFormat, KatavuccolPortalWebConstants.PasswordIsInValidFormat));
            }
            return(new Result()
            {
                ResultStatus = ResultStatus.Success
            });
        }
        public Result CreateAccount(CreateAccountMessageEntity createAccountMessageEntity)
        {
            CreateAccountModelAPI createAccountModelAPI = profileBusinessServiceMapper.MapCreateAccountModelAPI(createAccountMessageEntity);
            CreateAccountIPost    createAccountIPost    = profileBusinessServiceMapper.MapCreateAccountIPost(createAccountModelAPI, createAccountMessageEntity);
            RestResponse          restResponse          = katavuccolClient.Post(createAccountIPost);

            if (restResponse.ResponseContent.IsValid())
            {
                CreateAccountResponseModelAPI createAccountResponseModelAPI = JsonConvert.DeserializeObject <CreateAccountResponseModelAPI>(restResponse.ResponseContent);
                if (createAccountResponseModelAPI.userId.IsEmpty())
                {
                    KatavuccolPortalUtility.GetResult(ResultStatus.Fail, katavuccolPortalWebErrorCode.UserIdIsEmptyFromAPIService, KatavuccolPortalWebConstants.UserIdIsEmptyFromAPIService);
                }
                createAccountMessageEntity.UserId = createAccountResponseModelAPI.userId;
            }
            else
            {
                return(KatavuccolPortalUtility.GetResult(ResultStatus.Fail, katavuccolPortalWebErrorCode.InValidResponseFromAPIAccountCreation, KatavuccolPortalWebConstants.InValidResponseFromAPIAccountCreation));
            }
            return(new Result()
            {
                ResultStatus = ResultStatus.Success
            });
        }