protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);

            this.ctlMenuTools.ButtonClick           += new CommandEventHandler(ctlMenuTools_ButtonClick);
            this.ctlNavigateHomeControl.ButtonClick += new CommandEventHandler(ctlNavigateHomeControl_ButtonClick);

            //Atualizando o bolão que está sendo analisado
            Business.Boloes.Support.Bolao business = new BolaoNet.Business.Boloes.Support.Bolao(
                base.UserName, CurrentBolao.Nome);

            business.Load();
            CurrentBolao = business;


            //if (CurrentBolao.ApostasApenasAntes && CurrentBolao.IsIniciado)
            //{
            //    this.ctlMenuTools.SaveVisible = false;
            //    //this.btnSave.Visible = false;
            //}
            //else
            //{
            //    this.ctlMenuTools.SaveVisible = true;
            //    //this.btnSave.Visible = true;
            //}
        }
Ejemplo n.º 2
0
        private void ShowBolaoData()
        {
            Business.Boloes.Support.Bolao bolao = new BolaoNet.Business.Boloes.Support.Bolao(base.UserName, CurrentBolao.Nome);
            bolao.Load();


            this.lblStatus.Text      = bolao.IsIniciado ? "Iniciado" : "Aguardando Início";
            this.lblIniciadoPor.Text = bolao.IniciadoBy;

            if (bolao.DataIniciado != DateTime.MinValue)
            {
                this.lblDataInicio.Text = bolao.DataIniciado.ToString("dd/MM/yyyy HH:mm:ss");
            }
            else
            {
                this.lblDataInicio.Text = "-";
            }


            if (bolao.IsIniciado)
            {
                this.btnIniciar.Enabled = false;
                this.btnVoltar.Enabled  = true;
            }
            else
            {
                this.btnIniciar.Enabled = true;
                this.btnVoltar.Enabled  = false;
            }
        }
Ejemplo n.º 3
0
        protected override void  OnInit(EventArgs e)
        {
            this.ctlMenuTools.ButtonClick           += new CommandEventHandler(ctlMenuTools_ButtonClick);
            this.ctlNavigateHomeControl.ButtonClick += new CommandEventHandler(ctlNavigateHomeControl_ButtonClick);


            //Atualizando o bolão que está sendo analisado
            Business.Boloes.Support.Bolao business = new BolaoNet.Business.Boloes.Support.Bolao(
                base.UserName, CurrentBolao.Nome);

            business.Load();
            CurrentBolao = business;


            if (CurrentBolao.ApostasApenasAntes && CurrentBolao.IsIniciado)
            {
                this.MultiViewAuto.ActiveViewIndex = 1;
                this.ctlMenuTools.SaveVisible      = false;
            }
            else
            {
                this.ctlMenuTools.SaveVisible      = true;
                this.MultiViewAuto.ActiveViewIndex = 0;
            }
        }
Ejemplo n.º 4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                Business.Boloes.Support.Bolao business = new BolaoNet.Business.Boloes.Support.Bolao(base.UserName, CurrentBolao.Nome);
                IList <Framework.DataServices.Model.EntityBaseData> list = business.LoadMembros();


                DropDownList cboUsers = (DropDownList)this.MultiViewType.FindControl("cboUsers");

                cboUsers.DataSource = list;
                cboUsers.DataBind();



                business.Load();

                if (business.IsIniciado && business.ApostasApenasAntes)
                {
                    this.btnSalvarExisting.Enabled = false;
                    this.btnSalvarNew.Enabled      = false;
                }
                else
                {
                    this.btnSalvarExisting.Enabled = true;
                    this.btnSalvarNew.Enabled      = true;
                }
            }
        }
