Пример #1
0
        public static dynamic ApiLogin(string email, string password)
        {
            //POST
            Profile profile = new Profile {
                id = 0, name = "string"
            };

            AdminApi admApi = new AdminApi
            {
                address   = "string",
                city      = "string",
                country   = "string",
                email     = email,
                fullName  = "string",
                id        = 0,
                idProfile = 0,
                password  = password,
                profile   = profile,
                status    = 0
            };

            var          url       = URL_VIRTUAL_FAIR_USER;
            var          urlMethod = "findByEmailAndPassword";
            WebAPIClient clientAPI = new WebAPIClient(url);
            var          paramApi  = urlMethod;
            var          content   = JsonConvert.SerializeObject(admApi);
            var          body      = new StringContent(content, Encoding.UTF8, UtilWebApiMethod.TypeJson);
            var          response  = clientAPI.HttpClient.PostAsync(paramApi, body);
            var          result    = clientAPI.Deserialize <dynamic>(response.Result);

            return(result);
        }
Пример #2
0
        //destroyByIdPurchaseRequestAndIdProducer/{idPurchaseRequest}/{idProducer}
        //Servicio para eliminar la participación de un productor por IdPurchaseRequest y por IdProducer

        public static dynamic DestroySalesProcessesProducer(string token, dynamic parameters)
        {
            //POST
            var          url       = URL_VIRTUAL_FAIR_PURCHASEREQUESTPRODUCER;
            var          urlMethod = "destroyByIdPurchaseRequestAndIdProducer";
            WebAPIClient clientAPI = new WebAPIClient(url);

            //era necesario un Authorization
            clientAPI.HttpClient.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue(token);
            var paramApi = String.Concat(urlMethod, "/", parameters.idPurchaseRequest, "/", parameters.idProducer);
            var response = clientAPI.HttpClient.DeleteAsync(paramApi);
            var result   = clientAPI.Deserialize <dynamic>(response.Result);

            return(result);
        }
Пример #3
0
        public static dynamic FindContractById(string token, dynamic contract)
        {
            //GET
            var          url       = URL_VIRTUAL_FAIR_CONTRACT;
            var          urlMethod = "findById";
            WebAPIClient clientAPI = new WebAPIClient(url);

            //era necesario un Authorization
            clientAPI.HttpClient.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue(token);

            var paramApi = String.Concat(urlMethod, "/", contract.id);
            var response = clientAPI.HttpClient.GetAsync(paramApi);
            var result   = clientAPI.Deserialize <dynamic>(response.Result);

            return(result);
        }
Пример #4
0
        public static dynamic FindAllStatus(string token)
        {
            //GET
            var          url       = URL_VIRTUAL_FAIR_PURCHASEREQUESTSTATUS;
            var          urlMethod = "findAll";
            WebAPIClient clientAPI = new WebAPIClient(url);

            //era necesario un Authorization
            clientAPI.HttpClient.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue(token);

            var paramApi = urlMethod;
            var response = clientAPI.HttpClient.GetAsync(paramApi);
            var result   = clientAPI.Deserialize <dynamic>(response.Result);

            return(result);
        }
Пример #5
0
        //Report/sendReportToParticipantsByIdPurchaseRequest/{idPurchaseRequest
        //Servicio para mandar reporte a todos los participantes por IdPurchaseRequest
        public static dynamic SendReportToParticipantsByIdPurchaseRequest(string token, dynamic parameters)
        {
            //GET
            var          url       = URL_VIRTUAL_FAIR_REPORT;
            var          urlMethod = "sendReportToParticipantsByIdPurchaseRequest";
            WebAPIClient clientAPI = new WebAPIClient(url);

            //era necesario un Authorization
            clientAPI.HttpClient.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue(token);

            var paramApi = String.Concat(urlMethod, "/", parameters.idPurchaseRequest);
            var response = clientAPI.HttpClient.GetAsync(paramApi);
            var result   = clientAPI.Deserialize <dynamic>(response.Result);

            return(result);
        }
