Exemple #1
0
        public GetProvinceCitiesResponse GetProvinceCities(GetProvinceCitiesRequest externalRequest)
        {
            Log(Logger.LogMessageType.Info, "->   -------------------- Comienza la ejecución del método Registration.GetProvinceCities", Logger.LoggingLevelType.Medium);
            GetProvinceCitiesResponse externalResponse = null;

            try
            {
                Log(Logger.LogMessageType.Info, "Llamando a AgentRegistration.GetProvinceCities", Logger.LoggingLevelType.Low);
                externalResponse = new GetProvinceCitiesResponse();
                UtibaRegistrationDataContext utibaRegistration = new UtibaRegistrationDataContext();
                List <City> cities = utibaRegistration.Cities.Where(c => c.CountryId == _countryID && c.ProvinceId == externalRequest.Request.ProvinceID).ToList();
                externalResponse.Response.Cities = new CityList();
                foreach (City city in cities)
                {
                    externalResponse.Response.Cities.Add(new CityInfo(city.CityId, city.CityName));
                }
                externalResponse.Response.ResponseCode = 0;
                Log(Logger.LogMessageType.Info, String.Format("Parametros de respuesta de AgentRegistration.GetProvinceCities: ResponseCode={0}, ResponseMessage={1}, TransactionID={2}", externalResponse.Response.ResponseCode, externalResponse.Response.ResponseMessage, externalResponse.Response.TransactionID), Logger.LoggingLevelType.Low);
            }
            catch (Exception e)
            {
                Log(Logger.LogMessageType.Error, "Excepcion en el metodo AgentRegistration.GetProvinceCities: " + e.ToString(), Logger.LoggingLevelType.Low);
            }
            Log(Logger.LogMessageType.Info, "->   -------------------- Termina la ejecución del método Registration.GetProvinceCities", Logger.LoggingLevelType.Medium);
            return(externalResponse);
        }
Exemple #2
0
        public override IMovilwayApiResponse PerformUtibaOperation(IMovilwayApiRequest requestObject, UMarketSCClient utibaClientProxy, String sessionID)
        {
            GetProvinceListRequestBody  request  = requestObject as GetProvinceListRequestBody;
            GetProvinceListResponseBody response = null;

            UtibaRegistrationDataContext utibaRegistration = new UtibaRegistrationDataContext();
            List <Province> provinces = utibaRegistration.Provinces.Where(p => p.CountryId == _countryID).ToList();

            if (provinces != null && provinces.Count > 0)
            {
                response = new GetProvinceListResponseBody()
                {
                    ResponseCode = 0,
                    ProvinceList = new ProvinceList()
                };
                foreach (Province province in provinces)
                {
                    response.ProvinceList.Add(province.ProvinceId, province.ProvinceName);
                }
            }
            else
            {
                response = new GetProvinceListResponseBody()
                {
                    ResponseCode    = 1,
                    ResponseMessage = "No se encuentran registradas provincias para el pais donde se encuentra"
                };
            }
            return(response);
        }
        public override IMovilwayApiResponse PerformUtibaOperation(IMovilwayApiRequest requestObject, UMarketSCClient utibaClientProxy, String sessionID)
        {
            GetCityListRequestBody  request  = requestObject as GetCityListRequestBody;
            GetCityListResponseBody response = null;

            UtibaRegistrationDataContext utibaRegistration = new UtibaRegistrationDataContext();
            List <City> cities = utibaRegistration.Cities.Where(c => c.CountryId == _countryID && c.ProvinceId == request.ProvinceID).ToList();

            if (cities != null && cities.Count > 0)
            {
                response = new GetCityListResponseBody()
                {
                    ResponseCode = 0,
                    CityList     = new CityList()
                };
                foreach (City city in cities)
                {
                    response.CityList.Add(city.CityId, city.CityName);
                }
            }
            else
            {
                response = new GetCityListResponseBody()
                {
                    ResponseCode    = 1,
                    ResponseMessage = "No se encuentran registradas provincias para el pais donde se encuentra"
                };
            }
            return(response);
        }