Ejemplo n.º 5
0
        protected void cboBolao_SelectedIndexChanged(object sender, EventArgs e)
        {
            //Buscando os controles a serem gerenciados
            DropDownList cboCampeonato = (DropDownList)this.LoginViewMenuRigth.FindControl("cboCampeonato");
            DropDownList cboBolao      = (DropDownList)this.LoginViewMenuRigth.FindControl("cboBolao");

            //Apagando os jogos do campeonato
            ClearJogosCampeonato();


            //Se foi retirada a seleção do bolão
            if (cboBolao.SelectedIndex == 0)
            {
                //Zerando o conteúdo dos dados
                BolaoUserBasePage.CurrentBolao           = null;
                CampeonatoUserBasePage.CurrentCampeonato = null;

                cboCampeonato.SelectedIndex = 0;


                Response.Redirect("~/Users/Home.aspx");
            }
            //Se selecionou um registro na combo
            else
            {
                //Carregando dados do bolão
                Business.Boloes.Support.Bolao business = new BolaoNet.Business.Boloes.Support.Bolao(
                    UserBasePage.CurrentUserName, cboBolao.Text);

                business.Load();

                //Atribuindo as alterações para a memória
                BolaoUserBasePage.CurrentBolao           = (Model.Boloes.Bolao)business;
                BolaoUserBasePage.CurrentCampeonato      = business.Campeonato;
                CampeonatoUserBasePage.CurrentCampeonato = business.Campeonato;

                //Atribuindo o campeonato selecionado
                cboCampeonato.SelectedValue = business.Campeonato.Nome;


                //Armazenando os dados no profile
                Business.Profile.CustomProfile profile = Business.Profile.CustomProfile.GetProfile();
                profile.NomeBolao      = cboBolao.Text;
                profile.NomeCampeonato = cboCampeonato.Text;
                profile.Save();


                //ShowJogosCampeonato(business.Campeonato.Nome);



                Response.Redirect(HttpContext.Current.Request.Url.AbsoluteUri);
            }//endif encontrou registro selecionado
        }
Ejemplo n.º 6
0
        public bool SelectBolao(string nomeBolao)
        {
            DropDownList cboBolao      = (DropDownList)this.LoginViewMenuRigth.FindControl("cboBolao");
            DropDownList cboCampeonato = (DropDownList)this.LoginViewMenuRigth.FindControl("cboCampeonato");

            //Apagando os jogos do usuário
            ClearJogosCampeonato();

            //Buscando em todos os items do bolão
            for (int c = 0; c < cboBolao.Items.Count; c++)
            {
                //Se encontrou o bolão
                if (string.Compare(cboBolao.Items[c].Value, nomeBolao, true) == 0)
                {
                    //Atribuindo o bolão
                    cboBolao.SelectedValue = nomeBolao;

                    //ShowJogosCampeonato(nomeBolao);

                    //Se o usuário está autenticado
                    if (HttpContext.Current.User.Identity.IsAuthenticated)
                    {
                        Business.Profile.CustomProfile profile = Business.Profile.CustomProfile.GetProfile(UserBasePage.CurrentUserName);
                        profile.NomeBolao = nomeBolao;
                        profile.Save();
                    }//endif usuário autenticado


                    //Buscando os detalhes do registro
                    Business.Boloes.Support.Bolao entry =
                        new BolaoNet.Business.Boloes.Support.Bolao(UserBasePage.CurrentUserName, nomeBolao);
                    entry.Load();


                    //Atribuindo os dados do usuário nas combos
                    BolaoUserBasePage.CurrentBolao           = (Model.Boloes.Bolao)entry;
                    BolaoUserBasePage.CurrentCampeonato      = entry.Campeonato;
                    CampeonatoUserBasePage.CurrentCampeonato = entry.Campeonato;
                    cboCampeonato.SelectedValue = entry.Campeonato.Nome;



                    //indicando que encontrou o bolão
                    return(true);
                } //endif encontrou o bolão
            }     //end for items

            //indicando que não conseguiu encontrar o bolão
            return(false);
        }
Ejemplo n.º 7
0
        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);
            this.ctlFilterJogo.FilterChanged += new FilterJogo.FilterEventHandler(ctlFilterJogo_FilterChanged);


            //Atualizando o bolão que está sendo analisado
            if (BolaoUserBasePage.CurrentBolao != null)
            {
                Business.Boloes.Support.Bolao business = new BolaoNet.Business.Boloes.Support.Bolao(
                    UserBasePage.CurrentUserName, BolaoUserBasePage.CurrentBolao.Nome);

                business.Load();
                BolaoUserBasePage.CurrentBolao = business;
            }
        }