Пример #6
0
        //findByIdPurchaseRequestStatusInTwoNineAndUpdateDatePdf/{updateDateOf/{updateDateTo
        //Servicio para obtener archivo en base64 de reporte de las pérdidas por rango de fecha por la propiedad UpdateDate
        public static dynamic FindByIdPurchaseRequestStatusInTwoNineAndUpdateDatePdfConsultant(string token, dynamic parameters)
        {
            //GET
            var          url       = URL_VIRTUAL_FAIR_SUMMARYREPORT;
            var          urlMethod = "findByIdPurchaseRequestStatusInTwoNineAndUpdateDatePdf";
            WebAPIClient clientAPI = new WebAPIClient(url);

            //era necesario un Authorization
            clientAPI.HttpClient.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue(token);

            var paramApi = String.Concat(urlMethod, "/", parameters.updateDateOf, "/", parameters.updateDateTo);
            var response = clientAPI.HttpClient.GetAsync(paramApi);
            var result   = clientAPI.Deserialize <dynamic>(response.Result);

            return(result);
        }
Пример #7
0
        public static dynamic FindByIdPurchaseRequest(string token, string idPurchaseRequest)
        {
            //GET
            var          url       = URL_VIRTUAL_FAIR_PURCHASEREQUESTPRODUCT;
            var          urlMethod = "findByIdPurchaseRequest";
            WebAPIClient clientAPI = new WebAPIClient(url);

            //era necesario un Authorization
            clientAPI.HttpClient.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue(token);

            var paramApi = String.Concat(urlMethod, "/", idPurchaseRequest);
            var response = clientAPI.HttpClient.GetAsync(paramApi);
            var result   = clientAPI.Deserialize <dynamic>(response.Result);

            return(result);
        }
Пример #8
0
        //findByIdPurchaseRequestStatusInTwoNineAndExpirationDateGreatherThanNow
        public static dynamic FindByIdPurchaseRequestStatusInTwoNineAndExpirationDateGreatherThanNow(string token)
        {
            //GET
            var          url       = URL_VIRTUAL_FAIR_PURCHASEREQUESTPRODUCT;
            var          urlMethod = "findByIdPurchaseRequestStatusInTwoNineAndExpirationDateGreatherThanNow";
            WebAPIClient clientAPI = new WebAPIClient(url);

            //era necesario un Authorization
            clientAPI.HttpClient.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue(token);

            var paramApi = urlMethod;
            var response = clientAPI.HttpClient.GetAsync(paramApi);
            var result   = clientAPI.Deserialize <dynamic>(response.Result);

            return(result);
        }
Пример #9
0
        //findByIdCarrierAndIsPublicEqualToOne/{idCarrier
        //Servicio para obtener una lista de todas las subasta de transporte publicadas, la cual esta participando un transportista, por IdCarrier
        public static dynamic FindByIdCarrierAndIsPublicEqualToOne(string token, dynamic parameters)
        {
            //GET
            var          url       = URL_VIRTUAL_FAIR_TRANSPORTAUCTION;
            var          urlMethod = "findByIdCarrierAndIsPublicEqualToOne";
            WebAPIClient clientAPI = new WebAPIClient(url);

            //era necesario un Authorization
            clientAPI.HttpClient.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue(token);

            var paramApi = String.Concat(urlMethod, "/", parameters.idCarrier);
            var response = clientAPI.HttpClient.GetAsync(paramApi);
            var result   = clientAPI.Deserialize <dynamic>(response.Result);

            return(result);
        }
Пример #10
0
        //Servicio para obtener una lista de todas las subasta de transporte que no estan publicadas
        public static dynamic GetFindByIsPublicEqualToZeroAdmin(string token)
        {
            //GET
            var          url       = URL_VIRTUAL_FAIR_TRANSPORTAUCTION;
            var          urlMethod = "findByIsPublicEqualToZero";
            WebAPIClient clientAPI = new WebAPIClient(url);

            //era necesario un Authorization
            clientAPI.HttpClient.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue(token);

            var paramApi = urlMethod;
            var response = clientAPI.HttpClient.GetAsync(paramApi);
            var result   = clientAPI.Deserialize <dynamic>(response.Result);

            return(result);
        }
