Exemple #1
0
        public override IMovilwayApiResponse PerformUtibaOperation(IMovilwayApiRequest requestObject, UMarketSCClient utibaClientProxy, String sessionID)
        {
            RegisterAgentRequestBody  request  = requestObject as RegisterAgentRequestBody;
            RegisterAgentResponseBody response = new RegisterAgentResponseBody();

            if (AgentRegistrationUtils.AddAgentToFile(request.Agent, 1))
            {
                response.ResponseCode    = 0;
                response.ResponseMessage = "Agente agregado satisfactoriamente al archivo de carga";
            }
            else
            {
                response.ResponseCode    = 1;
                response.ResponseMessage = "Ocurrio un error tratando de agregar el agente al archivo de carga";
            }
            return(response);
        }
        public override IMovilwayApiResponse PerformUtibaOperation(IMovilwayApiRequest requestObject, UMarketSCClient utibaClientProxy, String sessionID)
        {
            RegisterAgentBulkRequestBody  request  = requestObject as RegisterAgentBulkRequestBody;
            RegisterAgentBulkResponseBody response = new RegisterAgentBulkResponseBody();

            if (request.Agents != null && request.Agents.Count > 0)
            {
                int     counter = 1;
                Boolean failed  = false;
                foreach (AgentDetails agentInfo in request.Agents)
                {
                    if (!AgentRegistrationUtils.AddAgentToFile(agentInfo, request.Agents.Count))
                    {
                        failed = true;
                    }
                    counter++;
                }

                RegisterAgentBulkResponseBody responseBody = new RegisterAgentBulkResponseBody();
                if (failed)
                {
                    responseBody.ResponseCode    = 1;
                    responseBody.ResponseMessage = "Algunos de los registros en el archivo fallaron, por favor contacte a soporte";
                }
                else
                {
                    responseBody.ResponseCode    = 0;
                    responseBody.ResponseMessage = "Su peticion ha sido procesada";
                }
            }
            else
            {
                response = new RegisterAgentBulkResponseBody()
                {
                    ResponseCode    = 1,
                    ResponseMessage = "Su peticion falló por no contener agentes, por favor verifique los datos e intente de nuevo",
                    TransactionID   = 0
                };
            }
            return(response);
        }