protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                string bolao = null;


                if (Request.QueryString["Bolao"] != null)
                {
                    bolao = Request.QueryString["Bolao"];
                }
                //if (Request.QueryString["Campeonato"] != null)
                //{
                //    campeonato = Request.QueryString["Campeonato"];
                //}

                if (!string.IsNullOrEmpty(bolao))
                {
                    Business.Boloes.Support.Bolao bolaoBO = new Business.Boloes.Support.Bolao(CurrentUserName, bolao);
                    bolaoBO.Load();

                    CampeonatoUserBasePage.CurrentCampeonato = bolaoBO.Campeonato;
                    BolaoUserBasePage.CurrentCampeonato      = bolaoBO.Campeonato;
                    BolaoUserBasePage.CurrentBolao           = bolaoBO;
                }
            }


            Response.Redirect("~/Apostas/ApostasJogos.aspx");

            BindGrid();
        }
Exemple #2
0
        public virtual bool IsValidToShow()
        {
            //Se o bolão ainda não foi carregado
            //if (!_currentBolao.IsLoaded)
            //{
            //Carregando os dados do bolão
            Business.Boloes.Support.Bolao business = new
                                                     Business.Boloes.Support.Bolao(
                //base.UserName, _currentBolao.Nome);
                base.UserName, CurrentBolao.Nome);

            business.Load();

            //Atribuindo ao bolão atual
            //_currentBolao = (Model.Boloes.Bolao)business;
            CurrentBolao = (Model.Boloes.Bolao)business;

            //}//endif bolão não iniciado.


            //Se o bolão só permite apostas antes do início do campeonato
            //if (_currentBolao.ApostasApenasAntes)
            if (CurrentBolao.ApostasApenasAntes)
            {
                //Se o campeonato foi iniciado
                //if (_currentBolao.IsIniciado)
                if (CurrentBolao.IsIniciado)
                {
                    return(true);
                }
                //Se o campeonato ainda não foi inciado
                else
                {
                    //Buscando as regras do usuário
                    string [] roles = System.Web.Security.Roles.Provider.GetRolesForUser(base.UserName);

                    //Percorrendo todos os roles
                    foreach (string role in roles)
                    {
                        //Se o usuário é permitido visualização mesmo que o bolão não foi iniciado
                        if (string.Compare(role, "Administrador", true) == 0 || string.Compare(role, "Gerenciador de Bolão", true) == 0)
                        {
                            return(true);
                        }
                    }//end foreach roles

                    return(false);
                }//endif iniciado
            }
            //Se pode visualizar as apostas de todos
            else
            {
                return(true);
            }
        }
Exemple #3
0
        private void frmMain_Load(object sender, EventArgs e)
        {
            Business.Boloes.Support.Bolao bolao = new Business.Boloes.Support.Bolao("");
            IList <Framework.DataServices.Model.EntityBaseData> list = bolao.SelectAll(null);

            foreach (Model.Boloes.Bolao entry in list)
            {
                this.cboBoloes.Items.Add(entry.Nome);
            }

            this.cboBoloes.SelectedIndex = 0;
        }
Exemple #4
0
        private void CreateUser(NPOI.SS.UserModel.Workbook wb, string user, Business.Boloes.Support.Bolao bolao)
        {
            NPOI.SS.UserModel.Sheet newSheet = wb.CloneSheet(0);

            Business.Boloes.Support.JogoUsuario jogo = new Business.Boloes.Support.JogoUsuario(_currentLogin);
            jogo.Bolao = bolao;
            IList <Framework.DataServices.Model.EntityBaseData> jogos =
                jogo.SelectAllByPeriod(bolao, user, 0, DateTime.MinValue, DateTime.MinValue, null, null, null, null);


            foreach (Model.Boloes.JogoUsuario jogoUser in jogos)
            {
            }
        }