Пример #11
0
        //createBalancePurchaseRequest
        //Servicio para crear compra de saldo
        public static dynamic CreateBalancePurchaseRequest(string token, dynamic purchaseRequest)
        {
            //POST
            var          url       = URL_VIRTUAL_FAIR_PURCHASEREQUEST;
            var          urlMethod = "createBalancePurchaseRequest";
            WebAPIClient clientAPI = new WebAPIClient(url);

            //era necesario un Authorization
            clientAPI.HttpClient.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue(token);
            var paramApi = urlMethod;
            var content  = JsonConvert.SerializeObject(purchaseRequest);
            var body     = new StringContent(content, Encoding.UTF8, UtilWebApiMethod.TypeJson);
            var response = clientAPI.HttpClient.PostAsync(paramApi, body);
            var result   = clientAPI.Deserialize <dynamic>(response.Result);

            return(result);
        }
Пример #12
0
        //create
        //Servicio para crear una participación de subasta de transporte
        public static dynamic CreateAuctionCarrier(string token, dynamic objectCreate)
        {
            //POST
            var          url       = URL_VIRTUAL_FAIR_TRANSPORTAUCTIONCARRIER;
            var          urlMethod = "create";
            WebAPIClient clientAPI = new WebAPIClient(url);

            //era necesario un Authorization
            clientAPI.HttpClient.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue(token);
            var paramApi = urlMethod;
            var content  = JsonConvert.SerializeObject(objectCreate);
            var body     = new StringContent(content, Encoding.UTF8, UtilWebApiMethod.TypeJson);
            var response = clientAPI.HttpClient.PostAsync(paramApi, body);
            var result   = clientAPI.Deserialize <dynamic>(response.Result);

            return(result);
        }
Пример #13
0
        public static dynamic CreateContract(string token, dynamic contract)
        {
            //POST

            var          url       = URL_VIRTUAL_FAIR_CONTRACT;
            var          urlMethod = "create";
            WebAPIClient clientAPI = new WebAPIClient(url);

            clientAPI.HttpClient.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue(token);

            var paramApi = urlMethod;
            var content  = JsonConvert.SerializeObject(contract);
            var body     = new StringContent(content, Encoding.UTF8, UtilWebApiMethod.TypeJson);
            var response = clientAPI.HttpClient.PostAsync(paramApi, body);
            var result   = clientAPI.Deserialize <dynamic>(response.Result);

            return(result);
        }
Пример #14
0
        public static dynamic UserUpdateStatusById(string token, dynamic user)
        {
            //PUT

            var          url       = URL_VIRTUAL_FAIR_USER;
            var          urlMethod = "updateStatusById";
            WebAPIClient clientAPI = new WebAPIClient(url);

            clientAPI.HttpClient.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue(token);

            var paramApi = String.Concat(urlMethod, "/", user.id);
            var content  = JsonConvert.SerializeObject(user);
            var body     = new StringContent(content, Encoding.UTF8, UtilWebApiMethod.TypeJson);
            var response = clientAPI.HttpClient.PutAsync(paramApi, body);
            var result   = clientAPI.Deserialize <dynamic>(response.Result);

            return(result);
        }
Пример #15
0
        public static dynamic AdminUpdateIsPublicById(string token, dynamic objectUpdate)
        {
            //GET
            var          url       = URL_VIRTUAL_FAIR_PURCHASEREQUEST;
            var          urlMethod = "updateIsPublicById";
            WebAPIClient clientAPI = new WebAPIClient(url);

            //era necesario un Authorization
            clientAPI.HttpClient.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue(token);

            var paramApi = String.Concat(urlMethod, "/", objectUpdate.id);
            var content  = JsonConvert.SerializeObject(objectUpdate);
            var body     = new StringContent(content, Encoding.UTF8, UtilWebApiMethod.TypeJson);
            var response = clientAPI.HttpClient.PutAsync(paramApi, body);
            var result   = clientAPI.Deserialize <dynamic>(response.Result);

            return(result);
        }