public static DSS5_SupplyChainFinancialsOptimisation.ExternalStructs.GoogleGeocode.Root GeoLocation(string address) { System.Func <string> getUrl = () => { System.Threading.Thread.CurrentThread.CurrentCulture = System.Globalization.CultureInfo.InvariantCulture; return("json?address=" + address + "&key=AIzaSyCZs5R7fS9r6xCoilVedcK-Oq-hHk7mzdI"); }; var _operationRelativeUrl = getUrl.Invoke().Trim(); if (_operationRelativeUrl?.StartsWith("/") == true && BaseUrl?.EndsWith("/") == true) { _operationRelativeUrl = _operationRelativeUrl.TrimStart('/'); } var _targetUrl = BaseUrl + _operationRelativeUrl; var _options = new RestServiceConsumptionOptions { Url = _targetUrl, Verb = RestHTTPVerb.GET, ExtraHeaderData = new System.Collections.Generic.Dictionary <string, string>(StringComparer.OrdinalIgnoreCase) { }, LogAccess = false, IsCachingEnabled = false, ApiName = "GoogleGeocode", Operation = "GeoLocation" }; Func <ServiceConsumptionContainer, DSS5_SupplyChainFinancialsOptimisation.ExternalStructs.GoogleGeocode.Root> _invocation = (_httpResponse) => { var _returnedItem = RestServiceConsumer.Consume <DSS5_SupplyChainFinancialsOptimisation.ExternalStructs.GoogleGeocode.Root>(_options, _httpResponse); return(zAppDev.DotNet.Framework.Utilities.Common.SafeCast <DSS5_SupplyChainFinancialsOptimisation.ExternalStructs.GoogleGeocode.Root>(_returnedItem)); }; var _consumer = new ServiceConsumer <DSS5_SupplyChainFinancialsOptimisation.ExternalStructs.GoogleGeocode.Root>(_invocation); return(_consumer.Invoke(_options)); }
public static DSS3_LogisticsPoolingForUrbanDistribution.ExternalStructs.GoogleDistanceMatrixAPI.GoogleDistanceMatrixAPIRoot ETA(string units, string origins, string destinations) { System.Func <string> getUrl = () => { System.Threading.Thread.CurrentThread.CurrentCulture = System.Globalization.CultureInfo.InvariantCulture; return("" + "?units=" + units + "&origins=" + origins + "&destinations=" + destinations); }; var _operationRelativeUrl = getUrl.Invoke().Trim(); if (_operationRelativeUrl?.StartsWith("/") == true && BaseUrl?.EndsWith("/") == true) { _operationRelativeUrl = _operationRelativeUrl.TrimStart('/'); } var _targetUrl = BaseUrl + _operationRelativeUrl; var _options = new RestServiceConsumptionOptions { Url = _targetUrl, Verb = RestHTTPVerb.GET, ExtraHeaderData = new System.Collections.Generic.Dictionary <string, string>(StringComparer.OrdinalIgnoreCase) { }, LogAccess = false, IsCachingEnabled = false, ApiName = "GoogleDistanceMatrixAPI", Operation = "ETA" }; Func <ServiceConsumptionContainer, DSS3_LogisticsPoolingForUrbanDistribution.ExternalStructs.GoogleDistanceMatrixAPI.GoogleDistanceMatrixAPIRoot> _invocation = (_httpResponse) => { var _returnedItem = RestServiceConsumer.Consume <DSS3_LogisticsPoolingForUrbanDistribution.ExternalStructs.GoogleDistanceMatrixAPI.GoogleDistanceMatrixAPIRoot>(_options, _httpResponse); return(zAppDev.DotNet.Framework.Utilities.Common.SafeCast <DSS3_LogisticsPoolingForUrbanDistribution.ExternalStructs.GoogleDistanceMatrixAPI.GoogleDistanceMatrixAPIRoot>(_returnedItem)); }; var _consumer = new ServiceConsumer <DSS3_LogisticsPoolingForUrbanDistribution.ExternalStructs.GoogleDistanceMatrixAPI.GoogleDistanceMatrixAPIRoot>(_invocation); return(_consumer.Invoke(_options)); }
public static DSS3_LogisticsPoolingForUrbanDistribution.ExternalStructs.GoogleDirections.DirectionsResponse Directions(float?originLat, float?originLong, float?destinationLat, float?destinationLong) { System.Func <string> getUrl = () => { System.Threading.Thread.CurrentThread.CurrentCulture = System.Globalization.CultureInfo.InvariantCulture; return("json?origin=" + originLat.GetValueOrDefault(0) + "," + originLong.GetValueOrDefault(0) + "&destination=" + destinationLat.GetValueOrDefault(0) + "," + destinationLong.GetValueOrDefault(0) + "&key=AIzaSyDn7jvEi9-m-NbaNj8vJjggUCAq7-43hMM"); }; var _operationRelativeUrl = getUrl.Invoke().Trim(); if (_operationRelativeUrl?.StartsWith("/") == true && BaseUrl?.EndsWith("/") == true) { _operationRelativeUrl = _operationRelativeUrl.TrimStart('/'); } var _targetUrl = BaseUrl + _operationRelativeUrl; var _options = new RestServiceConsumptionOptions { Url = _targetUrl, Verb = RestHTTPVerb.GET, ExtraHeaderData = new System.Collections.Generic.Dictionary <string, string>(StringComparer.OrdinalIgnoreCase) { }, LogAccess = false, IsCachingEnabled = false, ApiName = "GoogleDirections", Operation = "Directions" }; Func <ServiceConsumptionContainer, DSS3_LogisticsPoolingForUrbanDistribution.ExternalStructs.GoogleDirections.DirectionsResponse> _invocation = (_httpResponse) => { var _returnedItem = RestServiceConsumer.Consume <DSS3_LogisticsPoolingForUrbanDistribution.ExternalStructs.GoogleDirections.DirectionsResponse>(_options, _httpResponse); return(zAppDev.DotNet.Framework.Utilities.Common.SafeCast <DSS3_LogisticsPoolingForUrbanDistribution.ExternalStructs.GoogleDirections.DirectionsResponse>(_returnedItem)); }; var _consumer = new ServiceConsumer <DSS3_LogisticsPoolingForUrbanDistribution.ExternalStructs.GoogleDirections.DirectionsResponse>(_invocation); return(_consumer.Invoke(_options)); }
public EnterprisePageViewModel(string categoria) { proc = new RestServiceConsumer(); Empresas = new ObservableCollection <Empresa>(); UnfilteredEnterprises = new ObservableCollection <Empresa>(); this.CurrentCategory = categoria; this.IsVisibleMessage = false; this.RefreshingCommand = new Command(refreshingExecute); loadBusiness(categoria).SafeFireAndForget(false); PropertyChanged += EnterprisePageViewModel_PropertyChanged; }
public static DSS1_RetailerDriverStockOptimisation.ExternalStructs.Elasticsearch.SearchResponse Search(DSS1_RetailerDriverStockOptimisation.ExternalStructs.Elasticsearch.SearchRequest query, int?hits) { System.Func <string> getUrl = () => { System.Threading.Thread.CurrentThread.CurrentCulture = System.Globalization.CultureInfo.InvariantCulture; return("/selis-*/_search?filter_path=hits.total,hits.max_score,hits.hits._id,hits.hits._source&size=" + hits.GetValueOrDefault(0)); }; var _operationRelativeUrl = getUrl.Invoke().Trim(); if (_operationRelativeUrl?.StartsWith("/") == true && BaseUrl?.EndsWith("/") == true) { _operationRelativeUrl = _operationRelativeUrl.TrimStart('/'); } var _targetUrl = BaseUrl + _operationRelativeUrl; var _options = new RestServiceConsumptionOptions { Url = _targetUrl, Verb = RestHTTPVerb.POST, SecurityType = RestSecurityType.BasicAuth, UserName = "******", Password = "******", ExtraHeaderData = new System.Collections.Generic.Dictionary <string, string>(StringComparer.OrdinalIgnoreCase) { }, LogAccess = false, IsCachingEnabled = false, ApiName = "Elasticsearch", Operation = "Search", PostType = PostType.JSON, Data = query, FormData = new Dictionary <string, object> { { "query", query } } }; Func <ServiceConsumptionContainer, DSS1_RetailerDriverStockOptimisation.ExternalStructs.Elasticsearch.SearchResponse> _invocation = (_httpResponse) => { var _returnedItem = RestServiceConsumer.Consume <DSS1_RetailerDriverStockOptimisation.ExternalStructs.Elasticsearch.SearchResponse>(_options, _httpResponse); return(zAppDev.DotNet.Framework.Utilities.Common.SafeCast <DSS1_RetailerDriverStockOptimisation.ExternalStructs.Elasticsearch.SearchResponse>(_returnedItem)); }; var _consumer = new ServiceConsumer <DSS1_RetailerDriverStockOptimisation.ExternalStructs.Elasticsearch.SearchResponse>(_invocation); return(_consumer.Invoke(_options)); }
public static DSS1_RetailerDriverStockOptimisation.ExternalStructs.XPackML.Results GetAnomaliesOnHits(int?hits, DSS1_RetailerDriverStockOptimisation.ExternalStructs.XPackML.RecordRequest q) { System.Func <string> getUrl = () => { System.Threading.Thread.CurrentThread.CurrentCulture = System.Globalization.CultureInfo.InvariantCulture; return("/.ml-anomalies-custom-obapi_hm_resp_hits_per_service/_search?size=" + hits.GetValueOrDefault(0)); }; var _operationRelativeUrl = getUrl.Invoke().Trim(); if (_operationRelativeUrl?.StartsWith("/") == true && BaseUrl?.EndsWith("/") == true) { _operationRelativeUrl = _operationRelativeUrl.TrimStart('/'); } var _targetUrl = BaseUrl + _operationRelativeUrl; var _options = new RestServiceConsumptionOptions { Url = _targetUrl, Verb = RestHTTPVerb.POST, SecurityType = RestSecurityType.BasicAuth, UserName = "******", Password = "******", ExtraHeaderData = new System.Collections.Generic.Dictionary <string, string>(StringComparer.OrdinalIgnoreCase) { }, LogAccess = false, IsCachingEnabled = false, ApiName = "XPackML", Operation = "GetAnomaliesOnHits", PostType = PostType.JSON, Data = q, FormData = new Dictionary <string, object> { { "q", q } } }; Func <ServiceConsumptionContainer, DSS1_RetailerDriverStockOptimisation.ExternalStructs.XPackML.Results> _invocation = (_httpResponse) => { var _returnedItem = RestServiceConsumer.Consume <DSS1_RetailerDriverStockOptimisation.ExternalStructs.XPackML.Results>(_options, _httpResponse); return(zAppDev.DotNet.Framework.Utilities.Common.SafeCast <DSS1_RetailerDriverStockOptimisation.ExternalStructs.XPackML.Results>(_returnedItem)); }; var _consumer = new ServiceConsumer <DSS1_RetailerDriverStockOptimisation.ExternalStructs.XPackML.Results>(_invocation); return(_consumer.Invoke(_options)); }
public static DSS1_RetailerDriverStockOptimisation.ExternalStructs.Elasticsearch.Status Info() { System.Func <string> getUrl = () => { System.Threading.Thread.CurrentThread.CurrentCulture = System.Globalization.CultureInfo.InvariantCulture; return("/"); }; var _operationRelativeUrl = getUrl.Invoke().Trim(); if (_operationRelativeUrl?.StartsWith("/") == true && BaseUrl?.EndsWith("/") == true) { _operationRelativeUrl = _operationRelativeUrl.TrimStart('/'); } var _targetUrl = BaseUrl + _operationRelativeUrl; var _options = new RestServiceConsumptionOptions { Url = _targetUrl, Verb = RestHTTPVerb.GET, SecurityType = RestSecurityType.BasicAuth, UserName = "******", Password = "******", ExtraHeaderData = new System.Collections.Generic.Dictionary <string, string>(StringComparer.OrdinalIgnoreCase) { }, LogAccess = false, IsCachingEnabled = true, ApiName = "Elasticsearch", Operation = "Info", CachePerUser = false, ExpirationMode = CacheManager.Core.ExpirationMode.None, ServerTimeSpan = 0 }; Func <ServiceConsumptionContainer, DSS1_RetailerDriverStockOptimisation.ExternalStructs.Elasticsearch.Status> _invocation = (_httpResponse) => { var _returnedItem = RestServiceConsumer.Consume <DSS1_RetailerDriverStockOptimisation.ExternalStructs.Elasticsearch.Status>(_options, _httpResponse); return(zAppDev.DotNet.Framework.Utilities.Common.SafeCast <DSS1_RetailerDriverStockOptimisation.ExternalStructs.Elasticsearch.Status>(_returnedItem)); }; var _consumer = new ServiceConsumer <DSS1_RetailerDriverStockOptimisation.ExternalStructs.Elasticsearch.Status>(_invocation); return(_consumer.Invoke(_options)); }
public static DSS3_LogisticsPoolingForUrbanDistribution.ExternalStructs.Optimizer_Mapotempo.Optimizer_MapotempoRoot submit(DSS3_LogisticsPoolingForUrbanDistribution.ExternalStructs.Optimizer_Mapotempo.VrpProblem a01VrpSubmit, string api_key) { System.Func <string> getUrl = () => { System.Threading.Thread.CurrentThread.CurrentCulture = System.Globalization.CultureInfo.InvariantCulture; return("vrp/submit" + "?api_key=" + api_key); }; var _operationRelativeUrl = getUrl.Invoke().Trim(); if (_operationRelativeUrl?.StartsWith("/") == true && BaseUrl?.EndsWith("/") == true) { _operationRelativeUrl = _operationRelativeUrl.TrimStart('/'); } var _targetUrl = BaseUrl + _operationRelativeUrl; var _options = new RestServiceConsumptionOptions { Url = _targetUrl, Verb = RestHTTPVerb.POST, ExtraHeaderData = new System.Collections.Generic.Dictionary <string, string>(StringComparer.OrdinalIgnoreCase) { { "Accept", "application/json" } }, LogAccess = false, IsCachingEnabled = false, ApiName = "Optimizer_Mapotempo", Operation = "submit", PostType = PostType.JSON, Data = a01VrpSubmit, FormData = new Dictionary <string, object> { { "a01VrpSubmit", a01VrpSubmit } } }; Func <ServiceConsumptionContainer, DSS3_LogisticsPoolingForUrbanDistribution.ExternalStructs.Optimizer_Mapotempo.Optimizer_MapotempoRoot> _invocation = (_httpResponse) => { var _returnedItem = RestServiceConsumer.Consume <DSS3_LogisticsPoolingForUrbanDistribution.ExternalStructs.Optimizer_Mapotempo.Optimizer_MapotempoRoot>(_options, _httpResponse); return(zAppDev.DotNet.Framework.Utilities.Common.SafeCast <DSS3_LogisticsPoolingForUrbanDistribution.ExternalStructs.Optimizer_Mapotempo.Optimizer_MapotempoRoot>(_returnedItem)); }; var _consumer = new ServiceConsumer <DSS3_LogisticsPoolingForUrbanDistribution.ExternalStructs.Optimizer_Mapotempo.Optimizer_MapotempoRoot>(_invocation); return(_consumer.Invoke(_options)); }
public static DSS3_LogisticsPoolingForUrbanDistribution.ExternalStructs.LocalPubSub.SubscribeResult Subscribe(DSS3_LogisticsPoolingForUrbanDistribution.ExternalStructs.LocalPubSub.SubRoot subRules) { System.Func <string> getUrl = () => { System.Threading.Thread.CurrentThread.CurrentCulture = System.Globalization.CultureInfo.InvariantCulture; return("subscribe"); }; var _operationRelativeUrl = getUrl.Invoke().Trim(); if (_operationRelativeUrl?.StartsWith("/") == true && BaseUrl?.EndsWith("/") == true) { _operationRelativeUrl = _operationRelativeUrl.TrimStart('/'); } var _targetUrl = BaseUrl + _operationRelativeUrl; var _options = new RestServiceConsumptionOptions { Url = _targetUrl, Verb = RestHTTPVerb.POST, ExtraHeaderData = new System.Collections.Generic.Dictionary <string, string>(StringComparer.OrdinalIgnoreCase) { }, LogAccess = false, IsCachingEnabled = false, ApiName = "LocalPubSub", Operation = "Subscribe", PostType = PostType.JSON, Data = subRules, FormData = new Dictionary <string, object> { { "subRules", subRules } } }; Func <ServiceConsumptionContainer, DSS3_LogisticsPoolingForUrbanDistribution.ExternalStructs.LocalPubSub.SubscribeResult> _invocation = (_httpResponse) => { var _returnedItem = RestServiceConsumer.Consume <DSS3_LogisticsPoolingForUrbanDistribution.ExternalStructs.LocalPubSub.SubscribeResult>(_options, _httpResponse); return(zAppDev.DotNet.Framework.Utilities.Common.SafeCast <DSS3_LogisticsPoolingForUrbanDistribution.ExternalStructs.LocalPubSub.SubscribeResult>(_returnedItem)); }; var _consumer = new ServiceConsumer <DSS3_LogisticsPoolingForUrbanDistribution.ExternalStructs.LocalPubSub.SubscribeResult>(_invocation); return(_consumer.Invoke(_options)); }
public static DSS3_LogisticsPoolingForUrbanDistribution.ExternalStructs.Mapotempo.MapotempoRoot geocode(string country, string street, string postcode, string city, string housenumber, string api_key) { System.Func <string> getUrl = () => { System.Threading.Thread.CurrentThread.CurrentCulture = System.Globalization.CultureInfo.InvariantCulture; return("geocode" + "?country=" + country + "&street=" + street + "&postcode=" + postcode + "&city=" + city + "&housenumber=" + housenumber + "&api_key=" + api_key); }; var _operationRelativeUrl = getUrl.Invoke().Trim(); if (_operationRelativeUrl?.StartsWith("/") == true && BaseUrl?.EndsWith("/") == true) { _operationRelativeUrl = _operationRelativeUrl.TrimStart('/'); } var _targetUrl = BaseUrl + _operationRelativeUrl; var _options = new RestServiceConsumptionOptions { Url = _targetUrl, Verb = RestHTTPVerb.GET, ExtraHeaderData = new System.Collections.Generic.Dictionary <string, string>(StringComparer.OrdinalIgnoreCase) { { "Accept", "application/json" } }, LogAccess = false, IsCachingEnabled = false, ApiName = "Mapotempo", Operation = "geocode" }; Func <ServiceConsumptionContainer, DSS3_LogisticsPoolingForUrbanDistribution.ExternalStructs.Mapotempo.MapotempoRoot> _invocation = (_httpResponse) => { var _returnedItem = RestServiceConsumer.Consume <DSS3_LogisticsPoolingForUrbanDistribution.ExternalStructs.Mapotempo.MapotempoRoot>(_options, _httpResponse); return(zAppDev.DotNet.Framework.Utilities.Common.SafeCast <DSS3_LogisticsPoolingForUrbanDistribution.ExternalStructs.Mapotempo.MapotempoRoot>(_returnedItem)); }; var _consumer = new ServiceConsumer <DSS3_LogisticsPoolingForUrbanDistribution.ExternalStructs.Mapotempo.MapotempoRoot>(_invocation); return(_consumer.Invoke(_options)); }
public static void Continue(string order_id) { System.Func <string> getUrl = () => { System.Threading.Thread.CurrentThread.CurrentCulture = System.Globalization.CultureInfo.InvariantCulture; return(null); }; var _operationRelativeUrl = getUrl.Invoke().Trim(); if (_operationRelativeUrl?.StartsWith("/") == true && BaseUrl?.EndsWith("/") == true) { _operationRelativeUrl = _operationRelativeUrl.TrimStart('/'); } var _targetUrl = BaseUrl + _operationRelativeUrl; var _options = new RestServiceConsumptionOptions { Url = _targetUrl, Verb = RestHTTPVerb.POST, ExtraHeaderData = new System.Collections.Generic.Dictionary <string, string>(StringComparer.OrdinalIgnoreCase) { }, LogAccess = false, IsCachingEnabled = false, ApiName = "DisruptionAPI", Operation = "Continue", PostType = PostType.JSON }; Func <ServiceConsumptionContainer, object> _invocation = (_httpResponse) => { RestServiceConsumer.Consume <object>(_options, _httpResponse); return(null); }; var _consumer = new ServiceConsumer <object>(_invocation); _consumer.Invoke(_options); }
public static DSS3_LogisticsPoolingForUrbanDistribution.ExternalStructs.Router_Mapotempo.Router_MapotempoRoot route(string dimension, string geometry, string motorway, string toll, string max_walk_distance, string currency, string lang, string loc, string api_key) { System.Func <string> getUrl = () => { System.Threading.Thread.CurrentThread.CurrentCulture = System.Globalization.CultureInfo.InvariantCulture; return("route" + "?dimension=" + dimension + "&geometry=" + geometry + "&motorway=" + motorway + "&toll=" + toll + "&max_walk_distance=" + max_walk_distance + "¤cy=" + currency + "&lang=" + lang + "&loc=" + loc + "&api_key=" + api_key); }; var _operationRelativeUrl = getUrl.Invoke().Trim(); if (_operationRelativeUrl?.StartsWith("/") == true && BaseUrl?.EndsWith("/") == true) { _operationRelativeUrl = _operationRelativeUrl.TrimStart('/'); } var _targetUrl = BaseUrl + _operationRelativeUrl; var _options = new RestServiceConsumptionOptions { Url = _targetUrl, Verb = RestHTTPVerb.GET, ExtraHeaderData = new System.Collections.Generic.Dictionary <string, string>(StringComparer.OrdinalIgnoreCase) { { "Accept", "application/json" } }, LogAccess = false, IsCachingEnabled = false, ApiName = "Router_Mapotempo", Operation = "route" }; Func <ServiceConsumptionContainer, DSS3_LogisticsPoolingForUrbanDistribution.ExternalStructs.Router_Mapotempo.Router_MapotempoRoot> _invocation = (_httpResponse) => { var _returnedItem = RestServiceConsumer.Consume <DSS3_LogisticsPoolingForUrbanDistribution.ExternalStructs.Router_Mapotempo.Router_MapotempoRoot>(_options, _httpResponse); return(zAppDev.DotNet.Framework.Utilities.Common.SafeCast <DSS3_LogisticsPoolingForUrbanDistribution.ExternalStructs.Router_Mapotempo.Router_MapotempoRoot>(_returnedItem)); }; var _consumer = new ServiceConsumer <DSS3_LogisticsPoolingForUrbanDistribution.ExternalStructs.Router_Mapotempo.Router_MapotempoRoot>(_invocation); return(_consumer.Invoke(_options)); }
public async void UpdateCommandExecute() { bool updateCredentials = false; RestServiceConsumer service; SetActivity(true); //Conexion service = new RestServiceConsumer(); var response = await service.CheckConnection(); if (!response.IsSuccesFull) { SetActivity(false); //No hay conexion CustomizedToast(Android.Graphics.Color.White, Android.Graphics.Color.Black, response.Message, iconResource: "error64", textSize: 16); return; } try { //Chequeo de vacios if (!AllDataChecker()) { //Faltan datos SetActivity(false); CustomizedToast(Android.Graphics.Color.White, Android.Graphics.Color.Black, Languages.AllDataNeeded, iconResource: "error64", textSize: 16); return; } if (!NameChecker(this.Nombres.TrimEnd(' ')) || !NameChecker(this.Apellidos.TrimEnd(' '))) { SetActivity(false); //Los nombres o apellidos no han sido bien escritos} if (!NameChecker(this.Nombres.TrimEnd(' '))) { CustomizedToast(Android.Graphics.Color.White, Android.Graphics.Color.Black, Languages.WronWGNames, iconResource: "error64", textSize: 16); } else { CustomizedToast(Android.Graphics.Color.White, Android.Graphics.Color.Black, Languages.WronWGivenNames, iconResource: "error64", textSize: 16); } return; } //Chequeo de password correcto if (Settings.SuccesfullPassword != this.OldPassword) { SetActivity(false); //No coinciden las contraseñas CustomizedToast(Android.Graphics.Color.White, Android.Graphics.Color.Black, Languages.PasswordsDontMatch, iconResource: "error64", textSize: 16); return; } //Se quiere actualizar algo de la seccion de credenciales? if (!this.NewPassword.Equals(string.Empty) || !this.RepeatPassword.Equals(string.Empty)) { //Todos los datos fueron proporcionados? if (NewPassword.Equals(string.Empty) || RepeatPassword.Equals(string.Empty)) { SetActivity(false); CustomizedToast(Android.Graphics.Color.White, Android.Graphics.Color.Black, Languages.AllDataNeeded, iconResource: "error64", textSize: 16); return; } //Chequeo de repeticion de nueva contraseña if (this.NewPassword != this.RepeatPassword) { SetActivity(false); //No coinciden las contraseñas CustomizedToast(Android.Graphics.Color.White, Android.Graphics.Color.Black, Languages.PasswordsShouldMatch, iconResource: "error64", textSize: 16); return; } else { updateCredentials = true; } } //Creacion del modelo a enviar Stream streamedImage = GetImageSourceStream(this.Profile.ProfileImage); this.ProfileImageBytes = StreamToByteArray(streamedImage); var token = Settings.SerializedToken; var posted = new ApiPlainClientProfile() { ID = Settings.ClientUID, PrimerNombre = this.Nombres.Split(' ')[0], SegundoNombre = this.Nombres.Split(' ')[1], Apellido = this.Apellidos.Split(' ')[0], SegundoApellido = this.Apellidos.Split(' ')[1], Email = this.Profile.Email, PP = this.ProfileImageBytes, Afiliado = DateTime.Now }; var posted2 = new ApiClientCredentials() { IdClient = -1, IdPersona = posted.ID, Password = this.NewPassword, UserName = "******" }; Response result2 = null; var result = await service.Put <ApiPlainClientProfile>(Constantes.BASEURL, Constantes.CLIENTPREFIX, Constantes.CLIENTUPDATEPROFILE, posted, token); if (updateCredentials) { result2 = await service.Put <ApiClientCredentials>(Constantes.BASEURL, Constantes.CLIENTPREFIX, Constantes.CLIENTUPDATECREDENTIALS, posted2, token); } if (updateCredentials) { if (!result.IsSuccesFull || !result2.IsSuccesFull) { SetActivity(false); //Error en la peticion if (!result.IsSuccesFull) { CustomizedToast(Android.Graphics.Color.White, Android.Graphics.Color.Black, result.Message, iconResource: "error64", textSize: 16); SetActivity(false); return; } else { CustomizedToast(Android.Graphics.Color.White, Android.Graphics.Color.Black, result2.Message, iconResource: "error64", textSize: 16); } SetActivity(false); return; } Settings.SuccesfullPassword = this.NewPassword; } else { if (!result.IsSuccesFull) { CustomizedToast(Android.Graphics.Color.White, Android.Graphics.Color.Black, result.Message, iconResource: "error64", textSize: 16); SetActivity(false); return; } } SetActivity(false); CustomizedToast(Android.Graphics.Color.White, Android.Graphics.Color.Black, Languages.UpdatedProfile, iconResource: "ok96", textSize: 16); UpdateLocalProfileInfo(posted); } catch (Exception ex) { CustomizedToast(Android.Graphics.Color.White, Android.Graphics.Color.Black, ex.Message, iconResource: "error64", textSize: 16); SetActivity(false); throw ex; } }
public async void LoginCommandExecute() { await Device.InvokeOnMainThreadAsync(() => { this.IsBusy = true; this.IsEnabled = false; }); /*Logueandome y obteniendo un token*/ if (userLogin.password != null && userLogin.userName != null) { proc = new RestServiceConsumer(); var controllerString = $"{Constantes.LOGINAUTH}{Constantes.LOGINAUTHUSERPAR}={userLogin.userName}&{Constantes.LOGINAUTHPASSPAR}={userLogin.password}"; var response = await proc.Get <string>(Constantes.BASEURL, Constantes.LOGINPREFIX, controllerString); if (!response.IsSuccesFull) { //Errores en la respuesta if (response.Result == null) { await Device.InvokeOnMainThreadAsync(() => { this.IsBusy = false; this.IsEnabled = true; }); await Application.Current.MainPage.DisplayAlert("Error!", "Credenciales incorrectas", "OK"); return; } //Manejo de otros errores await Device.InvokeOnMainThreadAsync(() => { this.IsBusy = false; this.IsEnabled = true; }); await Application.Current.MainPage.DisplayAlert("Error!", response.Message, "OK"); return; } //Settings Settings.SerializedToken = Convert.ToString(response.Result); Settings.IsRemembered = RememberMe; //Informacion de perfil var profileControllerString = $"{Constantes.CLIENTPROFILE}{Constantes.LOGINAUTHUSERPAR}={userLogin.userName}&{Constantes.LOGINAUTHPASSPAR}={userLogin.password}"; var profileResponse = await proc.Get <ApiPlainClientProfile>(Constantes.BASEURL, Constantes.CLIENTPREFIX, profileControllerString, Settings.SerializedToken); if (!profileResponse.IsSuccesFull) { await Device.InvokeOnMainThreadAsync(() => { this.IsBusy = false; this.IsEnabled = true; }); await Application.Current.MainPage.DisplayAlert("Error!", response.Message, "OK"); return; } ApiPlainClientProfile profileInfo = (ApiPlainClientProfile)profileResponse.Result; this.ClientProfile = profileInfo; #region Carga de datos a otros ViewModels var profileImageBytes = Convert.FromBase64String(profileInfo.PP.ToString()); ImageSource profileImage; if (profileImageBytes.Length != 0) { profileImage = ImageSource.FromStream(() => new MemoryStream(profileImageBytes)); } else { profileImage = ImageSource.FromFile("userF.png"); } #endregion //Control de recuerdos if (Settings.IsRemembered) { //Cargar perfil a BD local var r = Realm.GetInstance(); try { r.Write(() => { r.Add(new RmbClientProfile() { ID = profileInfo.ID, ProfilePhoto = profileImageBytes, Afiliado = profileInfo.Afiliado, Apellido = profileInfo.Apellido, SegundoApellido = profileInfo.SegundoApellido, Email = profileInfo.Email, PrimerNombre = profileInfo.PrimerNombre, SegundoNombre = profileInfo.SegundoNombre, }); }); } catch (Exception ex) { UpdateProfileViewModel.CustomizedToast(Android.Graphics.Color.White, Android.Graphics.Color.Black, ex.Message, ToastLength.Long, iconResource: "error64", textSize: 16); } } //Settings Settings.FullName = $"{profileInfo.PrimerNombre} {profileInfo.SegundoNombre} {profileInfo.Apellido} {profileInfo.SegundoApellido}"; Settings.ClientUID = profileInfo.ID; Settings.SuccesfullPassword = userLogin.password; await Device.InvokeOnMainThreadAsync(() => { this.IsBusy = false; this.IsEnabled = true; }); //Navegacion a la pagina Root bloqueando el regreso al Login Application.Current.MainPage = new RootHomePage(); } else { await Device.InvokeOnMainThreadAsync(() => { this.IsBusy = false; this.IsEnabled = true; }); await Application.Current.MainPage.DisplayAlert("Error!", "Todos los datos son obligatorios", "OK"); } }
public async void LoginCommandExecute() { await Device.InvokeOnMainThreadAsync(() => { this.IsBusy = true; this.IsEnabled = false; }); await Task.Delay(10000); /*Logueandome y obteniendo un token*/ if (userLogin.password != null && userLogin.userName != null) { proc = new RestServiceConsumer(); var controllerString = $"{Constantes.LOGINAUTH}{Constantes.LOGINAUTHUSERPAR}={userLogin.userName}&{Constantes.LOGINAUTHPASSPAR}={userLogin.password}"; var response = await proc.Get <string>(Constantes.BASEURL, Constantes.LOGINPREFIX, controllerString); if (!response.IsSuccesFull) { //Errores en la respuesta if (response.Result == null) { await Application.Current.MainPage.DisplayAlert("Error!", "Credenciales incorrectas", "OK"); return; } //Manejo de otros errores await Application.Current.MainPage.DisplayAlert("Error!", response.Message, "OK"); return; } Settings.SerializedToken = Convert.ToString(response.Result); Settings.IsRemembered = RememberMe; var profileControllerString = $"{Constantes.CLIENTPROFILE}{Constantes.LOGINAUTHUSERPAR}={userLogin.userName}&{Constantes.LOGINAUTHPASSPAR}={userLogin.password}"; var profileResponse = await proc.Get <ApiClientProfile>(Constantes.BASEURL, Constantes.CLIENTPREFIX, profileControllerString, Settings.SerializedToken); if (!profileResponse.IsSuccesFull) { await Application.Current.MainPage.DisplayAlert("Error!", response.Message, "OK"); return; } ApiClientProfile profileInfo = (ApiClientProfile)profileResponse.Result; this.ClientProfile = profileInfo; Settings.FullName = $"{profileInfo.PrimerNombre} {profileInfo.SegundoNombre} {profileInfo.Apellido} {profileInfo.SegundoApellido}"; //Navegacion a la pagina Root bloqueando el regreso al Login Application.Current.MainPage = new RootHomePage(); } else { await Application.Current.MainPage.DisplayAlert("Error!", "Todos los datos son obligatorios", "OK"); } await Device.InvokeOnMainThreadAsync(() => { this.IsBusy = false; this.IsEnabled = true; }); }
public async Task loadProducts(int commer) { Device.BeginInvokeOnMainThread(() => { this.IsRefreshing = true; }); service = new RestServiceConsumer(); var connection = await service.CheckConnection(); if (!connection.IsSuccesFull) { //Conexion no establecida Device.BeginInvokeOnMainThread(() => { this.IsRefreshing = false; }); this.IsVisibleMessage = true; this.Message = connection.Message; return; } this.IsVisibleMessage = false; var products = await service.Get <List <ApiProducto> >(Constantes.BASEURL, Constantes.PRODUCTSPREFIX, $"{Constantes.PRODUCTGETBYCOMME}{commer}"); var sucs = await service.Get <List <ApiSucursal> >(Constantes.BASEURL, Constantes.COMMEPREFIX, $"{Constantes.COMMEGETSUCBYCOMME}{commer}"); if (!products.IsSuccesFull || !sucs.IsSuccesFull) { //Error en la extraccion de datos return; } List <ApiProducto> productos = (List <ApiProducto>)products.Result; List <ApiSucursal> sucursales = (List <ApiSucursal>)sucs.Result; List <ApiInventarioSucursal> inventarioSucursals = new List <ApiInventarioSucursal>(); foreach (var suc in sucursales) { ApiInventarioSucursal tempIn = new ApiInventarioSucursal(); tempIn.Sucursal = suc; foreach (var prods in productos) { if (prods.sucursal == suc.idSucursal) { tempIn.Productos.Add(prods); } } inventarioSucursals.Add(tempIn); } foreach (var item in inventarioSucursals) { List <Producto> tempPro = new List <Producto>(); foreach (var temItem in item.Productos) { ImageSource imgSource; var byteArray = Convert.FromBase64String(Convert.ToString(temItem.ilustracion)); if (byteArray.Length != 0) { imgSource = ImageSource.FromStream(() => new MemoryStream(byteArray)); } else { imgSource = ImageSource.FromFile("inven.png"); } tempPro.Add(new Producto() { Sucursal = item.Sucursal, ID = temItem.idProducto, IdSucursal = temItem.sucursal, Descripcion = temItem.descripcion, FechaVencimiento = temItem.fechaVencimiento, Existencias = temItem.existencias, NombreProducto = temItem.nombreProducto, Precio = Convert.ToDouble(temItem.precio), Ilustracion = imgSource }); } this.GroupedProducts.Add(new Models.GroupedProducts(item.Sucursal, tempPro)); } this.UnfilteredGroupedProducts = GroupedProducts; Device.BeginInvokeOnMainThread(() => { this.IsRefreshing = false; }); }