Ejemplo n.º 8
0
        protected void btnVoltar_Click(object sender, EventArgs e)
        {
            Business.Boloes.Support.Bolao business = new BolaoNet.Business.Boloes.Support.Bolao(base.UserName, CurrentBolao.Nome);
            if (business.Aguardar())
            {
                base.ShowMessages("Alterado o status do bolão com sucesso.");
            }
            else
            {
                base.ShowErrors("Erro ao mudar o status do bolão.");
            }


            business.Load();
            CurrentBolao = (Model.Boloes.Bolao)business;

            ShowBolaoData();
        }
Ejemplo n.º 9
0
        protected void btnIniciar_Click(object sender, EventArgs e)
        {
            Business.Boloes.Support.Bolao business = new BolaoNet.Business.Boloes.Support.Bolao(base.UserName, CurrentBolao.Nome);
            business.IniciadoBy = base.UserName;
            if (business.Iniciar())
            {
                base.ShowMessages("Bolão iniciado com sucesso.");
            }
            else
            {
                base.ShowErrors("Erro ao iniciar o bolão.");
            }

            business.Load();
            CurrentBolao = (Model.Boloes.Bolao)business;


            ShowBolaoData();
        }
Ejemplo n.º 10
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                //Carregando todos os campeonatos
                Business.Campeonatos.Support.Campeonato campeonato = new Business.Campeonatos.Support.Campeonato(base.UserName);
                this.cboCobertura.DataSource     = campeonato.SelectAll(null);
                this.cboCobertura.DataTextField  = "Nome";
                this.cboCobertura.DataValueField = "Nome";
                this.cboCobertura.DataBind();


                string mode = Request.QueryString["mode"];

                if (string.IsNullOrEmpty(mode) && Request.QueryString["NomeBolao"] == null)
                {
                    mode = ((int)Business.Util.ActionMode.Edit).ToString();
                }

                ModeView = Business.Util.Mode.GetAction(mode);


                //Changing the mode view
                ChangeModeView(ModeView);

                string nomeBolao = CurrentBolao.Nome;

                if (Request.QueryString["NomeBolao"] != null)
                {
                    nomeBolao = Request.QueryString["NomeBolao"];
                }

                Business.Boloes.Support.Bolao bolao = new BolaoNet.Business.Boloes.Support.Bolao(base.UserName, nomeBolao);
                bolao.Load();

                //BolaoData = (Model.Boloes.Bolao)bolao;

                ShowBolao(bolao);
            }
        }
