Exemple #1
0
        public void Delete()
        {
            Framework.DataServices.Model.EntityBaseData entry = new
                                                                BolaoNet.Model.Campeonatos.Jogo();

            object result = base.CommonDatabase.ExecuteScalar(
                CommandType.Text, QueryToGetTheLastID, false, Constants.CurrentUser);

            ((Model.Campeonatos.Jogo)entry).IDJogo     = (int)result;
            ((Model.Campeonatos.Jogo)entry).Campeonato = new BolaoNet.Model.Campeonatos.Campeonato(Tests.Dao.Campeonato.EntryToLoad);


            base.Delete(entry, string.Format(QueryToCompareDelete, (int)result));
        }
Exemple #2
0
        public long LoadApostasCountByJogo(BolaoNet.Model.Boloes.Bolao bolao, BolaoNet.Model.Campeonatos.Jogo jogo, string condition)
        {
            int    errorNumber      = 0;
            string errorDescription = null;

            long result = _daoBase.LoadApostasCountByJogo(
                _currentLogin, bolao, jogo, condition, out errorNumber, out errorDescription);

            if (errorNumber != 0 || !string.IsNullOrEmpty(errorDescription))
            {
                return(-1);
            }

            return(result);
        }
Exemple #3
0
        public void Insert()
        {
            Framework.DataServices.Model.EntityBaseData entry = new
                                                                BolaoNet.Model.Campeonatos.Jogo();

            ((Model.Campeonatos.Jogo)entry).Campeonato = new BolaoNet.Model.Campeonatos.Campeonato(Tests.Dao.Campeonato.EntryToLoad);
            ((Model.Campeonatos.Jogo)entry).Titulo     = "Test";

            object result = base.CommonDatabase.ExecuteScalar(
                CommandType.Text, QueryToGetTheLastID, false, Constants.CurrentUser);

            base.Insert(entry, string.Format(QueryToCompareInsert, (int)result));

            if (((Model.Campeonatos.Jogo)entry).IDJogo == 0)
            {
                throw new AssertTestException("Didn't find the ID item");
            }
        }
Exemple #4
0
        public bool InsertCampeonatoCopaMundo2010Jogo(string currentLogin, bool isClube,
                                                      string nomeCampeonato, DateTime dataJogo, string estadio,
                                                      string time1, string time2, string nomeFase, string nomeGrupo, int rodada,
                                                      string titulo)
        {
            Model.Campeonatos.Jogo jogo = new BolaoNet.Model.Campeonatos.Jogo();
            jogo.Campeonato = new BolaoNet.Model.Campeonatos.Campeonato(nomeCampeonato);
            jogo.DataJogo   = dataJogo;
            jogo.Estadio    = new BolaoNet.Model.DadosBasicos.Estadio(estadio);
            jogo.Fase       = new BolaoNet.Model.Campeonatos.Fase(nomeFase);
            jogo.Grupo      = new BolaoNet.Model.Campeonatos.Grupo(nomeGrupo);
            jogo.Rodada     = rodada;
            jogo.Time1      = new BolaoNet.Model.DadosBasicos.Time(time1);
            jogo.Time2      = new BolaoNet.Model.DadosBasicos.Time(time2);
            jogo.Titulo     = titulo;

            Business.Campeonatos.Support.Jogo business = new Jogo(currentLogin, jogo);
            bool result = business.InsertWithAllData(isClube, jogo);

            return(result);
        }
        public Model.Campeonatos.Jogo GetCurrentJogo()
        {
            Model.Campeonatos.Jogo jogo = new BolaoNet.Model.Campeonatos.Jogo();

            if (this.lblIDJogo.Text.Length > 0)
            {
                jogo.IDJogo = Convert.ToInt32(this.lblIDJogo.Text);
            }

            if (this.lblDataJogo.Text.Length > 0 && this.lblHoraJogo.Text.Length > 0)
            {
                jogo.DataJogo = Convert.ToDateTime(this.lblDataJogo.Text + " " + this.lblHoraJogo.Text);
            }

            if (this.lblDataValidacao.Text.Length > 0 && this.lblDataValidacao.Text != "-")
            {
                jogo.ValidadoBy    = this.lblValidadoBy.Text;
                jogo.DataValidacao = Convert.ToDateTime(this.lblDataValidacao.Text);
            }

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

            jogo.Estadio = new Model.DadosBasicos.Estadio(this.lblEstadio.Text);
            jogo.Fase    = new Model.Campeonatos.Fase(this.lblFase.Text);

            if (this.txtGols1.Text.Length > 0)
            {
                jogo.GolsTime1 = Convert.ToInt16(this.txtGols1.Text);
            }

            if (this.txtGols2.Text.Length > 0)
            {
                jogo.GolsTime2 = Convert.ToInt16(this.txtGols2.Text);
            }


            if (this.txtPenaltis1.Text.Length > 0)
            {
                jogo.PenaltisTime1 = Convert.ToInt16(this.txtPenaltis1.Text);
            }
            if (this.txtPenaltis2.Text.Length > 0)
            {
                jogo.PenaltisTime2 = Convert.ToInt16(this.txtPenaltis2.Text);
            }

            if (this.lblRodada.Text.Length > 0)
            {
                jogo.Rodada = Convert.ToInt32(this.lblRodada.Text);
            }

            jogo.Time1 = new Model.DadosBasicos.Time(this.lblTime1.Text);
            jogo.Time2 = new Model.DadosBasicos.Time(this.lblTime2.Text);

            jogo.Titulo = this.lblTime1.Text;


            jogo.Campeonato = new BolaoNet.Model.Campeonatos.Campeonato(this.lblCampeonato.Text);


            return(jogo);
        }
