コード例 #1
0
        public async Task <ObservableCollection <ImputacionDTO> > GetImputacionesAsync(DateTime FechaInicio, DateTime FechaFinal, int PageSize, int PageIndex, string Descripcion)
        {
            try
            {
                Dictionary <string, string> requestParameters = new Dictionary <string, string>
                {
                    { "idTecnico", App.UserInfo.TecnicoIdTecnico.ToString() },
                    { "fechaInicio", FechaInicio.ToString("yyyy-MM-dd") },
                    { "fechaFinal", FechaFinal.ToString("yyyy-MM-dd") },
                    { "pageSize", PageSize.ToString() },
                    { "pageIndex", PageIndex.ToString() },
                    { "descripcion", string.IsNullOrEmpty(Descripcion) ? string.Empty : Descripcion }
                };
                //var _ws = new WebServiceRead(App.MyZadBackEndURL, "api/Imputaciones", requestParameters, Method.POST);
                string urlParameters   = $"api/Imputaciones?idTecnico={App.UserInfo.TecnicoIdTecnico.ToString()}&fechaInicio={FechaInicio.ToString("yyyy-MM-dd")}&fechaFinal={FechaFinal.ToString("yyyy-MM-dd")}&pageSize={PageSize.ToString()}&pageIndex={PageIndex.ToString()}&descripcion={(string.IsNullOrEmpty(Descripcion) ? string.Empty : Descripcion)}&api-version=1.0";
                var    _ws             = new WebServiceRead(App.MyZadBackEndURL, urlParameters, null, Method.GET);
                var    requestResponse = await _ws.Read();

                return(requestResponse == string.Empty ? null : JsonConvert.DeserializeObject <ObservableCollection <ImputacionDTO> >(requestResponse));
            }
            catch
            {
                return(null);
            }
        }
コード例 #2
0
        public bool IsValid(string UserName)
        {
            string requestResponse = "";
            var    _ws             = new WebServiceRead(App.MyZadBackEndURL, $"api/Seguridad/usuarios?filter={UserName}&api-version=0.9", null, Method.GET);

            Task.Run(async() => { requestResponse = await _ws.Read().ConfigureAwait(false); });
            return(requestResponse != string.Empty);
        }
コード例 #3
0
        public async Task <UserDTO> Autenticate(string UserName, string Password)
        {
            Dictionary <string, string> requestParameters = new Dictionary <string, string>()
            {
                { "userName", UserName },
                { "password", Password }
            };
            var _ws             = new WebServiceRead(App.MyZadBackEndURL, "api/Token", requestParameters, Method.POST);
            var requestResponse = await _ws.Read();

            return(requestResponse == string.Empty ? null : JsonConvert.DeserializeObject <UserDTO>(requestResponse));
        }
コード例 #4
0
        public async Task <ObservableCollection <ItemDTO> > GetPartidas(int idPedido, int idCapitulo)
        {
            try
            {
                var _ws             = new WebServiceRead(App.MyZadBackEndURL, $"api/Imputaciones/Partidas/?idPedido={idPedido}&idOfertaCapitulo={idCapitulo}", null, Method.GET);
                var requestResponse = await _ws.Read();

                return(requestResponse == string.Empty ? null : JsonConvert.DeserializeObject <ObservableCollection <ItemDTO> >(requestResponse));
            }
            catch
            {
                return(null);
            }
        }
コード例 #5
0
        public async Task <ObservableCollection <ItemDTO> > GetPedidos()
        {
            try
            {
                var _ws             = new WebServiceRead(App.MyZadBackEndURL, "api/Imputaciones/Pedidos", null, Method.GET);
                var requestResponse = await _ws.Read();

                return(requestResponse == string.Empty ? null : JsonConvert.DeserializeObject <ObservableCollection <ItemDTO> >(requestResponse));
            }
            catch
            {
                return(null);
            }
        }
コード例 #6
0
        public async Task <bool> UpdateGeolocation(Location location)
        {
            if (App.UserInfo == null)
            {
                return(false);
            }
            var dispositivoModelo     = DeviceInfo.Model;
            var dispositivoFabricante = DeviceInfo.Manufacturer;
            var dispositivoNombre     = DeviceInfo.Name;
            var dispositivoSistema    = DeviceInfo.VersionString;
            var dispositivoPlataforma = DeviceInfo.Platform;
            var dispositivoIdioma     = DeviceInfo.Idiom;
            var dispositivoTipo       = DeviceInfo.DeviceType;

            Dictionary <string, string> requestParameters = new Dictionary <string, string>()
            {
                { "idTecnico", App.UserInfo.TecnicoIdTecnico.ToString() },
                { "latitude", location.Latitude.ToString(CultureInfo.InvariantCulture) },
                { "logitude", location.Longitude.ToString(CultureInfo.InvariantCulture) },
                { "altitude", location.Altitude != null?location.Altitude.ToString() : string.Empty },
                { "speed", location.Speed != null?location.Speed.ToString() : string.Empty },
                { "accuracy", location.Accuracy != null?location.Accuracy.ToString() : string.Empty },
                { "modelo", dispositivoModelo },
                { "fabricante", dispositivoFabricante },
                { "nombre", dispositivoNombre },
                { "sistema", dispositivoSistema },
                { "plataforma", dispositivoPlataforma.ToString() },
                { "idioma", dispositivoIdioma.ToString() },
                { "tipo", dispositivoTipo.ToString() }
            };

            var _ws             = new WebServiceRead(App.MyZadBackEndURL, "api/GeoLocation?api-version=1.0", requestParameters, Method.POST);
            var requestResponse = await _ws.Read();

            return(requestResponse != string.Empty && requestResponse == "true");
        }