Ejemplo n.º 11
0
        private bool ApproveUser(string login, string key)
        {
            bool isApproved = false;


            Framework.Security.Business.UserDataService userService =
                new Framework.Security.Business.UserDataService(HttpContext.Current.User.Identity.Name);
            userService.UserName    = login;
            userService.ActivateKey = key;


            //Aprovando o usuário
            isApproved = userService.ApproveUser();


            //Buscando dados do usuário
            Framework.Security.Business.CustomMembershipUser customUser =
                (Framework.Security.Business.CustomMembershipUser)Membership.Provider.GetUser(login, false);


            //Se o usuário não foi encontrado
            if (customUser == null)
            {
                base.ShowErrors("Usuário não encontrado na base de dados.");
                this.MultiViewConfirm.ActiveViewIndex = 0;

                return(false);
            }
            //Se o usuário foi encontrado
            else
            {
                //inserindo as roles do usuário que está sendo inserido
                //string [] roles = new string[4];
                //roles[0] = "Apostador";
                //roles[1] = "Convidado";
                //roles[2] = "Visitante de Bolão";
                //roles[3] = "Visitante de Campeonato";

                string rolesToAdd = ConfigurationManager.AppSettings["RolesToAddAtConfirmation"];


                if (rolesToAdd != null)
                {
                    string[] roles = rolesToAdd.Split(new char[] { '|' });

                    System.Web.Security.Roles.AddUserToRoles(login, roles);
                }



                //Inserindo os usuários na lista de itens no momento da confirmação do login
                string listToAdd = ConfigurationManager.AppSettings["BolaoListToAddAtConfirmation"];

                if (!string.IsNullOrEmpty(listToAdd))
                {
                    string[] items = listToAdd.Split(new char [] { '|' });

                    foreach (string entry in items)
                    {
                        Business.Boloes.Support.Bolao bolao = new BolaoNet.Business.Boloes.Support.Bolao(login, entry);
                        bolao.Load();

                        if ((!bolao.ApostasApenasAntes) || (bolao.ApostasApenasAntes && !bolao.IsIniciado))
                        {
                            bolao.InsertMembro(new Framework.Security.Model.UserData(login));
                        }
                    }
                }//endif items a serem inseridos



                this.MultiViewConfirm.ActiveViewIndex = 1;

                //Mostrando dados do usuário
                ShowUserData(customUser);

                this.lblChave.Text = userService.ActivateKey;

                //Se não foi aprovado
                if (!isApproved)
                {
                    base.ShowErrors("Chave do usuário inválido para aprovação.");
                    this.lblStatus.Text = "Chave do usuário inválido para aprovação.";
                }
                //Se foi aprovado
                else
                {
                    base.ShowMessages("Usuário aprovado.");
                    this.lblStatus.Text = "Usuário aprovado.";

                    this.lnkTentarNovamente.Visible = false;

                    Framework.Security.Business.UserDataService userEntry =
                        new Framework.Security.Business.UserDataService("", customUser.UserData);



                    ////Salvando os dados do profile do usuário
                    //Business.Profile.CustomProfile profile = Business.Profile.CustomProfile.GetProfile();
                    //profile.NomeCampeonato = "";
                    //profile.NomeBolao = "";
                    //profile.Save();


                    Framework.Logging.Logger.LogManager.WriteInformation(null, this, "Usuário " + customUser.UserData.UserName + " aprovado.", null);


                    Framework.Security.Util.Mail.Send(userEntry.LoadUser(), Framework.Security.Util.Mail.Template.Welcome);
                } //endif se foi aprovado
            }     //endif usuário encontrado



            return(true);
        }
Ejemplo n.º 12
0
        protected void loginUser_LoggedIn(object sender, EventArgs e)
        {
            bool updated = false;


            //Atribuindo o nome do usuário
            UserBasePage.CurrentUserName = this.loginUser.UserName;

            Business.Profile.CustomProfile profile = Business.Profile.CustomProfile.GetProfile(this.loginUser.UserName);

            #region Campeonato
            //Se já tem nenhum campeonato selecionado
            if (CampeonatoUserBasePage.CurrentCampeonato != null)
            {
                //Atribuindo o campeonato no profile
                profile.NomeCampeonato = CampeonatoUserBasePage.CurrentCampeonato.Nome;
                updated = true;
            }
            //Se não tem um campeonato selecionado
            else
            {
                string nomeCampeonato = profile.NomeCampeonato;

                //Se existe existe um nome de campeonato associado ao profile
                if (!string.IsNullOrEmpty(nomeCampeonato))
                {
                    //Carregando o campeonato para o profile
                    Business.Campeonatos.Support.Campeonato business = new BolaoNet.Business.Campeonatos.Support.Campeonato(
                        UserBasePage.CurrentUserName, nomeCampeonato);
                    business.Load();

                    CampeonatoUserBasePage.CurrentCampeonato = business;
                }
            }//endif campeonato selecionado

            #endregion

            #region Bolao
            //Se já existe um bolão selecionado
            if (BolaoUserBasePage.CurrentBolao != null)
            {
                //Atribuindo ao profile o bolão selecionado
                profile.NomeBolao = BolaoUserBasePage.CurrentBolao.Nome;
                updated           = true;
            }
            else
            {
                string nomeBolao = profile.NomeBolao;

                //Se encontrou um bolão no profile do usuário
                if (!string.IsNullOrEmpty(nomeBolao))
                {
                    //Carregando o bolão para o profile do usuário
                    Business.Boloes.Support.Bolao business = new BolaoNet.Business.Boloes.Support.Bolao(
                        UserBasePage.CurrentUserName, nomeBolao);
                    business.Load();

                    BolaoUserBasePage.CurrentBolao = business;
                } //endif encontrou bolão no profile
            }     //bolão selecionado
            #endregion


            //Se teve alteração do profile do usuário
            if (updated)
            {
                profile.Save();
            }
        }