Example #1
0
        public bool Update(string currentUser, Framework.DataServices.Model.EntityBaseData entry, out int errorNumber, out string errorDescription)
        {
            errorNumber      = 0;
            errorDescription = null;

            Model.Campeonatos.Jogo entryData = (Model.Campeonatos.Jogo)entry;

            base.ExecuteNonQuery(CommandType.StoredProcedure, base._commandUpdate, true, currentUser,
                                 base.Parameters.Create("IdJogo", DbType.Int64, entryData.IDJogo),
                                 base.Parameters.Create("Titulo", DbType.String, entryData.Titulo),
                                 base.Parameters.Create("NomeFase", DbType.String, entryData.Fase == null ? null : entryData.Fase.Nome),
                                 base.Parameters.Create("NomeCampeonato", DbType.String, entryData.Campeonato.Nome),
                                 base.Parameters.Create("NomeTime1", DbType.String, entryData.Time1 == null ? null : entryData.Time1.Nome),
                                 base.Parameters.Create("NomeTime2", DbType.String, entryData.Time2 == null ? null : entryData.Time2.Nome),
                                 base.Parameters.Create("Gols1", DbType.Int16, entryData.GolsTime1),
                                 base.Parameters.Create("Gols2", DbType.Int16, entryData.GolsTime2),
                                 base.Parameters.Create("Penaltis1", DbType.Int16, entryData.PenaltisTime1),
                                 base.Parameters.Create("Penaltis2", DbType.Int16, entryData.PenaltisTime2),
                                 base.Parameters.Create("DataJogo", DbType.DateTime, entryData.DataJogo),
                                 base.Parameters.Create("Rodada", DbType.String, entryData.GolsTime1),
                                 base.Parameters.Create("IsValido", DbType.Boolean, entryData.PartidaValida),
                                 base.Parameters.Create("DataValidacao", DbType.DateTime, entryData.DataValidacao),
                                 base.Parameters.Create("NomeGrupo", DbType.String, entryData.Grupo == null ? null : entryData.Grupo.Nome),
                                 base.Parameters.Create("ValidadoBy", DbType.String, entryData.ValidadoBy),
                                 base.Parameters.Create("NomeEstadio", DbType.String, entryData.Estadio == null ? null :  entryData.Estadio.Nome),
                                 base.Parameters.Create("DescricaoTime1", DbType.String, entryData.DescricaoTime1),
                                 base.Parameters.Create("DescricaoTime2", DbType.String, entryData.DescricaoTime2),
                                 base.Parameters.Create("@ReturnValue", DbType.Int32, ParameterDirection.ReturnValue, null)
                                 );


            return(Convert.ToInt32(base.ExecutionStatus.Command.Parameters["@ReturnValue"].Value) >= 1 ? true : false);
        }
Example #2
0
        public void Copy(Model.Campeonatos.Jogo entry)
        {
            _campeonato     = entry._campeonato;
            _dataJogo       = entry._dataJogo;
            _dataValidacao  = entry._dataValidacao;
            _descricaoTime1 = entry._descricaoTime1;
            _descricaoTime2 = entry._descricaoTime2;
            _estadio        = entry._estadio;
            _fase           = entry._fase;
            _golsTime1      = entry._golsTime1;
            _golsTime2      = entry._golsTime2;
            _grupo          = entry._grupo;
            _idJogo         = entry._idJogo;
            _partidaValida  = entry._partidaValida;
            _penaltisTime1  = entry._penaltisTime1;
            _penaltisTime2  = entry._penaltisTime2;
            _rodada         = entry._rodada;
            _time1          = entry._time1;
            _time2          = entry._time2;
            _titulo         = entry._titulo;
            _validadoBy     = entry._validadoBy;
            _jogoLabel      = entry._jogoLabel;

            _pendenteTime1Ganhador = entry._pendenteTime1Ganhador;
            _pendenteTime2Ganhador = entry._pendenteTime2Ganhador;
            _pendenteIdTime1       = entry._pendenteIdTime1;
            _pendenteIdTime2       = entry._pendenteIdTime2;
        }
        protected void grdJogos_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType != DataControlRowType.DataRow)
            {
                return;
            }


            Model.Campeonatos.Jogo entry = (Model.Campeonatos.Jogo)e.Row.DataItem;

            Label lblGolsTime1 = (Label)e.Row.FindControl("lblGolsTime1");
            Label lblGolsTime2 = (Label)e.Row.FindControl("lblGolsTime2");


            if (entry.PartidaValida)
            {
                lblGolsTime1.Text = entry.GolsTime1.ToString();
                lblGolsTime2.Text = entry.GolsTime2.ToString();
            }
            else
            {
                lblGolsTime1.Text = "-";
                lblGolsTime2.Text = "-";
            }
        }