Exemple #5
0
        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);


            if (!IsPostBack)
            {
                if (Request.QueryString["Bolao"] != null)
                {
                    if (CurrentBolao == null ||
                        string.Compare(Request.QueryString["Bolao"].ToString(), CurrentBolao.Nome, true) != 0)
                    {
                        Business.Boloes.Support.Bolao business = new
                                                                 Business.Boloes.Support.Bolao(
                            base.UserName, Request.QueryString["Bolao"].ToString());

                        if (business.Load())
                        {
                            CurrentBolao      = business;
                            CurrentCampeonato = business.Campeonato;
                        }
                        else
                        {
                            CurrentBolao      = null;
                            CurrentCampeonato = null;
                        }
                    } //endif currentBolao = null
                }     //if querystring != null
            }

            //Se não foi encontrado o bolão
            if (CurrentBolao == null)
            {
                Response.Redirect("~\\Boloes\\SelectBolao.aspx?ReturnURL=" +
                                  HttpContext.Current.Request.CurrentExecutionFilePath);
                return;
            }
            //Se foi encontrado o bolão
            else if (!IsPostBack)
            {
                //Se não é válido para visualizar os dados
                if (!IsValidToShow())
                {
                    Response.Redirect("~\\Boloes\\BolaoNaoPermitido.aspx");
                    return;
                } //endif válido para visualizar os dados
            }     //endif bolão válido
        }
Exemple #6
0
        protected void grdUsers_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            IList <Framework.DataServices.Model.EntityBaseData> list = (IList <Framework.DataServices.Model.EntityBaseData>)ViewState["Users"];


            Business.Boloes.Support.Bolao bolao = new Business.Boloes.Support.Bolao(CurrentUserName, base.BaseCurrentBolao.Nome);

            UserData user = new UserData(this.grdUsers.Rows[e.RowIndex].Cells[0].Text);


            bool result = bolao.DeleteMembro(user);

            list.RemoveAt(e.RowIndex);



            BindUsers();
        }
        public void Save()
        {
            IList <Framework.DataServices.Model.EntityBaseData> list =
                (IList <Framework.DataServices.Model.EntityBaseData>)ViewState["Grid"];

            IList <Framework.DataServices.Model.EntityBaseData> listTimes =
                (IList <Framework.DataServices.Model.EntityBaseData>)ViewState["GridTimes"];

            #region Critérios

            for (int c = 0; c < this.grdCriterios.Rows.Count; c++)
            {
                Model.Boloes.BolaoCriterioPontos criterio = (Model.Boloes.BolaoCriterioPontos)list[c];


                TextBox      txtPontos   = (TextBox)this.grdCriterios.Rows[c].FindControl("txtPontos");
                DropDownList cboNomeTime = (DropDownList)this.grdCriterios.Rows[c].FindControl("cboNomeTime");
                TextBox      txtMultiplo = (TextBox)this.grdCriterios.Rows[c].FindControl("txtMultiplo");



                //Se mudou os pontos
                if ((txtPontos.Text.Length > 0 && Convert.ToInt32(txtPontos.Text) != criterio.Pontos)) // ||
                //      string.Compare (cboNomeTime.SelectedValue, criterio.Time.Nome) != 0 ||
                //    (txtMultiplo.Text.Length > 0 && Convert.ToInt32 (txtMultiplo.Text) != criterio.MultiploTime))
                {
                    Business.Boloes.Support.Bolao business =
                        new Business.Boloes.Support.Bolao(base.UserName, CurrentBolao.Nome);

                    criterio.Pontos = Convert.ToInt32(txtPontos.Text);
                    //criterio.MultiploTime = Convert.ToInt32(txtMultiplo.Text);
                    //criterio.Time = new BolaoNet.Model.DadosBasicos.Time(cboNomeTime.SelectedValue);

                    business.UpdateCriterioPontos(criterio);
                } //endif mudou pontos
            }     //end for c
            #endregion

            #region Critérios times

            for (int c = 0; c < this.grdTimes.Rows.Count; c++)
            {
                Model.Boloes.BolaoCriterioPontosTimes criterio = (Model.Boloes.BolaoCriterioPontosTimes)listTimes[c];

                Label   lblTime     = (Label)this.grdTimes.Rows[c].FindControl("lblTime");
                TextBox txtMultiplo = (TextBox)this.grdTimes.Rows[c].FindControl("txtMultiplo");

                if (criterio.MultiploTime != Convert.ToInt32(txtMultiplo.Text))
                {
                    Business.Boloes.Support.Bolao business =
                        new Business.Boloes.Support.Bolao(base.UserName, CurrentBolao.Nome);

                    criterio.MultiploTime = Convert.ToInt32(txtMultiplo.Text);

                    business.UpdateCriterioPontosTimes(criterio);
                }
            }//end for times

            #endregion

            BindGrid();
            BindGridTimes();

            base.ShowMessages("Pontos armazenados com sucesso.");
        }