Exemple #6
0
        public bool LoadCampeonato(bool isClube, string file)
        {
            if (!System.IO.File.Exists(file))
            {
                return(false);
            }


            List <Model.Campeonatos.Jogo> list = new List <BolaoNet.Model.Campeonatos.Jogo>();


            string line;


            System.IO.StreamReader reader = new System.IO.StreamReader(file);

            while (reader.Peek() >= 0)
            {
                line = reader.ReadLine();

                if (!string.IsNullOrEmpty(line))
                {
                    int posEndRodada = line.IndexOf('\t');

                    int posEndData = line.IndexOf('\t', posEndRodada + 1);

                    int posEndHora = line.IndexOf('\t', posEndData + 1);

                    int posEndTime1 = line.IndexOf('\t', posEndHora + 1);

                    int posStartTime2 = line.IndexOf('x', posEndTime1);

                    int posEndTime2 = line.IndexOf('\t', posStartTime2 + 2);


                    int rodada = Convert.ToInt32(line.Substring(0, posEndRodada).Trim());

                    string data = line.Substring(posEndRodada + 1, 5);
                    string hora = line.Substring(posEndData + 1, 5);

                    DateTime DataJogo = Convert.ToDateTime(data + "/2010 " + hora);

                    string time1 = line.Substring(posEndHora + 1, posEndTime1 - posEndHora).Trim();
                    string time2 = line.Substring(posStartTime2 + 1).Trim();


                    Model.Campeonatos.Jogo jogo = new BolaoNet.Model.Campeonatos.Jogo();

                    jogo.Campeonato         = this;
                    jogo.Campeonato.IsClube = isClube;
                    jogo.DataJogo           = DataJogo;
                    jogo.Fase   = new BolaoNet.Model.Campeonatos.Fase("Primeira Fase");
                    jogo.Grupo  = new BolaoNet.Model.Campeonatos.Grupo(" ");
                    jogo.Rodada = rodada;
                    jogo.Time1  = new BolaoNet.Model.DadosBasicos.Time(time1);
                    jogo.Time2  = new BolaoNet.Model.DadosBasicos.Time(time2);

                    list.Add(jogo);
                } //endif conteudo na linha
            }     //end while



            foreach (Model.Campeonatos.Jogo jogo in list)
            {
                Business.Campeonatos.Support.Jogo business = new Jogo(_currentLogin);
                bool result = business.InsertWithAllData(isClube, jogo);
            }


            return(true);
        }
Exemple #7
0
        public IList <Framework.DataServices.Model.EntityBaseData> LoadApostasByJogo(BolaoNet.Model.Boloes.Bolao bolao, BolaoNet.Model.Campeonatos.Jogo jogo, string condition)
        {
            int    errorNumber      = 0;
            string errorDescription = null;

            IList <Framework.DataServices.Model.EntityBaseData> list = _daoBase.LoadApostasByJogo(
                _currentLogin, bolao, jogo, condition, out errorNumber, out errorDescription);

            if (errorNumber != 0 || !string.IsNullOrEmpty(errorDescription))
            {
                return(null);
            }

            return(list);
        }