Example #4
0
        //#region Methods

        //public static IList<Framework.DataServices.Model.EntityBaseData> ConvertToList(DataTable table)
        //{
        //    IList<Framework.DataServices.Model.EntityBaseData> list = new List<Framework.DataServices.Model.EntityBaseData>();

        //    foreach (DataRow row in table.Rows)
        //    {
        //        list.Add(ConvertToObject(row));
        //    }

        //    return list;
        //}
        //public static Framework.DataServices.Model.EntityBaseData ConvertToObject(DataRow row)
        //{
        //    long idJogo = 0;

        //    if (row.Table.Columns.Contains("IdJogo") && !Convert.IsDBNull(row["IdJogo"]))
        //    {
        //        idJogo = Convert.ToInt64(row["IdJogo"]);
        //    }

        //    Model.Campeonatos.Jogo jogo = new Model.Campeonatos.Jogo (idJogo);
        //    jogo.LoadDataRow(row);

        //    if (row.Table.Columns.Contains("NomeCampeonato") && !Convert.IsDBNull(row["NomeCampeonato"]))
        //    {
        //        jogo.Campeonato = new Model.Campeonatos.Campeonato(Convert.ToString(row["NomeCampeonato"]));
        //    }

        //    if (row.Table.Columns.Contains("NomeFase") && !Convert.IsDBNull(row["NomeFase"]))
        //    {
        //        jogo.Fase = new Model.Campeonatos.Fase (Convert.ToString(row["NomeFase"]));
        //    }

        //    if (row.Table.Columns.Contains("NomeGrupo") && !Convert.IsDBNull(row["NomeGrupo"]))
        //    {
        //        jogo.Grupo = new Model.Campeonatos.Grupo(Convert.ToString(row["NomeGrupo"]));
        //    }

        //    if (row.Table.Columns.Contains("Titulo") && !Convert.IsDBNull(row["Titulo"]))
        //    {
        //        jogo.Titulo = Convert.ToString(row["Titulo"]);
        //    }

        //    if (row.Table.Columns.Contains("NomeTime1") && !Convert.IsDBNull(row["NomeTime1"]))
        //    {
        //        jogo.Time1 = new Model.DadosBasicos.Time(Convert.ToString(row["NomeTime1"]));
        //    }

        //    if (row.Table.Columns.Contains("Gols1") && !Convert.IsDBNull(row["Gols1"]))
        //    {
        //        jogo.GolsTime1 = Convert.ToInt32(row["Gols1"]);
        //    }

        //    if (row.Table.Columns.Contains("Penaltis1") && !Convert.IsDBNull(row["Penaltis1"]))
        //    {
        //        jogo.PenaltisTime1 = Convert.ToInt32(row["Penaltis1"]);
        //    }


        //    if (row.Table.Columns.Contains("DescricaoTime1") && !Convert.IsDBNull(row["DescricaoTime1"]))
        //    {
        //        jogo.DescricaoTime1 = Convert.ToString(row["DescricaoTime1"]);
        //    }

        //    if (row.Table.Columns.Contains("NomeTime2") && !Convert.IsDBNull(row["NomeTime2"]))
        //    {
        //        jogo.Time2 = new Model.DadosBasicos.Time(Convert.ToString(row["NomeTime2"]));
        //    }

        //    if (row.Table.Columns.Contains("Gols2") && !Convert.IsDBNull(row["Gols2"]))
        //    {
        //        jogo.GolsTime2 = Convert.ToInt32(row["Gols2"]);
        //    }

        //    if (row.Table.Columns.Contains("Penaltis2") && !Convert.IsDBNull(row["Penaltis2"]))
        //    {
        //        jogo.PenaltisTime2 = Convert.ToInt32(row["Penaltis2"]);
        //    }

        //    if (row.Table.Columns.Contains("DescricaoTime2") && !Convert.IsDBNull(row["DescricaoTime2"]))
        //    {
        //        jogo.DescricaoTime2 = Convert.ToString(row["DescricaoTime2"]);
        //    }

        //    if (row.Table.Columns.Contains("DataJogo") && !Convert.IsDBNull(row["DataJogo"]))
        //    {
        //        jogo.DataJogo = Convert.ToDateTime(row["DataJogo"]);
        //    }

        //    if (row.Table.Columns.Contains("Rodada") && !Convert.IsDBNull(row["Rodada"]))
        //    {
        //        jogo.Rodada = Convert.ToInt32(row["Rodada"]);
        //    }

        //    if (row.Table.Columns.Contains("IsValido") && !Convert.IsDBNull(row["IsValido"]))
        //    {
        //        jogo.PartidaValida = Convert.ToBoolean(row["IsValido"]);
        //    }

        //    if (row.Table.Columns.Contains("DataValidacao") && !Convert.IsDBNull(row["DataValidacao"]))
        //    {
        //        jogo.DataValidacao = Convert.ToDateTime(row["DataValidacao"]);
        //    }

        //    if (row.Table.Columns.Contains("ValidadoBy") && !Convert.IsDBNull(row["ValidadoBy"]))
        //    {
        //        jogo.ValidadoBy = Convert.ToString(row["ValidadoBy"]);
        //    }

        //    if (row.Table.Columns.Contains("NomeEstadio") && !Convert.IsDBNull(row["NomeEstadio"]))
        //    {
        //        jogo.Estadio = new Model.DadosBasicos.Estadio(Convert.ToString(row["NomeEstadio"]));
        //    }

        //    return jogo;

        //}


        //#endregion

        #region IJogo Members

        public Framework.DataServices.Model.EntityBaseData Load(string currentUser, Framework.DataServices.Model.EntityBaseData entry, out int errorNumber, out string errorDescription)
        {
            errorNumber      = 0;
            errorDescription = null;

            Model.Campeonatos.Jogo entryData = (Model.Campeonatos.Jogo)entry;


            DataTable table = base.ExecuteFill(CommandType.StoredProcedure, base._commandSelect, true, currentUser,
                                               base.Parameters.Create("@IdJogo", DbType.String, entryData.IDJogo),
                                               base.Parameters.Create("@NomeCampeonato", DbType.String, entryData.Campeonato.Nome),
                                               base.Parameters.Create("@ReturnValue", DbType.Int32, ParameterDirection.ReturnValue, null)
                                               );

            int rowsFound = Convert.ToInt32(base.ExecutionStatus.Command.Parameters["@ReturnValue"].Value);

            if (rowsFound == 0)
            {
                return(null);
            }
            //throw new Exception("There is no item found in database with this ID.");


            return(Util.Jogo.ConvertToObject(table.Rows[0]));
        }
Example #5
0
        public bool UpdateFacebook(Model.Boloes.Bolao bolao, string userName, Model.Campeonatos.Jogo jogo)
        {
            int    errorNumber      = 0;
            string errorDescription = null;


            bool result = _daoBase.UpdateFacebook(_currentLogin, bolao, userName, jogo, out errorNumber, out errorDescription);

            return(result);
        }
Example #6
0
        public Jogo(string currentLogin, Model.Campeonatos.Jogo jogo)
        {
            if (jogo == null)
            {
                throw new ArgumentNullException("jogo");
            }

            _currentLogin = currentLogin;
            _daoBase      = new Dao.Campeonatos.SQLSupport.Jogo();

            this.Copy(jogo);
        }
Example #7
0
        public Model.Boloes.JogoUsuario SetValue(Model.Campeonatos.Jogo jogo, Model.Boloes.JogoUsuario Apostas)
        {
            Model.Boloes.JogoUsuario entry = new BolaoNet.Model.Boloes.JogoUsuario();
            entry.Copy(jogo);
            entry.ApostaTime1 = Apostas.ApostaTime1;
            entry.ApostaTime2 = Apostas.ApostaTime2;


            entry.Time1 = Apostas.Time1;
            entry.Time2 = Apostas.Time2;

            return(entry);
        }
Example #8
0
        public bool InsertWithAllData(bool isClube, Framework.DataServices.Model.EntityBaseData entry)
        {
            int    errorNumber      = 0;
            string errorDescription = null;

            Model.Campeonatos.Jogo jogo = (Model.Campeonatos.Jogo)entry;

            bool result = _daoBase.InsertWithAllData(_currentLogin, isClube, entry, out errorNumber, out errorDescription);

            if (errorNumber > 0 || !string.IsNullOrEmpty(errorDescription))
            {
                return(false);
            }

            return(result);
        }
Example #9
0
        public bool Delete(string currentUser, Framework.DataServices.Model.EntityBaseData entry, out int errorNumber, out string errorDescription)
        {
            errorNumber      = 0;
            errorDescription = null;

            Model.Campeonatos.Jogo entryData = (Model.Campeonatos.Jogo)entry;

            base.ExecuteNonQuery(CommandType.StoredProcedure, base._commandDelete, true, currentUser,
                                 base.Parameters.Create("@NomeCampeonato", DbType.String, entryData.Campeonato.Nome),
                                 base.Parameters.Create("@IDJogo", DbType.Int64, entryData.IDJogo),
                                 base.Parameters.Create("@ReturnValue", DbType.Int32, ParameterDirection.ReturnValue, null)
                                 );


            return(Convert.ToInt32(base.ExecutionStatus.Command.Parameters["@ReturnValue"].Value) >= 1 ? true : false);
        }
Example #10
0
        public Jogo(string currentLogin, BolaoNet.Dao.Campeonatos.IDaoJogo daoBase, Model.Campeonatos.Jogo jogo)
        {
            if (jogo == null)
            {
                throw new ArgumentNullException("jogo");
            }

            if (daoBase == null)
            {
                throw new ArgumentNullException("daoBase");
            }

            _currentLogin = currentLogin;
            _daoBase      = daoBase;

            this.Copy(jogo);
        }
Example #11
0
        private void Save()
        {
            Model.Campeonatos.Jogo jogo = this.JogoDetail.Jogo;

            Business.Campeonatos.Support.Jogo business = new BolaoNet.Business.Campeonatos.Support.Jogo(
                base.UserName, jogo);


            //Se não conseguiu inserir o resultado
            if (!business.InsertResult(
                    jogo.GolsTime1, jogo.GolsTime2,
                    jogo.PenaltisTime1, jogo.PenaltisTime2))
            {
                base.ShowErrors("Ocorreu um erro interno ao tentar salvar o resultado.");
            }
            //Se conseguiu inserir o resultado
            else
            {
                base.ShowMessages("Jogo armazenado com sucesso.");
            }//endif inserir o resultado
        }
        protected void btnSimular_Click(object sender, EventArgs e)
        {
            Model.Campeonatos.Jogo jogo = this.ctlJogoDetail.Jogo;

            SetDefaultPontos();

            foreach (Model.Boloes.Simulation.JogoUsuarioPosicao entry in JogoUsuarios)
            {
                entry.GolsTime1 = jogo.GolsTime1;
                entry.GolsTime2 = jogo.GolsTime2;
                entry.Time1     = jogo.Time1;
                entry.Time2     = jogo.Time2;

                entry.NomeTimeResult1 = jogo.Time1;
                entry.NomeTimeResult2 = jogo.Time2;

                CalculePontos(entry, Criterios, CriteriosTimes);
            }

            this.grdJogosUsuarios.DataSource = OrderPontos(JogoUsuarios);
            this.grdJogosUsuarios.DataBind();
        }
