private void BindGrid()
        {
            Business.Boloes.Support.ApostaExtra business =
                new Business.Boloes.Support.ApostaExtra(base.UserName);

            business.Bolao = CurrentBolao;
            IList <Framework.DataServices.Model.EntityBaseData> list = business.SelectAll("NomeBolao='" + CurrentBolao.Nome + "'");

            ViewState["Grid"] = list;

            this.grdApostas.DataSource = ViewState["Grid"];
            this.grdApostas.DataBind();
        }
예제 #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                Business.Campeonatos.Support.Campeonato business =
                    new Business.Campeonatos.Support.Campeonato(base.UserName, CurrentCampeonato.Nome);

                #region Buscando os times
                IList <Framework.DataServices.Model.EntityBaseData> list = business.LoadTimes();
                ViewState["Times"] = list;
                #endregion

                #region Atualizando as apostas extras

                Business.Boloes.Support.ApostaExtra businessExtra =
                    new Business.Boloes.Support.ApostaExtra(base.UserName);

                IList <Framework.DataServices.Model.EntityBaseData> listExtra = businessExtra.SelectAll("NomeBolao='" + CurrentBolao.Nome + "'");

                ViewState["Grid"] = listExtra;

                this.grdApostas.DataSource = ViewState["Grid"];
                this.grdApostas.DataBind();


                #endregion

                #region Buscando a classificação do campeonato
                Business.Boloes.Support.Bolao     businessBolao     = new BolaoNet.Business.Boloes.Support.Bolao(base.UserName, CurrentBolao.Nome);
                IList <Model.Boloes.BolaoMembros> listClassificacao = businessBolao.LoadClassificacao(0);
                #endregion

                #region Criando a lista de usuários

                List <Model.Boloes.Simulation.ApostasExtrasBolaoMembros> listSimulation = new List <Model.Boloes.Simulation.ApostasExtrasBolaoMembros>();

                foreach (Model.Boloes.BolaoMembros entry in listClassificacao)
                {
                    Model.Boloes.Simulation.ApostasExtrasBolaoMembros extraUser = new BolaoNet.Model.Boloes.Simulation.ApostasExtrasBolaoMembros();
                    extraUser.Copy((Model.Boloes.BolaoMembros)entry);
                    extraUser.LastPontos  = extraUser.TotalPontos;
                    extraUser.LastPosicao = extraUser.Posicao;

                    listSimulation.Add(extraUser);
                }
                #endregion

                #region Buscando as apostas extras dos usuários

                Business.Boloes.Support.ApostaExtraUsuario businessExtraUser = new BolaoNet.Business.Boloes.Support.ApostaExtraUsuario(base.UserName);
                businessExtra.Bolao = CurrentBolao;


                foreach (Model.Boloes.ApostaExtra entry in listExtra)
                {
                    IList <Framework.DataServices.Model.EntityBaseData> listPos = businessExtraUser.SelectByPosicao(CurrentBolao, entry.Posicao, null);

                    foreach (Model.Boloes.ApostaExtraUsuario modelExtraUser in listPos)
                    {
                        for (int c = 0; c < listSimulation.Count; c++)
                        {
                            if (string.Compare(listSimulation[c].UserName, modelExtraUser.UserName, true) == 0)
                            {
                                listSimulation[c].ListApostasExtras.Add(modelExtraUser);
                                break;
                            }
                        }
                    }
                }

                Classificacao = listSimulation;
                #endregion


                BindUsers();
            }
        }