Exemple #8
0
        private void btnStart_Click(object sender, EventArgs e)
        {
            this.livLog.Items.Clear();
            this.livClassificacao.Items.Clear();
            this.livJogos.Items.Clear();
            this.livJogosUsuarios.Items.Clear();

            IList <ClassificacaoUsuario> compareList = new List <ClassificacaoUsuario>();


            BolaoNet.Business.Boloes.Support.Bolao bolao = new Business.Boloes.Support.Bolao("");
            bolao.Nome = this.cboBoloes.Text;

            bolao.Load();

            Business.Campeonatos.Support.Campeonato campeonato   = new Business.Campeonatos.Support.Campeonato("", bolao.Campeonato);
            Business.Boloes.Support.JogoUsuario     jogosUsuario = new Business.Boloes.Support.JogoUsuario("");
            jogosUsuario.Bolao = bolao;


            IList <Framework.DataServices.Model.EntityBaseData> jogos =
                campeonato.LoadJogos(0, null, null, DateTime.MinValue, DateTime.MinValue, null);


            IList <Model.Boloes.Reports.UserPontosData> pontuacao = new List <Model.Boloes.Reports.UserPontosData>();


            _jogoUsuario.Clear();

            this.pgbPartial.Value   = 0;
            this.pgbPartial.Maximum = jogos.Count;



            foreach (Model.Campeonatos.Jogo jogo in jogos)
            {
                ListViewItem jogoItem = new ListViewItem(jogo.IDJogo.ToString());

                jogoItem.SubItems.Add(jogo.DataJogo.ToString("dd/MM"));
                jogoItem.SubItems.Add(jogo.Time1.Nome);
                jogoItem.SubItems.Add(jogo.GolsTime1.ToString());
                jogoItem.SubItems.Add(jogo.GolsTime1.ToString());
                jogoItem.SubItems.Add(jogo.Time2.Nome);
                jogoItem.SubItems.Add(jogo.PartidaValida.ToString());
                jogoItem.Tag = jogo;
                this.livJogos.Items.Add(jogoItem);


                IList <Framework.DataServices.Model.EntityBaseData> jogosUsu =
                    jogosUsuario.LoadApostasByJogo(bolao, jogo, "");

                Log logJogo = Log.Info;

                foreach (Model.Boloes.JogoUsuario jogoUsuario in jogosUsu)
                {
                    int atual    = 0;
                    int expected = 0;
                    Log logTemp  = CheckJogo(jogo, jogoUsuario, out atual, out expected);

                    switch (logTemp)
                    {
                    case Log.Error:

                        logJogo = Log.Error;

                        ListViewItem log = new ListViewItem(jogo.IDJogo.ToString());
                        log.SubItems.Add(jogo.Time1.Nome + " x " + jogo.Time2.Nome);
                        log.SubItems.Add(jogoUsuario.UserName);
                        log.SubItems.Add(atual.ToString());
                        log.SubItems.Add(expected.ToString());
                        this.livLog.Items.Add(log);

                        break;

                    case Log.Warning:

                        if (logJogo == Log.Info)
                        {
                            logJogo = Log.Warning;
                        }

                        break;
                    }



                    int posCompare = -1;
                    for (int c = 0; c < compareList.Count; c++)
                    {
                        if (string.Compare(compareList[c].Usuario, jogoUsuario.UserName, true) == 0)
                        {
                            posCompare = c;
                            break;
                        }
                    }

                    if (posCompare == -1)
                    {
                        compareList.Add(new ClassificacaoUsuario());
                        compareList[compareList.Count - 1].Usuario = jogoUsuario.UserName;
                        posCompare = compareList.Count - 1;
                    }

                    compareList[posCompare].Pontos += jogoUsuario.Pontos;
                }

                switch (logJogo)
                {
                case Log.Error:
                    this.livJogos.Items[this.livJogos.Items.Count - 1].BackColor = Color.Red;
                    break;

                case Log.Warning:
                    this.livJogos.Items[this.livJogos.Items.Count - 1].BackColor = Color.Yellow;
                    break;

                case Log.Info:
                    this.livJogos.Items[this.livJogos.Items.Count - 1].BackColor = Color.LightGreen;
                    break;
                }



                this.pgbPartial.Value++;
                this.pgbPartial.Show();
            }



            IList <Model.Boloes.BolaoMembros> classificacao = bolao.LoadClassificacao(0);
            IList <Framework.DataServices.Model.EntityBaseData> listPosicoes = bolao.SelectPremios();

            foreach (Model.Boloes.BolaoMembros pont in classificacao)
            {
                ListViewItem pontos = new ListViewItem(pont.Posicao.ToString());
                pontos.SubItems.Add(pont.UserName);
                pontos.SubItems.Add(pont.TotalPontos.ToString());

                foreach (Model.Boloes.BolaoPremio premio in listPosicoes)
                {
                    if (premio.Posicao == pont.Posicao)
                    {
                        pontos.BackColor = premio.BackColor;
                        pontos.ForeColor = premio.ForeColor;
                    }
                }

                int total = 0;
                for (int c = 0; c < compareList.Count; c++)
                {
                    if (string.Compare(compareList[c].Usuario, pont.UserName, true) == 0)
                    {
                        total = pont.TotalPontos - compareList[c].Pontos;
                        break;
                    }
                }

                pontos.SubItems.Add(total.ToString());

                this.livClassificacao.Items.Add(pontos);
            }
        }