Example #13
0
        public bool InsertResult(string currentUser, int gols1, int gols2, int penaltis1, int penaltis2, Framework.DataServices.Model.EntityBaseData entry, out int errorNumber, out string errorDescription)
        {
            errorNumber      = 0;
            errorDescription = null;

            Model.Campeonatos.Jogo entryData = (Model.Campeonatos.Jogo)entry;

            base.ExecuteNonQuery(CommandType.StoredProcedure, "sp_Jogos_ResultInsert", true, currentUser,
                                 base.Parameters.Create("@NomeCampeonato", DbType.String, entryData.Campeonato.Nome),
                                 base.Parameters.Create("@IDJogo", DbType.Int64, entryData.IDJogo),
                                 base.Parameters.Create("@Gols1", DbType.Int16, gols1),
                                 base.Parameters.Create("@Gols2", DbType.Int16, gols2),
                                 base.Parameters.Create("@Penaltis1", DbType.Int16, penaltis1),
                                 base.Parameters.Create("@Penaltis2", DbType.Int16, penaltis2),
                                 base.Parameters.Create("@SetCurrentData", DbType.Boolean, true),
                                 base.Parameters.Create("@ValidadoBy", DbType.String, currentUser),
                                 base.Parameters.Create("@ReturnValue", DbType.Int32, ParameterDirection.ReturnValue, null)
                                 );


            return(Convert.ToInt32(base.ExecutionStatus.Command.Parameters["@ReturnValue"].Value) == 1 ? true : false);
        }
Example #14
0
        public bool InsertWithAllData(string currentUser, bool isClube, Framework.DataServices.Model.EntityBaseData entry, out int errorNumber, out string errorDescription)
        {
            errorNumber      = 0;
            errorDescription = null;

            Model.Campeonatos.Jogo entryData = (Model.Campeonatos.Jogo)entry;

            base.ExecuteNonQuery(CommandType.StoredProcedure, "sp_Jogos_InsertAllData", true, currentUser,
                                 base.Parameters.Create("NomeFase", DbType.String, entryData.Fase == null ? null : entryData.Fase.Nome),
                                 base.Parameters.Create("IsClube", DbType.Boolean, isClube),
                                 base.Parameters.Create("Titulo", DbType.String, entryData.Titulo),
                                 base.Parameters.Create("NomeCampeonato", DbType.String, entryData.Campeonato.Nome),
                                 base.Parameters.Create("NomeTime1", DbType.String, entryData.Time1 == null ? null : entryData.Time1.Nome),
                                 base.Parameters.Create("NomeTime2", DbType.String, entryData.Time2 == null ? null : entryData.Time2.Nome),
                                 base.Parameters.Create("Gols1", DbType.Int16, entryData.GolsTime1),
                                 base.Parameters.Create("Gols2", DbType.Int16, entryData.GolsTime2),
                                 base.Parameters.Create("Penaltis1", DbType.Int16, entryData.PenaltisTime1),
                                 base.Parameters.Create("Penaltis2", DbType.Int16, entryData.PenaltisTime2),
                                 base.Parameters.Create("DataJogo", DbType.DateTime, entryData.DataJogo),
                                 base.Parameters.Create("Rodada", DbType.String, entryData.Rodada),
                                 base.Parameters.Create("IsValido", DbType.Boolean, entryData.PartidaValida),
                                 base.Parameters.Create("NomeGrupo", DbType.String, entryData.Grupo == null ? null : entryData.Grupo.Nome),
                                 base.Parameters.Create("NomeEstadio", DbType.String, entryData.Estadio == null ? null : entryData.Estadio.Nome),
                                 base.Parameters.Create("DescricaoTime1", DbType.String, entryData.DescricaoTime1),
                                 base.Parameters.Create("DescricaoTime2", DbType.String, entryData.DescricaoTime2),

                                 base.Parameters.Create("JogoLabel", DbType.String, entryData.JogoLabel),

                                 base.Parameters.Create("@ReturnValue", DbType.Int32, ParameterDirection.ReturnValue, null)
                                 );


            ((Model.Campeonatos.Jogo)entry).IDJogo = Convert.ToInt32(base.ExecutionStatus.Command.Parameters["@ReturnValue"].Value);

            errorNumber      = base.ExecutionStatus.ErrorNumber;
            errorDescription = base.ExecutionStatus.ErrorDescription;

            return(Convert.ToInt32(base.ExecutionStatus.Command.Parameters["@ReturnValue"].Value) > 0 ? true : false);
        }
Example #15
0
        public Model.Boloes.JogoUsuario LoadSocialNetwork(Model.Boloes.Bolao bolao, string userName, Model.Campeonatos.Jogo jogo)
        {
            int    errorNumber      = 0;
            string errorDescription = null;

            IList <Model.Boloes.JogoUsuario> list = _daoBase.LoadSocialNetwork(_currentLogin, bolao, userName, jogo, out errorNumber, out errorDescription);

            if (list == null || list.Count == 0)
            {
                return(null);
            }
            else
            {
                return(list[0]);
            }
        }
Example #16
0
        public void SetJogo(Model.Campeonatos.Jogo jogo)
        {
            if (jogo.DataJogo == DateTime.MinValue)
            {
                this.lblDataJogo.Text = "";
                this.lblHoraJogo.Text = "";
            }
            else
            {
                this.lblDataJogo.Text = jogo.DataJogo.ToString("dd/MM/yyyy");
                this.lblHoraJogo.Text = jogo.DataJogo.ToString("HH:mm");
            }



            if (!jogo.PartidaValida)
            {
                this.lblDataValidacao.Text = "-";
                this.chkValido.Checked     = false;
                this.lblValidadoBy.Text    = "-";
            }
            else
            {
                this.lblDataValidacao.Text = jogo.DataValidacao.ToString("dd/MM/yyyy HH:mm:ss");
                this.chkValido.Checked     = true;
                this.lblValidadoBy.Text    = jogo.ValidadoBy;
            }



            this.lblDescricaoTime1.Text = jogo.DescricaoTime1;
            this.lblDescricaoTime2.Text = jogo.DescricaoTime2;

            if (jogo.Estadio == null)
            {
                this.lblEstadio.Text = "";
            }
            else
            {
                this.lblEstadio.Text = jogo.Estadio.Nome;
            }


            if (jogo.Fase == null)
            {
                this.lblFase.Text = "";
            }
            else
            {
                this.lblFase.Text = jogo.Fase.Nome;
            }

            if (jogo.Grupo == null)
            {
                this.lblGrupo.Text = "";
            }
            else
            {
                this.lblGrupo.Text = jogo.Grupo.Nome;
            }

            if (jogo.Rodada == 0)
            {
                this.lblRodada.Text = "";
            }
            else
            {
                this.lblRodada.Text = jogo.Rodada.ToString();
            }

            if (jogo.Time1 == null)
            {
                this.lblTime1.Text = "";
            }
            else
            {
                this.lblTime1.Text     = jogo.Time1.Nome;
                this.imgTime1.ImageUrl = "/Images/database/Times/" + jogo.Time1.Nome + ".gif";
            }


            if (jogo.Time2 == null)
            {
                this.lblTime2.Text = "";
            }
            else
            {
                this.lblTime2.Text = jogo.Time2.Nome;

                this.imgTime2.ImageUrl = "/Images/database/Times/" + jogo.Time2.Nome + ".gif";
            }

            if (string.IsNullOrEmpty(jogo.Titulo))
            {
                this.lblTitulo.Text = "Jogo";
            }
            else
            {
                this.lblTitulo.Text = jogo.Titulo;
            }


            this.lblIDJogo.Text = jogo.IDJogo.ToString();


            this.txtGols1.Text = jogo.GolsTime1.ToString();
            this.lblGols1.Text = this.txtGols1.Text;

            this.txtGols2.Text = jogo.GolsTime2.ToString();
            this.lblGols2.Text = this.txtGols2.Text;

            this.txtPenaltis1.Text = jogo.PenaltisTime1.ToString();
            this.lblPenaltis1.Text = this.txtPenaltis1.Text;

            this.txtPenaltis2.Text = jogo.PenaltisTime2.ToString();
            this.lblPenaltis2.Text = this.txtPenaltis2.Text;

            if (jogo.PenaltisTime1 > 0 || jogo.PenaltisTime2 > 0)
            {
                this.chkPenaltis.Checked  = true;
                this.cellPenaltis.Visible = true;
            }
            else
            {
                this.chkPenaltis.Checked  = false;
                this.cellPenaltis.Visible = false;
            }

            switch (JogoMode)
            {
            case Mode.New:
                this.chkPenaltis.Visible = false;
                break;

            case Mode.ReadOnly:
                this.chkPenaltis.Visible = false;
                break;

            case Mode.Result:
                this.chkPenaltis.Visible = true;
                break;
            }


            //this.chkPenaltis.Visible = this.cellPenaltis.Visible;



            if (jogo.Campeonato != null)
            {
                this.lblCampeonato.Text = jogo.Campeonato.Nome;
            }
            else
            {
                this.lblCampeonato.Text = "";
            }
        }
