Esempio n. 1
0
        public bool UserRoleSpecific(string email, string password, out CustomExceptionVRF customExceptionVRF)
        {
            bool IsValid = false;

            customExceptionVRF = null;
            string            ErrorMessage      = string.Empty;
            UserRegionRequest userRegionRequest = new UserRegionRequest
            {
                // Username = email
                Username = "******"
            };                                                                                                                   //TODO
            UserRegionResponse userRegionResponse = GetVRFUserData(userRegionRequest, out customExceptionVRF, out ErrorMessage); //VRF WebApi

            if (userRegionResponse != null && customExceptionVRF == null)
            {
                if (string.IsNullOrWhiteSpace(ErrorMessage))
                {
                    UserVRF userVrf = new UserVRF {
                        Username = email, UserRole = userRegionResponse.data.role, UserRegion = userRegionResponse.data.regionCode, Password = password, SyncDate = DateTime.Now
                    };
                    MyRegion myRegion = GetRegionVRF(userVrf.UserRegion);
                    DoRegistration(myRegion, userVrf);
                    IsValid = true;
                }
            }
            return(IsValid);
        }
Esempio n. 2
0
        public UserRegionResponse GetVRFUserData(UserRegionRequest userRegion, out CustomExceptionVRF customExceptionVRF, out string ErrorMessage)
        {
            customExceptionVRF = null;
            ErrorMessage       = string.Empty;
            UserRegionResponse userRegionResponse = null;

            if (Registration.CheckNet())
            {
                string VRFBaseUrl           = ConfigurationManager.AppSettings["VRFBaseUrl"];
                string VrfUserDataActionUrl = "api/user/{0}";
                userRegionResponse = Registration.HttpClientJCH <UserRegionRequest, UserRegionResponse>(userRegion, VRFBaseUrl, string.Format(VrfUserDataActionUrl, userRegion.Username), out customExceptionVRF, "GET");
            }
            else
            {
                ErrorMessage = "Internet is not available";
            }
            return(userRegionResponse);
        }