Exemple #1
0
        public static Respuesta AltaEquipoUsuario(Modelo.Entidades.EquipoUsuario equipo)
        {
            Respuesta respuesta = new Respuesta();

            respuesta.Exito   = true;
            respuesta.Errores = new List <string>();
            try
            {
                PlanDePago _plan = new PlanDePago();
                _plan     = ConsultarDAO.PlanDePagoUsuario(equipo.IdUsuario);
                respuesta = Validar.AltaEquipoUsuario(equipo, _plan);
                if (respuesta.Exito == true)
                {
                    respuesta.Id = GuardarDAO.AltaEquipoUsuario(equipo);
                }
            }
            catch (Exception ex)
            {
                respuesta.Exito = false;
                respuesta.Errores.Add(ex.Message);
            }
            return(respuesta);
        }
Exemple #2
0
        public static Respuesta AltaPartido(Modelo.Entidades.Partido partido)
        {
            Respuesta respuesta = new Respuesta();

            respuesta.Exito   = true;
            respuesta.Errores = new List <string>();
            try
            {
                respuesta = Validar.AltaPartido(partido);
                if (respuesta.Exito == true)
                {
                    int resultadoA = Convert.ToInt32(partido.MarcadorLocal);
                    int resultadoB = Convert.ToInt32(partido.MarcadorVisitante);
                    partido.Marcador = partido.MarcadorLocal + "a" + partido.MarcadorVisitante;
                    string condicion = partido.Condicion;
                    if (condicion == "1")
                    {
                        condicion = "LOCAL";
                    }
                    else
                    {
                        condicion = "VISITANTE";
                    }

                    if (condicion == "LOCAL")
                    {
                        if (resultadoA > resultadoB)
                        {
                            partido.Resultado = "GANO";
                        }
                        else if (resultadoA < resultadoB)
                        {
                            partido.Resultado = "PERDIO";
                        }
                        else
                        {
                            partido.Resultado = "EMPATO";
                        }
                        partido.Condicion = condicion;
                        respuesta.Id      = GuardarDAO.AltaPartido(partido);
                    }
                    else
                    {
                        if (resultadoA > resultadoB)
                        {
                            partido.Resultado = "PERDIO";
                        }
                        else if (resultadoA < resultadoB)
                        {
                            partido.Resultado = "GANO";
                        }
                        else
                        {
                            partido.Resultado = "EMPATO";
                        }
                        partido.Condicion = condicion;
                        respuesta.Id      = GuardarDAO.AltaPartido(partido);
                    }
                }
            }
            catch (Exception ex)
            {
                respuesta.Exito = false;
                respuesta.Errores.Add(ex.Message);
            }
            return(respuesta);
        }