Example #17
0
 public VerifyJogoUsuario(Model.Campeonatos.Jogo jogo, Model.Boloes.JogoUsuario jogoUsuario)
 {
     _jogo        = jogo;
     _jogoUsuario = jogoUsuario;
 }
Example #18
0
        protected void grdJogos_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType != DataControlRowType.DataRow)
            {
                return;
            }


            Label lblGolsTime1 = (Label)e.Row.FindControl("lblGolsTime1");
            Label lblGolsTime2 = (Label)e.Row.FindControl("lblGolsTime2");

            //Verificando o tipo de lista que está sendo mostrado
            switch (ModeList)
            {
            case Mode.All:
            case Mode.JogosBolao:

                Model.Campeonatos.Jogo jogo = (Model.Campeonatos.Jogo)e.Row.DataItem;


                RadioButton rdoTime1Jogo = (RadioButton)e.Row.FindControl("rdoTime1");
                RadioButton rdoTime2Jogo = (RadioButton)e.Row.FindControl("rdoTime2");

                rdoTime1Jogo.Visible = false;
                rdoTime2Jogo.Visible = false;

                if (!jogo.PartidaValida)
                {
                    lblGolsTime1.Text = "-";
                    lblGolsTime2.Text = "-";
                }
                else
                {
                    e.Row.Cells[GridPosSimulacao].Visible = false;
                }



                break;

            case Mode.Apostas:


                Model.Boloes.JogoUsuario jogoUsuario = (Model.Boloes.JogoUsuario)e.Row.DataItem;

                TextBox txtAposta1 = (TextBox)e.Row.FindControl("txtAposta1");
                TextBox txtAposta2 = (TextBox)e.Row.FindControl("txtAposta2");

                Label lblID = (Label)e.Row.FindControl("lblID");

                Label lblAposta1 = (Label)e.Row.FindControl("lblAposta1");
                Label lblAposta2 = (Label)e.Row.FindControl("lblAposta2");

                Label lblPontos = (Label)e.Row.FindControl("lblPontos");

                Label    lblDataAposta = (Label)e.Row.FindControl("lblDataAposta");
                CheckBox chkApostaAuto = (CheckBox)e.Row.FindControl("chkApostaAuto");

                Label lblGrupo = (Label)e.Row.FindControl("lblGrupo");

                RadioButton rdoTime1 = (RadioButton)e.Row.FindControl("rdoTime1");
                RadioButton rdoTime2 = (RadioButton)e.Row.FindControl("rdoTime2");

                rdoTime1.Style.Add("visibility", "hidden");
                rdoTime2.Style.Add("visibility", "hidden");

                rdoTime1.Style.Add("display", "inline");
                rdoTime2.Style.Add("display", "inline");



                txtAposta1.Attributes.Add("onChange", "JavaScript:onChangeText('" + txtAposta1.ClientID + "','" + txtAposta2.ClientID + "','" + rdoTime1.ClientID + "','" + rdoTime2.ClientID + "','" + lblGrupo.ClientID + "')");
                txtAposta2.Attributes.Add("onChange", "JavaScript:onChangeText('" + txtAposta1.ClientID + "','" + txtAposta2.ClientID + "','" + rdoTime1.ClientID + "','" + rdoTime2.ClientID + "','" + lblGrupo.ClientID + "')");


                chkApostaAuto.Checked = jogoUsuario.Automatico;

                //Verificando se é jogo de eliminatórias
                if (jogoUsuario.Grupo == null || string.IsNullOrEmpty(jogoUsuario.Grupo.Nome.Trim()))
                {
                    //Se a aposta do usuário é de empate
                    if (jogoUsuario.ApostaTime1 == jogoUsuario.ApostaTime2)
                    {
                        rdoTime1.Style["visibility"] = "visible";
                        rdoTime2.Style["visibility"] = "visible";
                        if (jogoUsuario.Ganhador == 1)
                        {
                            rdoTime1.Checked = true;
                        }
                        else if (jogoUsuario.Ganhador == 2)
                        {
                            rdoTime2.Checked = true;
                        }
                    } //endif aposta empate
                }     //endif eliminatórias


                if (!IsEnabledToAposta(jogoUsuario, BolaoUserBasePage.CurrentBolao))
                {
                    lblAposta1.Visible = true;
                    lblAposta2.Visible = true;
                    txtAposta1.Visible = false;
                    txtAposta2.Visible = false;

                    rdoTime1.Enabled = false;
                    rdoTime2.Enabled = false;


                    //Se o jogo já aconteceu
                    if (jogoUsuario.PartidaValida)
                    {
                        rdoTime1.Enabled = false;
                        rdoTime2.Enabled = false;


                        lblPontos.Text = jogoUsuario.ApostaPontos.Pontos.ToString();

                        SetColumnColor(e.Row.Cells[GridPosPontos], jogoUsuario.Pontos, Pontuacoes);
                    }
                    //Se o jogo não aconteceu ainda
                    else
                    {
                        lblPontos.Text = "-";
                    }    //endif jogo aconteceu

                    //Se não houve apostas
                    if (jogoUsuario.DataAposta == DateTime.MinValue)
                    {
                        lblAposta1.Text = "-";
                        lblAposta2.Text = "-";
                    }
                    else
                    {
                        lblAposta1.Text = jogoUsuario.ApostaTime1.ToString();
                        lblAposta2.Text = jogoUsuario.ApostaTime2.ToString();
                    }    //endif houve apostas
                }
                else
                {
                    txtAposta1.Text = jogoUsuario.ApostaTime1.ToString();
                    txtAposta2.Text = jogoUsuario.ApostaTime2.ToString();


                    lblAposta1.Visible = false;
                    lblAposta2.Visible = false;
                    txtAposta1.Visible = true;
                    txtAposta2.Visible = true;


                    lblGolsTime1.Text = "-";
                    lblGolsTime2.Text = "-";
                    lblPontos.Text    = "-";
                }

                //Alteração para validar a aposta
                if (jogoUsuario.DataAposta == DateTime.MinValue)
                {
                    lblDataAposta.Text = "-";
                    txtAposta1.Text    = "";
                    txtAposta2.Text    = "";
                }
                else
                {
                    lblDataAposta.Text = jogoUsuario.DataAposta.ToString("dd/MM/yy HH:mm:ss");
                }



                break;

            case Mode.JogoByTime:

                break;


            case Mode.ApostasReadOnly:

                Model.Boloes.JogoUsuario jogoUsuarioReadOnly = (Model.Boloes.JogoUsuario)e.Row.DataItem;

                TextBox txtAposta1ReadOnly = (TextBox)e.Row.FindControl("txtAposta1");
                TextBox txtAposta2ReadOnly = (TextBox)e.Row.FindControl("txtAposta2");

                Label lblAposta1ReadOnly = (Label)e.Row.FindControl("lblAposta1");
                Label lblAposta2ReadOnly = (Label)e.Row.FindControl("lblAposta2");

                Label lblPontosReadOnly = (Label)e.Row.FindControl("lblPontos");

                Label    lblDataApostaReadOnly = (Label)e.Row.FindControl("lblDataAposta");
                CheckBox chkApostaAutoReadOnly = (CheckBox)e.Row.FindControl("chkApostaAuto");

                RadioButton rdoTime_1 = (RadioButton)e.Row.FindControl("rdoTime1");
                RadioButton rdoTime_2 = (RadioButton)e.Row.FindControl("rdoTime2");

                rdoTime_1.Enabled = false;
                rdoTime_2.Enabled = false;


                if (jogoUsuarioReadOnly.Grupo == null || string.IsNullOrEmpty(jogoUsuarioReadOnly.Grupo.Nome.Trim()))
                {
                    if (jogoUsuarioReadOnly.ApostaTime1 == jogoUsuarioReadOnly.ApostaTime2)
                    {
                        rdoTime_1.Style.Add("visibility", "visible");
                        rdoTime_2.Style.Add("visibility", "visible");

                        if (jogoUsuarioReadOnly.Ganhador == 1)
                        {
                            rdoTime_1.Checked = true;
                        }
                        else if (jogoUsuarioReadOnly.Ganhador == 2)
                        {
                            rdoTime_2.Checked = true;
                        }
                    }
                    else
                    {
                        rdoTime_1.Style.Add("visibility", "hidden");
                        rdoTime_2.Style.Add("visibility", "hidden");
                    }
                }
                else
                {
                    rdoTime_1.Style.Add("visibility", "hidden");
                    rdoTime_2.Style.Add("visibility", "hidden");
                }

                if (jogoUsuarioReadOnly.DataAposta == DateTime.MinValue)
                {
                    lblDataApostaReadOnly.Text = "-";
                }
                else
                {
                    lblDataApostaReadOnly.Text = jogoUsuarioReadOnly.DataAposta.ToString("dd/MM/yy HH:mm:ss");
                }
                chkApostaAutoReadOnly.Checked = jogoUsuarioReadOnly.Automatico;



                if (jogoUsuarioReadOnly.PartidaValida)
                {
                    lblAposta1ReadOnly.Text = jogoUsuarioReadOnly.ApostaTime1.ToString();
                    lblAposta2ReadOnly.Text = jogoUsuarioReadOnly.ApostaTime2.ToString();

                    lblAposta1ReadOnly.Visible = true;
                    lblAposta2ReadOnly.Visible = true;
                    txtAposta1ReadOnly.Visible = false;
                    txtAposta2ReadOnly.Visible = false;

                    lblPontosReadOnly.Text = jogoUsuarioReadOnly.ApostaPontos.Pontos.ToString();



                    SetColumnColor(e.Row.Cells[GridPosPontos], jogoUsuarioReadOnly.Pontos, Pontuacoes);
                }
                else
                {
                    lblAposta1ReadOnly.Text = jogoUsuarioReadOnly.ApostaTime1.ToString();
                    lblAposta2ReadOnly.Text = jogoUsuarioReadOnly.ApostaTime2.ToString();


                    lblAposta1ReadOnly.Visible = true;
                    lblAposta2ReadOnly.Visible = true;
                    txtAposta1ReadOnly.Visible = false;
                    txtAposta2ReadOnly.Visible = false;


                    lblGolsTime1.Text      = "-";
                    lblGolsTime2.Text      = "-";
                    lblPontosReadOnly.Text = "-";
                }


                break;
            }//end switch tipo de list
        }
