public InterfacePoints GetPoints(string Login, string Token) { InterfacePoints interfacePoints = null; try { Sam9araujo.NameProject.Service.Omnion.Login usuario = OmnionLoginEngine.Instance.Get(Login, Token); if (usuario.CodigoErro == 0) { interfacePoints = new InterfacePoints((decimal)usuario.Saldo, GetPointsEnum.CONSULTA_REALIZADA_COM_SUCESSO); Logger.Log(Server.MapPath("~/WS_GetPoints.log"), "CONSULTA_REALIZADA_COM_SUCESSO", true, true); } else { interfacePoints = new InterfacePoints(0, GetPointsEnum.ERRO_NA_CONSULTA); Logger.Log(Server.MapPath("~/WS_GetPoints.log"), "ERRO_NA_CONSULTA", true, true); } } catch (Exception ex) { interfacePoints = new InterfacePoints(0, GetPointsEnum.ERRO_NA_CONSULTA); Logger.WriteLogError("GetPoints", ex); } return interfacePoints; }
public InterfacePoints ValidateOrder2(string Login, string Token, decimal Points, int OrderId, int Parceiro) { InterfacePoints interfacePoints; try { Sam9araujo.NameProject.Service.Omnion.UsuarioPedido usuarioPedido = new Sam9araujo.NameProject.Service.Omnion.UsuarioPedido(); usuarioPedido.Usuario = OmnionLoginEngine.Instance.Get(Login, Token); Logger.Log(Server.MapPath("~/WS_ValidateOrder.log"), "Parceiro: " + Parceiro, true, false); Logger.Log(Server.MapPath("~/WS_ValidateOrder.log"), "OrderID: " + OrderId, false, false); Logger.Log(Server.MapPath("~/WS_ValidateOrder.log"), "Pontos Recebidos: " + Points, false, false); if (usuarioPedido.Usuario.CodigoErro == 0) { decimal saldoAtual = (decimal)usuarioPedido.Usuario.Saldo; if (saldoAtual >= Points) { OrderPointsTemp orderPointsTemp = OrderPointsTempRepository.Instance.Obter(OrderId, Parceiro); if (orderPointsTemp != null) { orderPointsTemp.Points = (int)Points; OrderPointsTempRepository.Instance.Update(orderPointsTemp); } else { orderPointsTemp = new OrderPointsTemp(); { orderPointsTemp.IdOrder = OrderId; orderPointsTemp.Points = (int)Points; orderPointsTemp.IdParceiro = Parceiro; } OrderPointsTempRepository.Instance.Insert(orderPointsTemp); } Logger.Log(Server.MapPath("~/WS_ValidateOrder.log"), "Qntde de pontos do usuario: " + usuarioPedido.Usuario.Saldo.ToString(), false, false); Logger.Log(Server.MapPath("~/WS_ValidateOrder.log"), "CPF: " + usuarioPedido.Usuario.CPF, false, false); interfacePoints = new InterfacePoints(saldoAtual, GetPointsEnum.CONSULTA_REALIZADA_COM_SUCESSO); } else { Logger.Log(Server.MapPath("~/WS_ValidateOrder.log"), "Saldo Insuficiente" + usuarioPedido.Usuario.Saldo.ToString(), false, false); interfacePoints = new InterfacePoints(0, GetPointsEnum.ERRO_NA_CONSULTA); } } else { interfacePoints = new InterfacePoints(0, GetPointsEnum.ERRO_NA_CONSULTA); } } catch (Exception ex) { interfacePoints = new InterfacePoints(0, GetPointsEnum.ERRO_NA_CONSULTA); Logger.Log(Server.MapPath("~/WS_ValidateOrder.log"), "Excessão, consultar LOG: " + DateTime.Now, false, true); Logger.WriteLogError("ValidateOrder", ex); } return interfacePoints; }