Exemple #9
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");
        }
Exemple #10
0
 private void SetValue(string nomeBolao, int line, string userName, int pontosAtuais)
 {
     Business.Boloes.Support.Bolao business = new Business.Boloes.Support.Bolao("thoris", nomeBolao);
 }
Exemple #11
0
        public void CreateFile(Model.Campeonatos.Campeonato campeonato, Model.Boloes.Bolao bolao)
        {
            if (System.IO.File.Exists(_fileName))
            {
                System.IO.File.Delete(_fileName);
            }



            //FileStream stream = new FileStream(_fileName, FileMode.Create, FileAccess.Write);
            //NPOI.HSSF.UserModel.HSSFWorkbook wb = new NPOI.HSSF.UserModel.HSSFWorkbook(stream);

            NPOI.SS.UserModel.Workbook wb = new NPOI.HSSF.UserModel.HSSFWorkbook();


            NPOI.SS.UserModel.Sheet sheetJogos = wb.CreateSheet("Jogos-Grupo");

            Business.Campeonatos.Support.Campeonato             camp  = new Business.Campeonatos.Support.Campeonato(_currentLogin, campeonato);
            IList <Framework.DataServices.Model.EntityBaseData> jogos = camp.LoadJogos(0, null, null, DateTime.MinValue, DateTime.MinValue, null);


            IList <Framework.DataServices.Model.EntityBaseData> grupos = camp.LoadGrupos();

            int count = 0;
            int line  = 0;

            foreach (Model.Campeonatos.Grupo grupo in grupos)
            {
                if (!string.IsNullOrEmpty(grupo.Nome.Trim()))
                {
                    NPOI.SS.UserModel.Row  row       = sheetJogos.CreateRow(count++);
                    NPOI.SS.UserModel.Cell grupoCell = row.CreateCell(0);
                    grupoCell.SetCellValue("Grupo " + grupo.Nome);


                    line = 0;
                    row  = sheetJogos.CreateRow(count++);
                    row.CreateCell(line++).SetCellValue("Jogo");
                    row.CreateCell(line++).SetCellValue("Data/Hora");
                    row.CreateCell(line++).SetCellValue("Local");
                    row.CreateCell(line++).SetCellValue("Time");
                    row.CreateCell(line++).SetCellValue("Gols");
                    row.CreateCell(line++).SetCellValue("");
                    row.CreateCell(line++).SetCellValue("");
                    row.CreateCell(line++).SetCellValue("x");
                    row.CreateCell(line++).SetCellValue("");
                    row.CreateCell(line++).SetCellValue("");
                    row.CreateCell(line++).SetCellValue("Gols");
                    row.CreateCell(line++).SetCellValue("Time");
                    row.CreateCell(line++).SetCellValue("");


                    foreach (Model.Campeonatos.Jogo jogo in jogos)
                    {
                        if (string.Compare(jogo.Grupo.Nome, grupo.Nome, true) == 0)
                        {
                            line = 0;
                            row  = sheetJogos.CreateRow(count++);
                            row.CreateCell(line++).SetCellValue(jogo.JogoLabel);
                            row.CreateCell(line++).SetCellValue(jogo.DataJogo.ToString("dd/MM/yy HH:mm"));
                            row.CreateCell(line++).SetCellValue(jogo.Estadio.ToString());
                            row.CreateCell(line++).SetCellValue(jogo.Time1.Nome);
                            if (jogo.PartidaValida)
                            {
                                row.CreateCell(line++).SetCellValue(jogo.GolsTime1);
                            }
                            else
                            {
                                row.CreateCell(line++).SetCellValue("");
                            }
                            row.CreateCell(line++).SetCellValue("");

                            row.CreateCell(line++).SetCellValue("");
                            row.CreateCell(line++).SetCellValue("x");

                            row.CreateCell(line++).SetCellValue("");
                            row.CreateCell(line++).SetCellValue("");

                            if (jogo.PartidaValida)
                            {
                                row.CreateCell(line++).SetCellValue(jogo.GolsTime2);
                            }
                            else
                            {
                                row.CreateCell(line++).SetCellValue("");
                            }
                            row.CreateCell(line++).SetCellValue(jogo.Time2.Nome);
                            row.CreateCell(line++).SetCellValue("");
                        }
                    }

                    sheetJogos.CreateRow(count++);
                }
            }


            sheetJogos.CreateRow(count++);
            CreateFase(sheetJogos, "Oitavas de Final", ref count, jogos);
            sheetJogos.CreateRow(count++);
            CreateFase(sheetJogos, "Quartas de Final", ref count, jogos);
            sheetJogos.CreateRow(count++);
            CreateFase(sheetJogos, "Semi Finais", ref count, jogos);
            sheetJogos.CreateRow(count++);
            CreateFase(sheetJogos, "Final", ref count, jogos);


            Business.Boloes.Support.Bolao bolaoBO = new Business.Boloes.Support.Bolao(_currentLogin, bolao.Nome);

            IList <Framework.DataServices.Model.EntityBaseData> users = bolaoBO.LoadMembros();

            foreach (Framework.Security.Model.UserData user in users)
            {
                CreateUser(wb, user.UserName, bolaoBO);
            }



            wb.Write(new FileStream(_fileName, FileMode.Create));
        }