Example #19
0
        public static Framework.DataServices.Model.EntityBaseData ConvertToObject(DataRow row)
        {
            long idJogo = 0;

            if (row.Table.Columns.Contains("IdJogo") && !Convert.IsDBNull(row["IdJogo"]))
            {
                idJogo = Convert.ToInt64(row["IdJogo"]);
            }

            Model.Campeonatos.Jogo jogo = new Model.Campeonatos.Jogo(idJogo);
            jogo.LoadDataRow(row);

            if (row.Table.Columns.Contains("NomeCampeonato") && !Convert.IsDBNull(row["NomeCampeonato"]))
            {
                jogo.Campeonato = new Model.Campeonatos.Campeonato(Convert.ToString(row["NomeCampeonato"]));
            }

            if (row.Table.Columns.Contains("NomeFase") && !Convert.IsDBNull(row["NomeFase"]))
            {
                jogo.Fase = new Model.Campeonatos.Fase(Convert.ToString(row["NomeFase"]));
            }

            if (row.Table.Columns.Contains("NomeGrupo") && !Convert.IsDBNull(row["NomeGrupo"]))
            {
                jogo.Grupo = new Model.Campeonatos.Grupo(Convert.ToString(row["NomeGrupo"]));
            }

            if (row.Table.Columns.Contains("Titulo") && !Convert.IsDBNull(row["Titulo"]))
            {
                jogo.Titulo = Convert.ToString(row["Titulo"]);
            }

            if (row.Table.Columns.Contains("NomeTime1") && !Convert.IsDBNull(row["NomeTime1"]))
            {
                jogo.Time1 = new Model.DadosBasicos.Time(Convert.ToString(row["NomeTime1"]));
            }

            if (row.Table.Columns.Contains("Gols1") && !Convert.IsDBNull(row["Gols1"]))
            {
                jogo.GolsTime1 = Convert.ToInt32(row["Gols1"]);
            }

            if (row.Table.Columns.Contains("Penaltis1") && !Convert.IsDBNull(row["Penaltis1"]))
            {
                jogo.PenaltisTime1 = Convert.ToInt32(row["Penaltis1"]);
            }


            if (row.Table.Columns.Contains("DescricaoTime1") && !Convert.IsDBNull(row["DescricaoTime1"]))
            {
                jogo.DescricaoTime1 = Convert.ToString(row["DescricaoTime1"]);
            }

            if (row.Table.Columns.Contains("NomeTime2") && !Convert.IsDBNull(row["NomeTime2"]))
            {
                jogo.Time2 = new Model.DadosBasicos.Time(Convert.ToString(row["NomeTime2"]));
            }

            if (row.Table.Columns.Contains("Gols2") && !Convert.IsDBNull(row["Gols2"]))
            {
                jogo.GolsTime2 = Convert.ToInt32(row["Gols2"]);
            }

            if (row.Table.Columns.Contains("Penaltis2") && !Convert.IsDBNull(row["Penaltis2"]))
            {
                jogo.PenaltisTime2 = Convert.ToInt32(row["Penaltis2"]);
            }

            if (row.Table.Columns.Contains("DescricaoTime2") && !Convert.IsDBNull(row["DescricaoTime2"]))
            {
                jogo.DescricaoTime2 = Convert.ToString(row["DescricaoTime2"]);
            }

            if (row.Table.Columns.Contains("DataJogo") && !Convert.IsDBNull(row["DataJogo"]))
            {
                jogo.DataJogo = Convert.ToDateTime(row["DataJogo"]);
            }

            if (row.Table.Columns.Contains("Rodada") && !Convert.IsDBNull(row["Rodada"]))
            {
                jogo.Rodada = Convert.ToInt32(row["Rodada"]);
            }

            if (row.Table.Columns.Contains("IsValido") && !Convert.IsDBNull(row["IsValido"]))
            {
                jogo.PartidaValida = Convert.ToBoolean(row["IsValido"]);
            }

            if (row.Table.Columns.Contains("DataValidacao") && !Convert.IsDBNull(row["DataValidacao"]))
            {
                jogo.DataValidacao = Convert.ToDateTime(row["DataValidacao"]);
            }

            if (row.Table.Columns.Contains("ValidadoBy") && !Convert.IsDBNull(row["ValidadoBy"]))
            {
                jogo.ValidadoBy = Convert.ToString(row["ValidadoBy"]);
            }

            if (row.Table.Columns.Contains("NomeEstadio") && !Convert.IsDBNull(row["NomeEstadio"]))
            {
                jogo.Estadio = new Model.DadosBasicos.Estadio(Convert.ToString(row["NomeEstadio"]));
            }

            if (row.Table.Columns.Contains("JogoLabel") && !Convert.IsDBNull(row["JogoLabel"]))
            {
                jogo.JogoLabel = Convert.ToString(row["JogoLabel"]);
            }



            if (row.Table.Columns.Contains("PendenteTime1JogoID") && !Convert.IsDBNull(row["PendenteTime1JogoID"]))
            {
                jogo.PendenteIdTime1 = Convert.ToInt32(row["PendenteTime1JogoID"]);
            }
            if (row.Table.Columns.Contains("PendenteTime2JogoID") && !Convert.IsDBNull(row["PendenteTime2JogoID"]))
            {
                jogo.PendenteIdTime2 = Convert.ToInt32(row["PendenteTime2JogoID"]);
            }
            if (row.Table.Columns.Contains("PendenteTime1Ganhador") && !Convert.IsDBNull(row["PendenteTime1Ganhador"]))
            {
                jogo.PendenteTime1Ganhador = Convert.ToInt32(row["PendenteTime1Ganhador"]) == 1 ? true : false;
            }
            if (row.Table.Columns.Contains("PendenteTime2Ganhador") && !Convert.IsDBNull(row["PendenteTime2Ganhador"]))
            {
                jogo.PendenteTime2Ganhador = Convert.ToInt32(row["PendenteTime2Ganhador"]) == 1 ? true : false;
            }

            if (row.Table.Columns.Contains("PendenteTime1NomeGrupo") && !Convert.IsDBNull(row["PendenteTime1NomeGrupo"]))
            {
                jogo.PendenteTime1NomeGrupo = Convert.ToString(row["PendenteTime1NomeGrupo"]);
            }
            if (row.Table.Columns.Contains("PendenteTime2NomeGrupo") && !Convert.IsDBNull(row["PendenteTime2NomeGrupo"]))
            {
                jogo.PendenteTime2NomeGrupo = Convert.ToString(row["PendenteTime2NomeGrupo"]);
            }

            if (row.Table.Columns.Contains("PendenteTime1PosGrupo") && !Convert.IsDBNull(row["PendenteTime1PosGrupo"]))
            {
                jogo.PendenteTime1PosGrupo = Convert.ToInt32(row["PendenteTime1PosGrupo"]);
            }
            if (row.Table.Columns.Contains("PendenteTime2PosGrupo") && !Convert.IsDBNull(row["PendenteTime2PosGrupo"]))
            {
                jogo.PendenteTime2PosGrupo = Convert.ToInt32(row["PendenteTime2PosGrupo"]);
            }


            return(jogo);
        }
