Ejemplo n.º 1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        public async Task <BuyProductResponseModel> RegisterSubscription(BuyProductRequestModel request)
        {
            try
            {
                wsConnexion ws = new wsConnexion();
                Settings.sError = "";

                //string str = "";
                string str = await ws.GetDataRestAsync(request, "Api/Folio/Create", "Folio");

                var response = JsonConvert.DeserializeObject <newResponseModel <BuyProductInfoItemResponseModel> >(str);

                if (response is null)
                {
                    throw new Exception("Hubo un error al internar conectarse con el servicio, comuníquese con su proveedor.");
                }

                if (response.Code != 0)
                {
                    return(BuyProductResponseModel.Fail(response.Message));
                }

                return(BuyProductResponseModel.Success(response.Result));
            }
            catch (Exception e)
            {
                var error = "Ha ocurrido un error al procesar la respuesta del servidor";
                return(BuyProductResponseModel.Fail(error));
            }
        }
Ejemplo n.º 2
0
        public async Task <bool> m_Login(string psUserLogin, string psPassword, string psTipoCheck)
        {
            wsConnexion ws = new wsConnexion();

            Settings.sError = "";

            try
            {
                string sMethod = String.Format(@"LoginApp?sUsuario={0}&sPassword={1}", psUserLogin, psPassword);
                newResponseModel <EntFolio> sResponseUser = new newResponseModel <EntFolio>();
                string sResponse = await ws.GetDataRestAsync(new { }, "Api/Folio/Get", sMethod);

                sResponseUser = JsonConvert.DeserializeObject <newResponseModel <EntFolio> >(sResponse);

                if (sResponseUser.Code == 0 && psTipoCheck == "ENTRADA" && sResponseUser.Result != null)
                {
                    Settings.iIdUsuario           = sResponseUser.Result.iIdPaciente;
                    Settings.dtFechaVencimiento   = sResponseUser.Result.dtFechaVencimiento;
                    Settings.sUserNameLogin       = psUserLogin;
                    Settings.sFolio               = psUserLogin;
                    Settings.sPassLogin           = psPassword;
                    Settings.bTerminoYcondiciones = sResponseUser.Result.bTerminosYCondiciones;
                    Settings.ProductType          = sResponseUser.Result.iIdProducto;
                    Settings.bEsAgendada          = sResponseUser.Result.bEsAgendada;
                    return(true);
                }
                else
                {
                    Settings.sError = sResponseUser.Message;
                    return(false);
                }
            }
            catch (Exception e)
            {
                Settings.sError = e.Message;
                return(false);
            }
        }