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



            for (int c = 0; c < this.grdApostas.Rows.Count; c++)
            {
                Model.Boloes.ApostaExtra aposta = (Model.Boloes.ApostaExtra)list[c];

                DropDownList cboNomeTime = (DropDownList)this.grdApostas.Rows[c].FindControl("cboNomeTime");

                //Se mudou o time atualizado
                if (string.Compare(cboNomeTime.Text, aposta.NomeTimeValidado, true) != 0)
                {
                    Business.Boloes.Support.ApostaExtra business =
                        new Business.Boloes.Support.ApostaExtra(base.UserName);

                    business.Copy(aposta);
                    business.Bolao = new BolaoNet.Model.Boloes.Bolao(CurrentBolao.Nome);
                    //business.UserName = base.UserName;

                    business.NomeTimeValidado = cboNomeTime.Text;

                    business.InsertResult();
                } //endif mudou time
            }     //end for c

            BindGrid();

            base.ShowMessages("Dados extras armazenados com sucesso.");
        }
Exemplo n.º 2
0
        public Framework.DataServices.Model.EntityBaseData Load(string currentUser, Framework.DataServices.Model.EntityBaseData entry, out int errorNumber, out string errorDescription)
        {
            errorNumber      = 0;
            errorDescription = null;

            Model.Boloes.ApostaExtra entryData = (Model.Boloes.ApostaExtra)entry;


            DataTable table = base.ExecuteFill(CommandType.StoredProcedure, base._commandSelect, true, currentUser,
                                               base.Parameters.Create("@Posicao", DbType.Int64, entryData.Posicao),
                                               base.Parameters.Create("@NomeBolao", DbType.String, entryData.Bolao.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.");

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



            return(Util.ApostaExtra.ConvertToObject(table.Rows[0]));
        }
Exemplo n.º 3
0
        protected void grdApostas_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType != DataControlRowType.DataRow)
            {
                return;
            }


            DropDownList cboNomeTime = (DropDownList)e.Row.FindControl("cboNomeTime");

            Image imgTime = (Image)e.Row.FindControl("imgTime");


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

            cboNomeTime.DataSource     = list;
            cboNomeTime.DataValueField = "Nome";
            cboNomeTime.DataTextField  = "Nome";
            cboNomeTime.DataBind();


            Model.Boloes.ApostaExtra aposta = (Model.Boloes.ApostaExtra)e.Row.DataItem;


            if (!string.IsNullOrEmpty(aposta.NomeTimeValidado))
            {
                cboNomeTime.SelectedValue = aposta.NomeTimeValidado;
            }

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


            if (aposta.IsValido)
            {
                lblNomeTime.Visible = true;
                cboNomeTime.Visible = false;

                imgTime.ImageUrl = @"~\Images\Database\Times\" + lblNomeTime.Text + ".gif";
            }
            else
            {
                //lblPontos.Text = "-";
                lblNomeTime.Visible = false;
                cboNomeTime.Visible = true;



                imgTime.ImageUrl = @"~\Images\Database\Times\" + cboNomeTime.Text + ".gif";
            }
        }
Exemplo n.º 4
0
        public bool Delete(string currentUser, Framework.DataServices.Model.EntityBaseData entry, out int errorNumber, out string errorDescription)
        {
            errorNumber      = 0;
            errorDescription = null;

            Model.Boloes.ApostaExtra entryData = (Model.Boloes.ApostaExtra)entry;

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

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

            return(Convert.ToInt32(base.ExecutionStatus.Command.Parameters["@ReturnValue"].Value) >= 1 ? true : false);
        }
        protected void grdApostas_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType != DataControlRowType.DataRow)
            {
                return;
            }


            DropDownList cboNomeTime = (DropDownList)e.Row.FindControl("cboNomeTime");

            Image imgTime = (Image)e.Row.FindControl("imgTime");


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

            cboNomeTime.DataSource     = list;
            cboNomeTime.DataValueField = "Nome";
            cboNomeTime.DataTextField  = "Nome";
            cboNomeTime.DataBind();


            Model.Boloes.ApostaExtra aposta = (Model.Boloes.ApostaExtra)e.Row.DataItem;


            if (!string.IsNullOrEmpty(aposta.NomeTimeValidado))
            {
                cboNomeTime.SelectedValue = aposta.NomeTimeValidado;
            }

            //Label lblPontos = (Label)e.Row.FindControl("lblPontos");
            //Label lblDataAposta = (Label)e.Row.FindControl("lblDataAposta");
            Label lblNomeTime = (Label)e.Row.FindControl("lblNomeTime");


            //if (aposta.DataValidacao == DateTime.MinValue)
            //{
            //    lblDataAposta.Text = "-";
            //}
            //else
            //{
            //    lblDataAposta.Text = aposta.DataAposta.ToString("dd/MM/yyyy HH:mm:ss");
            //}


            //if (CurrentBolao.ApostasApenasAntes && CurrentBolao.IsIniciado)
            //{
            //    //lblPontos.Text = aposta.Pontos.ToString();
            //    lblNomeTime.Visible = true;
            //    cboNomeTime.Visible = false;

            //    imgTime.ImageUrl = @"~\Images\Database\Times\" + lblNomeTime.Text + ".gif";
            //}
            //else
            //{
            //lblPontos.Text = "-";
            lblNomeTime.Visible = false;
            cboNomeTime.Visible = true;



            imgTime.ImageUrl = @"~\Images\Database\Times\" + cboNomeTime.Text + ".gif";
            //}
        }