Example #20
0
        private Log CheckJogo(Model.Campeonatos.Jogo jogo, Model.Boloes.JogoUsuario jogoUsuario, out int atual, out int expected)
        {
            atual    = 0;
            expected = 0;
            int value = 1;

            if (!jogo.PartidaValida)
            {
                return(Log.Warning);
            }


            if (string.Compare(jogo.Time1.Nome, "Brasil", true) == 0 || string.Compare(jogo.Time2.Nome, "Brasil", true) == 0)
            {
                value = 2;
            }


            int pontos = 0;

            //Aposta em cheio
            if (jogo.GolsTime1 == jogoUsuario.ApostaTime1 && jogo.GolsTime2 == jogoUsuario.ApostaTime2)
            {
                pontos = 10;
            }
            //Empate
            else if (jogo.GolsTime1 == jogo.GolsTime2 && jogoUsuario.ApostaTime1 == jogoUsuario.ApostaTime2)
            {
                pontos = 5;
            }
            //Time 1 Ganhador
            else if (jogo.GolsTime1 > jogo.GolsTime2 && jogoUsuario.ApostaTime1 > jogoUsuario.ApostaTime2)
            {
                pontos = 3;

                if (jogo.GolsTime1 == jogoUsuario.ApostaTime1)
                {
                    pontos++;
                }
                if (jogo.GolsTime2 == jogoUsuario.ApostaTime2)
                {
                    pontos++;
                }
            }
            //Time 2 Ganhador
            else if (jogo.GolsTime1 < jogo.GolsTime2 && jogoUsuario.ApostaTime1 < jogoUsuario.ApostaTime2)
            {
                pontos = 3;

                if (jogo.GolsTime1 == jogoUsuario.ApostaTime1)
                {
                    pontos++;
                }
                if (jogo.GolsTime2 == jogoUsuario.ApostaTime2)
                {
                    pontos++;
                }
            }
            else
            {
                if (jogo.GolsTime1 == jogoUsuario.ApostaTime1)
                {
                    pontos++;
                }
                if (jogo.GolsTime2 == jogoUsuario.ApostaTime2)
                {
                    pontos++;
                }
            }


            pontos *= value;


            expected = pontos;
            atual    = jogoUsuario.Pontos;

            if (jogoUsuario.Pontos != pontos)
            {
                return(Log.Error);
            }


            return(Log.Info);
        }
Example #21
0
        public bool UpdateFacebook(string currentUser, Model.Boloes.Bolao bolao, string userName, Model.Campeonatos.Jogo jogo, out int errorNumber, out string errorDescription)
        {
            errorNumber      = 0;
            errorDescription = null;


            base.ExecuteNonQuery(CommandType.StoredProcedure, "sp_JogosUsuarios_Social_Facebook_UP", true, currentUser,
                                 base.Parameters.Create("@UserName", DbType.String, userName),
                                 base.Parameters.Create("@NomeBolao", DbType.String, bolao.Nome),
                                 base.Parameters.Create("@IdJogo", DbType.String, jogo.IDJogo),
                                 base.Parameters.Create("@ReturnValue", DbType.Int32, ParameterDirection.ReturnValue, null)
                                 );


            return(Convert.ToInt32(base.ExecutionStatus.Command.Parameters["@ReturnValue"].Value) == 1 ? true : false);
        }
Example #22
0
        public IList <Model.Boloes.JogoUsuario> LoadSocialNetwork(string currentUser, Model.Boloes.Bolao bolao, string userName, Model.Campeonatos.Jogo jogo, out int errorNumber, out string errorDescription)
        {
            DataTable table = base.ExecuteFill(CommandType.StoredProcedure, "sp_JogosUsuarios_Social_DT", true, currentUser,
                                               base.Parameters.Create("@NomeBolao", DbType.String, bolao.Nome),
                                               base.Parameters.Create("@Username", DbType.String, userName),
                                               base.Parameters.Create("@IdJogo", DbType.Int32, jogo.IDJogo),
                                               base.Parameters.Create("@ReturnValue", DbType.Int32, ParameterDirection.ReturnValue, null)
                                               );


            IList <Framework.DataServices.Model.EntityBaseData> list = ConvertToList(table);

            IList <Model.Boloes.JogoUsuario> jogos = new List <Model.Boloes.JogoUsuario>();

            foreach (Model.Boloes.JogoUsuario jogoEntry in list)
            {
                jogos.Add(jogoEntry);
            }

            errorNumber      = base.ExecutionStatus.ErrorNumber;
            errorDescription = base.ExecutionStatus.ErrorDescription;

            return(jogos);
        }