Exemple #8
0
        private static void LoadDataFromFile(string file)
        {
            string lastGroup = "";
            //string lastFase = "";

            List <BolaoNet.Model.Campeonatos.Jogo> list = new List <BolaoNet.Model.Campeonatos.Jogo>();


            System.IO.StreamReader reader = new System.IO.StreamReader(file);

            while (reader.Peek() >= 0)
            {
                string line = reader.ReadLine();

                //Se a linha tem conteudo
                if (!string.IsNullOrEmpty(line) && line.Length > 2)
                {
                    //Se é a data do jogo
                    if (char.IsNumber(line[0]) && char.IsNumber(line[1]))
                    {
                        DateTime dataJogo;
                        string   time1;
                        string   time2;
                        string   estadio;

                        int posDate     = line.IndexOf('\t');
                        int posLastDate = line.IndexOf('\t', posDate + 1);

                        dataJogo = Convert.ToDateTime(line.Substring(0, posLastDate));


                        int posEndTime1 = line.IndexOf('x', posLastDate + 1);
                        time1 = line.Substring(posLastDate, posEndTime1 - posLastDate).Trim();



                        int currentPos = line.Length - 1;

                        while (line[currentPos] != '\t')
                        {
                            currentPos--;
                        }

                        estadio = line.Substring(currentPos).Trim();

                        time2 = line.Substring(posEndTime1 + 1, currentPos - posEndTime1 - 1).Trim();

                        BolaoNet.Model.Campeonatos.Jogo jogo = new BolaoNet.Model.Campeonatos.Jogo();
                        jogo.Campeonato = new BolaoNet.Model.Campeonatos.Campeonato("Copa do Mundo 2010");
                        jogo.DataJogo   = dataJogo.AddMonths(-6);
                        jogo.Estadio    = new BolaoNet.Model.DadosBasicos.Estadio(estadio);
                        jogo.Fase       = new BolaoNet.Model.Campeonatos.Fase("1");
                        jogo.Grupo      = new BolaoNet.Model.Campeonatos.Grupo(lastGroup);

                        jogo.Time1 = new BolaoNet.Model.DadosBasicos.Time(time1);
                        jogo.Time2 = new BolaoNet.Model.DadosBasicos.Time(time2);
                    }
                    //Se é o título
                    else
                    {
                        lastGroup = line.Substring(25).Replace("GRUPO", "").Trim();
                    }
                } //endif conteudo na linha
            }     //end while
            reader.Close();
        }
Exemple #9
0
        public long LoadApostasCountByJogo(string currentUser, BolaoNet.Model.Boloes.Bolao bolao, BolaoNet.Model.Campeonatos.Jogo jogo, string condition, out int errorNumber, out string errorDescription)
        {
            errorNumber      = 0;
            errorDescription = null;

            string conditionCheck = condition;

            if (!string.IsNullOrEmpty(conditionCheck))
            {
                conditionCheck = conditionCheck + " AND Jogos.NomeCampeonato='" + jogo.Campeonato.Nome + "' AND Jogos.IDJogo=" + jogo.IDJogo;
            }

            return(SelectCount(currentUser, conditionCheck, out errorNumber, out errorDescription));
        }
Exemple #10
0
        public IList <Framework.DataServices.Model.EntityBaseData> LoadApostasByJogo(string currentUser, BolaoNet.Model.Boloes.Bolao bolao, BolaoNet.Model.Campeonatos.Jogo jogo, string condition, out int errorNumber, out string errorDescription)
        {
            errorNumber      = 0;
            errorDescription = null;

            string conditionCheck = condition;

            if (!string.IsNullOrEmpty(conditionCheck))
            {
                conditionCheck = conditionCheck + " AND Jogos.NomeCampeonato='" + jogo.Campeonato.Nome + "' AND Jogos.IDJogo=" + jogo.IDJogo;
            }
            else
            {
                conditionCheck = "Jogos.NomeCampeonato='" + jogo.Campeonato.Nome + "' AND Jogos.IDJogo=" + jogo.IDJogo;
            }



            return(SelectAll(currentUser, conditionCheck, out errorNumber, out errorDescription));
        }