Exemplo n.º 1
0
        public override IMovilwayApiResponse PerformKinacuOperation(IMovilwayApiRequest requestObject, SaleInterface kinacuWS, String sessionID)
        {
            if (sessionID.Equals("0"))
            {
                return new GetAgentGroupsResponseBody()
                       {
                           ResponseCode    = 90,
                           ResponseMessage = "error session",
                           TransactionID   = 0,
                           GroupList       = new GroupList()
                       }
            }
            ;

            GetAgentGroupsRequestBody  request  = requestObject as GetAgentGroupsRequestBody;
            GetAgentGroupsResponseBody response = null;

            ManagementInterface managementWS = new ManagementInterface();

            KinacuManagementWebService.PrivilegeInfo[] privileges;
            String message;

            bool result = managementWS.GetPrivileges(int.Parse(sessionID), null, out privileges, out message);

            if (result)
            {
                response = new GetAgentGroupsResponseBody()
                {
                    ResponseCode    = 0,
                    ResponseMessage = "exito",
                    TransactionID   = 0
                };

                if (privileges.Count() > 0)
                {
                    response.GroupList = new GroupList();
                    foreach (KinacuManagementWebService.PrivilegeInfo privilege in privileges)
                    {
                        response.GroupList.Add(new GroupInfo()
                        {
                            GroupID  = long.Parse(privilege.Id.ToString()),
                            Name     = privilege.Name,
                            Category = privilege.Type
                                       //Type = privilege.Type
                        });
                    }
                }
            }
            else
            {
                return(new GetAgentGroupsResponseBody()
                {
                    ResponseCode = 99,
                    ResponseMessage = message,
                    TransactionID = 0
                });
            }
            return(response);
        }
    }
Exemplo n.º 2
0
        public override IMovilwayApiResponse PerformUtibaOperation(IMovilwayApiRequest requestObject, UMarketSCClient utibaClientProxy, String sessionID)
        {
            GetAgentGroupsRequestBody  request  = requestObject as GetAgentGroupsRequestBody;
            GetAgentGroupsResponseBody response = null;

            GetAgentInfoResponseBody agentInfo = new ServiceExecutionDelegator <GetAgentInfoResponseBody, GetAgentInfoRequestBody>().ResolveRequest(
                new GetAgentInfoRequestBody()
            {
                AuthenticationData = new AuthenticationData()
                {
                    SessionID = sessionID
                },
                Agent      = request.Agent,
                DeviceType = request.DeviceType
            }, ApiTargetPlatform.Utiba, ApiServiceName.GetAgentInfo);

            AgentGroupsResponse utibaAgentGroupsResponse = utibaClientProxy.getAgentGroupByAgentID(new getAgentGroupByAgentID()
            {
                getAgentGroupByAgentIDRequest = new getAgentGroupByAgentIDRequest()
                {
                    sessionid   = sessionID,
                    device_type = request.DeviceType,
                    agentID     = agentInfo.AgentInfo.AgentID
                }
            });

            if (utibaAgentGroupsResponse != null)
            {
                response = new GetAgentGroupsResponseBody()
                {
                    ResponseCode    = Utils.BuildResponseCode(utibaAgentGroupsResponse.AgentGroupsReturn.result, utibaAgentGroupsResponse.AgentGroupsReturn.result_namespace),
                    ResponseMessage = utibaAgentGroupsResponse.AgentGroupsReturn.result_namespace,
                    TransactionID   = utibaAgentGroupsResponse.AgentGroupsReturn.transid
                };

                if (utibaAgentGroupsResponse.AgentGroupsReturn.agentGroups != null &&
                    utibaAgentGroupsResponse.AgentGroupsReturn.agentGroups.Length > 0)
                {
                    response.GroupList = new GroupList();
                    foreach (AgentGroup agentGroup in utibaAgentGroupsResponse.AgentGroupsReturn.agentGroups)
                    {
                        response.GroupList.Add(new GroupInfo()
                        {
                            GroupID  = agentGroup.ID,
                            Name     = agentGroup.name,
                            Category = agentGroup.category,
                            Type     = agentGroup.type
                        });
                    }
                }
            }
            return(response);
        }