Example #23
0
        public static Framework.DataServices.Model.EntityBaseData ConvertToObject(DataRow row)
        {
            long   idJogo         = 0;
            string userName       = string.Empty;
            string nomeBolao      = string.Empty;
            string nomeCampeonato = string.Empty;


            Model.Campeonatos.Jogo jogo = (Model.Campeonatos.Jogo)Dao.Campeonatos.Util.Jogo.ConvertToObject(row);



            if (row.Table.Columns.Contains("IDJogo") && !Convert.IsDBNull(row["IDJogo"]))
            {
                idJogo = Convert.ToInt64(row["IDJogo"]);
            }
            if (row.Table.Columns.Contains("NomeCampeonato") && !Convert.IsDBNull(row["NomeCampeonato"]))
            {
                nomeCampeonato = Convert.ToString(row["NomeCampeonato"]);
            }

            if (row.Table.Columns.Contains("IDJogoItem") && !Convert.IsDBNull(row["IDJogoItem"]))
            {
                idJogo = Convert.ToInt64(row["IDJogoItem"]);
            }
            if (row.Table.Columns.Contains("NomeCampeonatoItem") && !Convert.IsDBNull(row["NomeCampeonatoItem"]))
            {
                nomeCampeonato = Convert.ToString(row["NomeCampeonatoItem"]);
            }


            if (row.Table.Columns.Contains("NomeBolao") && !Convert.IsDBNull(row["NomeBolao"]))
            {
                nomeBolao = Convert.ToString(row["NomeBolao"]);
            }
            if (row.Table.Columns.Contains("UserName") && !Convert.IsDBNull(row["UserName"]))
            {
                userName = Convert.ToString(row["UserName"]);
            }
            Model.Boloes.JogoUsuario entry = new BolaoNet.Model.Boloes.JogoUsuario(
                idJogo, nomeCampeonato, nomeBolao, userName);
            entry.LoadDataRow(row);
            entry.Copy(jogo);


            if (row.Table.Columns.Contains("DataAposta") && !Convert.IsDBNull(row["DataAposta"]))
            {
                entry.DataAposta = Convert.ToDateTime(row["DataAposta"]);
            }

            if (row.Table.Columns.Contains("Automatico") && !Convert.IsDBNull(row["Automatico"]))
            {
                entry.Automatico = Convert.ToBoolean(row["Automatico"]);
            }
            if (row.Table.Columns.Contains("ApostaTime1") && !Convert.IsDBNull(row["ApostaTime1"]))
            {
                entry.ApostaTime1 = Convert.ToInt32(row["ApostaTime1"]);
            }
            if (row.Table.Columns.Contains("ApostaTime2") && !Convert.IsDBNull(row["ApostaTime2"]))
            {
                entry.ApostaTime2 = Convert.ToInt32(row["ApostaTime2"]);
            }

            if (row.Table.Columns.Contains("NomeTimeResult1") && !Convert.IsDBNull(row["NomeTimeResult1"]))
            {
                entry.NomeTimeResult1 = new Model.DadosBasicos.Time(Convert.ToString(row["NomeTimeResult1"]));
            }


            if (row.Table.Columns.Contains("NomeTimeResult2") && !Convert.IsDBNull(row["NomeTimeResult2"]))
            {
                entry.NomeTimeResult2 = new Model.DadosBasicos.Time(Convert.ToString(row["NomeTimeResult2"]));
            }
            if (row.Table.Columns.Contains("Ganhador") && !Convert.IsDBNull(row["Ganhador"]))
            {
                entry.Ganhador = Convert.ToInt32(row["Ganhador"]);
            }
            if (row.Table.Columns.Contains("DataFacebook") && !Convert.IsDBNull(row["DataFacebook"]))
            {
                entry.DataFacebook = Convert.ToDateTime(row["DataFacebook"]);
            }

            ((Model.Boloes.JogoUsuario)entry).ApostaPontos = ConvertApostasToObject(row);

            return(entry);
        }
Example #24
0
        public void Run(string nomeBolao)
        {
            string currentUserName = "******";

            //Criando os dados do excel na memória
            excel.CreateWorksheet("Estatistica");


            //Criando as instâncias dos BO
            Business.Boloes.Support.Bolao              bolao           = new Business.Boloes.Support.Bolao(currentUserName, nomeBolao);
            Business.Campeonatos.Support.Jogo          boJogo          = new Business.Campeonatos.Support.Jogo(currentUserName);
            Business.Boloes.Support.JogoUsuario        boJogosUsuarios = new Business.Boloes.Support.JogoUsuario(currentUserName);
            Business.Boloes.Support.ApostaExtraUsuario boApostaExtra   = new Business.Boloes.Support.ApostaExtraUsuario(currentUserName);
            boApostaExtra.Bolao = bolao;


            //Carregando os dados principais do bolão
            bolao.Load();

            //Indicando qual campeonato é o jogo
            boJogo.Campeonato     = bolao.Campeonato;
            boJogosUsuarios.Bolao = bolao;


            //Carregando a classificação
            IList <BolaoNet.Model.Boloes.BolaoMembros> membros = bolao.LoadClassificacao(0);

            //Buscando o jogo de disputa de 3 e 4
            IList <Framework.DataServices.Model.EntityBaseData> jogosFound = boJogo.SelectAll("NomeFase = 'Final' AND PendenteTime1Ganhador = 0");

            //Identificando o jogo do 3 e 4 lugar
            Model.Campeonatos.Jogo jogoFimPerdedor = (Model.Campeonatos.Jogo)jogosFound[0];

            //Buscando o 1 e 2 lugar
            jogosFound = boJogo.SelectAll("NomeFase = 'Final' AND PendenteTime1Ganhador = 1");

            //Atribuindo o 1 e 2 lugar
            Model.Campeonatos.Jogo jogoFimCampeao = (Model.Campeonatos.Jogo)jogosFound[0];

            //Buscando as apostas do usuário de disputa de 3 e 4 lugar
            IList <Framework.DataServices.Model.EntityBaseData> listJogos = boJogosUsuarios.LoadApostasByJogo(bolao, jogoFimPerdedor, null);

            //Buscando as apostas extras dos usuários
            IList <Framework.DataServices.Model.EntityBaseData> listApostasExtras = boApostaExtra.SelectAll(null);

            excel.SetValue(PosLineStart - 1, 0, "Gols Time 1");
            excel.SetValue(PosLineStart - 1, 1, "Gols Time 2");
            excel.SetValue(PosLineStart - 1, 2, "Desempate, 0 = Time 1");


            for (int c = 0; c < membros.Count; c++)
            {
                excel.SetValue(PosLineStart - 1, PosStartName + (c * 4), membros[c].UserName);
                excel.SetNumber(PosLineStart - 1, PosStartName + 1 + (c * 4), membros[c].TotalPontos);
                //excel.SetNumber(PosLineStart - 1, PosStartName + 2 + (c * 3), 0);
            }


            int currentLine = PosLineStart;

            ApplyLine(currentLine++, _golsTime1, _golsTime2, _ganhador, 3, 4, ref membros, listJogos, listApostasExtras, false);



            currentLine += 2;
            listJogos    = boJogosUsuarios.LoadApostasByJogo(bolao, jogoFimCampeao, null);

            //Empate
            ApplyLine(currentLine++, 0, 0, 1, 1, 2, ref membros, listJogos, listApostasExtras, true);
            ApplyLine(currentLine++, 0, 0, 2, 1, 2, ref membros, listJogos, listApostasExtras, true);
            ApplyLine(currentLine++, 1, 1, 1, 1, 2, ref membros, listJogos, listApostasExtras, true);
            ApplyLine(currentLine++, 1, 1, 2, 1, 2, ref membros, listJogos, listApostasExtras, true);
            ApplyLine(currentLine++, 2, 2, 1, 1, 2, ref membros, listJogos, listApostasExtras, true);
            ApplyLine(currentLine++, 2, 2, 2, 1, 2, ref membros, listJogos, listApostasExtras, true);
            ApplyLine(currentLine++, 3, 3, 1, 1, 2, ref membros, listJogos, listApostasExtras, true);
            ApplyLine(currentLine++, 3, 3, 2, 1, 2, ref membros, listJogos, listApostasExtras, true);
            ApplyLine(currentLine++, 4, 4, 1, 1, 2, ref membros, listJogos, listApostasExtras, true);
            ApplyLine(currentLine++, 4, 4, 2, 1, 2, ref membros, listJogos, listApostasExtras, true);
            ApplyLine(currentLine++, 5, 5, 1, 1, 2, ref membros, listJogos, listApostasExtras, true);
            ApplyLine(currentLine++, 5, 5, 2, 1, 2, ref membros, listJogos, listApostasExtras, true);

            //Ganhador 2
            ApplyLine(currentLine++, 0, 1, 0, 1, 2, ref membros, listJogos, listApostasExtras, true);
            ApplyLine(currentLine++, 0, 2, 0, 1, 2, ref membros, listJogos, listApostasExtras, true);
            ApplyLine(currentLine++, 0, 3, 0, 1, 2, ref membros, listJogos, listApostasExtras, true);
            ApplyLine(currentLine++, 0, 4, 0, 1, 2, ref membros, listJogos, listApostasExtras, true);
            ApplyLine(currentLine++, 0, 5, 0, 1, 2, ref membros, listJogos, listApostasExtras, true);

            ApplyLine(currentLine++, 1, 2, 0, 1, 2, ref membros, listJogos, listApostasExtras, true);
            ApplyLine(currentLine++, 1, 3, 0, 1, 2, ref membros, listJogos, listApostasExtras, true);
            ApplyLine(currentLine++, 1, 4, 0, 1, 2, ref membros, listJogos, listApostasExtras, true);
            ApplyLine(currentLine++, 1, 5, 0, 1, 2, ref membros, listJogos, listApostasExtras, true);

            ApplyLine(currentLine++, 2, 3, 0, 1, 2, ref membros, listJogos, listApostasExtras, true);
            ApplyLine(currentLine++, 2, 4, 0, 1, 2, ref membros, listJogos, listApostasExtras, true);
            ApplyLine(currentLine++, 2, 5, 0, 1, 2, ref membros, listJogos, listApostasExtras, true);

            ApplyLine(currentLine++, 3, 4, 0, 1, 2, ref membros, listJogos, listApostasExtras, true);
            ApplyLine(currentLine++, 3, 5, 0, 1, 2, ref membros, listJogos, listApostasExtras, true);

            ApplyLine(currentLine++, 4, 5, 0, 1, 2, ref membros, listJogos, listApostasExtras, true);

            //Ganhador 1
            ApplyLine(currentLine++, 1, 0, 0, 1, 2, ref membros, listJogos, listApostasExtras, true);
            ApplyLine(currentLine++, 2, 0, 0, 1, 2, ref membros, listJogos, listApostasExtras, true);
            ApplyLine(currentLine++, 3, 0, 0, 1, 2, ref membros, listJogos, listApostasExtras, true);
            ApplyLine(currentLine++, 4, 0, 0, 1, 2, ref membros, listJogos, listApostasExtras, true);
            ApplyLine(currentLine++, 5, 0, 0, 1, 2, ref membros, listJogos, listApostasExtras, true);

            ApplyLine(currentLine++, 2, 1, 0, 1, 2, ref membros, listJogos, listApostasExtras, true);
            ApplyLine(currentLine++, 3, 1, 0, 1, 2, ref membros, listJogos, listApostasExtras, true);
            ApplyLine(currentLine++, 4, 1, 0, 1, 2, ref membros, listJogos, listApostasExtras, true);
            ApplyLine(currentLine++, 5, 1, 0, 1, 2, ref membros, listJogos, listApostasExtras, true);

            ApplyLine(currentLine++, 3, 2, 0, 1, 2, ref membros, listJogos, listApostasExtras, true);
            ApplyLine(currentLine++, 4, 2, 0, 1, 2, ref membros, listJogos, listApostasExtras, true);
            ApplyLine(currentLine++, 5, 2, 0, 1, 2, ref membros, listJogos, listApostasExtras, true);

            ApplyLine(currentLine++, 4, 3, 0, 1, 2, ref membros, listJogos, listApostasExtras, true);
            ApplyLine(currentLine++, 5, 3, 0, 1, 2, ref membros, listJogos, listApostasExtras, true);

            ApplyLine(currentLine++, 5, 4, 0, 1, 2, ref membros, listJogos, listApostasExtras, true);


            if (System.IO.File.Exists(".\\Excel.xls"))
            {
                System.IO.File.Delete(".\\Excel.xls");
            }

            excel.SaveFile(".\\Excel.xls");
        }
Example #25
0
        private void livJogos_SelectedIndexChanged(object sender, EventArgs e)
        {
            this.lblJogo.Text = "";
            if (this.livJogos.SelectedIndices.Count == 0)
            {
                return;
            }

            Business.Boloes.Support.JogoUsuario jogoUsuario = new Business.Boloes.Support.JogoUsuario("");
            jogoUsuario.Bolao = new Model.Boloes.Bolao(this.cboBoloes.Text);

            int pos = this.livJogos.SelectedIndices[0];

            IList <Framework.DataServices.Model.EntityBaseData> list =
                jogoUsuario.SelectAll("jogos.idjogo='" + this.livJogos.Items[pos].Text + "'");


            this.lblJogo.Text = this.livJogos.Items[pos].SubItems[1].Text + " - " +
                                this.livJogos.Items[pos].SubItems[2].Text + " " +
                                this.livJogos.Items[pos].SubItems[3].Text + " " +
                                " x " +
                                this.livJogos.Items[pos].SubItems[4].Text + " " +
                                this.livJogos.Items[pos].SubItems[5].Text;

            this.livJogosUsuarios.Items.Clear();


            Model.Campeonatos.Jogo jogoMain = (Model.Campeonatos.Jogo) this.livJogos.Items[pos].Tag;


            foreach (Model.Boloes.JogoUsuario jogo in list)
            {
                ListViewItem jogoItem = new ListViewItem(jogo.IDJogo.ToString());
                jogoItem.SubItems.Add(jogo.UserName);
                jogoItem.SubItems.Add(jogo.Time1.Nome);
                jogoItem.SubItems.Add(jogo.ApostaTime1.ToString());
                jogoItem.SubItems.Add(jogo.ApostaTime2.ToString());
                jogoItem.SubItems.Add(jogo.Time2.Nome);
                jogoItem.SubItems.Add(jogo.Pontos.ToString());
                this.livJogosUsuarios.Items.Add(jogoItem);

                int atual    = 0;
                int expected = 0;

                Log logTemp = CheckJogo(jogoMain, jogo, out atual, out expected);


                switch (logTemp)
                {
                case Log.Error:
                    jogoItem.BackColor = Color.Red;
                    break;

                case Log.Warning:
                    jogoItem.BackColor = Color.Yellow;
                    break;

                case Log.Info:
                    jogoItem.BackColor = Color.LightGreen;
                    break;
                }
            }
        }
Example #26
0
 public VerifyJogo(Model.Campeonatos.Jogo jogo)
 {
     _jogo = jogo;
 }