コード例 #1
0
        //Método para Atualizar
        private void Editar()
        {
            Categoria    dto = new Categoria();
            BllCategoria bll = new BllCategoria();

            dto.CategoriaId = Convert.ToInt32(txtCodigo.Text);
            dto.Operacao    = "Editar";
            dto.NomeCateg   = txtCategoria.Text;

            if (ckActivo.Checked == true)
            {
                dto.Estado = true;
            }
            else
            {
                dto.Estado = false;
            }

            string retorno = bll.Cadastrar(dto);

            try
            {
                //int CategoriaId = Convert.ToInt32(retorno);
                MessageBox.Show(retorno, "Informação", MessageBoxButtons.OK, MessageBoxIcon.Information);
                LimparCampos();
                Listar();
            }
            catch
            {
                MessageBox.Show("Erro ao Cadastrar. Detalhes: " + retorno, "Erro", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
コード例 #2
0
        protected void repEstado_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            RelFiltroRanking objFiltroRanking = UCFiltroRanking1.GetFiltro();

            objFiltroRanking.TipoEtapaMpe = Vinit.SG.Common.EnumType.TipoEtapaMpe.InscriçãoCandidaturaEmpresa;

            switch (e.Item.ItemType)
            {
            case ListItemType.AlternatingItem:
            case ListItemType.Item:

                Label lblEstado = (Label)e.Item.FindControl("lblEstado");
                lblEstado.Text = DataBinder.Eval(e.Item.DataItem, "Estado").ToString();

                objFiltroRanking.Estado = ObjectUtils.ToInt(DataBinder.Eval(e.Item.DataItem, "IdEstado").ToString());
                this.IdEstado           = objFiltroRanking.Estado;

                Repeater rep = (Repeater)e.Item.FindControl("repEstadoItem");

                List <EntCategoriaCustom> listCategoria = new BllCategoria().ObterCategoriaEmpresasInscritasPorFiltro(objFiltroRanking);
                this.TotalGeral = 0;

                rep.ItemDataBound += new System.Web.UI.WebControls.RepeaterItemEventHandler(this.repTotal_ItemDataBound);
                rep.DataSource     = listCategoria;
                rep.DataBind();
                break;
            }
        }
コード例 #3
0
        private void PesquisarPor()
        {
            Categoria    dto = new Categoria();
            BllCategoria bll = new BllCategoria();
            DataTable    dt  = new DataTable();


            int Codig;

            try
            {
                if (int.TryParse(txtPesquisar.Text, out Codig) == true)
                {
                    dto.Operacao    = "ListarPor";
                    dto.CategoriaId = Codig;
                }
                else
                {
                    dto.Operacao  = "ListarPorNome";
                    dto.NomeCateg = txtPesquisar.Text;
                }

                dt = bll.PesquisarPor(dto);
                bsGrid.DataSource = dt;
                dgv.DataSource    = bsGrid;
                dgv.Update();
                dgv.Refresh();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
コード例 #4
0
        //Método Carregar DatagridView
        private void Listar()
        {
            Categoria    dto = new Categoria();
            BllCategoria bll = new BllCategoria();

            try
            {
                dto.Operacao = "Listar";
                DataTable dt = bll.ListarCateg(dto);
                dgv.DataSource = dt;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
コード例 #5
0
        private void MontarRepeater(Repeater rep)
        {
            RelFiltroRanking objFiltroRanking = UCFiltroRanking1.GetFiltro();

            objFiltroRanking.TipoEtapaMpe = Vinit.SG.Common.EnumType.TipoEtapaMpe.InscriçãoCandidaturaEmpresa;

            switch (rep.ID)
            {
            case "repTotal":

                List <EntCategoriaCustom> listCategoria = new BllCategoria().ObterCategoriaEmpresasInscritasPorFiltro(objFiltroRanking);

                if (listCategoria.Count > 0)
                {
                    rep.Visible    = true;
                    rep.DataSource = listCategoria;
                    rep.DataBind();
                }
                else
                {
                    rep.Visible = false;
                }

                break;

            case "repEstado":

                List <EntEstado> listEstado = new BllEstado().ObterEstadoEmpresasInscritasPorFiltro(objFiltroRanking);

                if (listEstado.Count > 0)
                {
                    this.lblMensagemEstado.Visible = false;
                    rep.Visible    = true;
                    rep.DataSource = listEstado;
                    rep.DataBind();
                }
                else
                {
                    this.lblMensagemEstado.Visible = true;
                    rep.Visible = false;
                }

                break;
            }
        }
コード例 #6
0
        //  Método carregar Categoria
        public void cbCategoria()
        {
            Categoria    dto = new Categoria();
            BllCategoria bll = new BllCategoria();

            dto.Operacao = "ListarCombo";
            try
            {
                DataTable dt = bll.ListarCateg(dto);

                DataRow topItem = dt.NewRow();
                topItem[0] = 0;
                topItem[1] = "-- Selecionar --";
                dt.Rows.InsertAt(topItem, 0);
                cbCateg.DataSource    = dt;
                cbCateg.DisplayMember = "NomeCateg";
                cbCateg.ValueMember   = "CategoriaId";
            }
            catch (Exception ex)
            {
                FNotificao.AlerForm(ex.Message, TipoNotificacao.erro);
            }
        }
コード例 #7
0
        //Carregar Combo Categoria
        private void cbCategoria()
        {
            BllCategoria bll = new BllCategoria();
            Categoria    dto = new Categoria();

            try
            {
                dto.Operacao = "Listar";
                DataTable dt      = bll.ListarCateg(dto);
                DataRow   topItem = dt.NewRow();
                topItem[0] = 0;
                topItem[1] = "- Selecionar Categoria -";
                dt.Rows.InsertAt(topItem, 0);
                cbCateg.DataSource = dt;

                cbCateg.DisplayMember = "NomeCateg";
                cbCateg.ValueMember   = "CategoriaId";
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
コード例 #8
0
        void MontaItem(RepeaterItemEventArgs e)
        {
            List <EntCategoriaCustom> listCategoriaAdmin;
            List <EntCategoriaCustom> listCategoriaDigitador;
            RelFiltroRanking          objFiltroRanking = UCFiltroRanking1.GetFiltro();

            objFiltroRanking.TipoEtapaMpe = Vinit.SG.Common.EnumType.TipoEtapaMpe.InscriçãoCandidaturaEmpresa;

            objFiltroRanking.Estado = this.IdEstado;

            // Categoria
            Label lblCategoria = (Label)e.Item.FindControl("lblCategoria");

            lblCategoria.Text = "";
            lblCategoria.Text = DataBinder.Eval(e.Item.DataItem, "Categoria").ToString();

            Int32 IdCategoria = ObjectUtils.ToInt(DataBinder.Eval(e.Item.DataItem, "IdCategoria"));

            // Quantidade Digitador
            Label lblQtdDigitador = (Label)e.Item.FindControl("lblQtdDigitador");

            listCategoriaDigitador = new BllCategoria().ObterDigitadorEmpresasInscritasPorFiltro(objFiltroRanking).FindAll(delegate(EntCategoriaCustom Categoria) { return(Categoria.IdCategoria == IdCategoria); });
            Int32 CountEmpresaGeralDigitador = listCategoriaDigitador.Sum <EntCategoriaCustom>(TotalQtde => TotalQtde.CountEmpresas);

            this.TotalGeral     += CountEmpresaGeralDigitador;
            lblQtdDigitador.Text = CountEmpresaGeralDigitador.ToString();

            // Quantidade Empresa
            Label lblQtdEmpresa = (Label)e.Item.FindControl("lblQtdEmpresa");

            listCategoriaAdmin = new BllCategoria().ObterAdminEmpresasInscritasPorFiltro(objFiltroRanking).FindAll(delegate(EntCategoriaCustom Categoria) { return(Categoria.IdCategoria == IdCategoria); });
            Int32 CountEmpresaGeralAdmin = listCategoriaAdmin.Sum <EntCategoriaCustom>(TotalQtde => TotalQtde.CountEmpresas);

            this.TotalGeral   += CountEmpresaGeralAdmin;
            lblQtdEmpresa.Text = CountEmpresaGeralAdmin.ToString();
        }
コード例 #9
0
        //Carregar Combo TipoFarmaco
        private void cbTipoFarmaco()
        {
            TipoFarmaco  dto = new TipoFarmaco();
            BllCategoria bll = new BllCategoria();

            dto.Operacao = "ListarTipoFarmaco";

            try
            {
                dto.SubCategoriaId = Convert.ToInt32(cbSubCateg.SelectedValue.ToString());
                DataTable dt      = bll.ListarTipoFarmaco(dto);
                DataRow   topItem = dt.NewRow();
                topItem[0] = 0;
                topItem[1] = "-- Selecionar --";
                dt.Rows.InsertAt(topItem, 0);
                cbTipoFarmco.DisplayMember = "NomeTipoFarmaco";
                cbTipoFarmco.ValueMember   = "TipoFarmacoId";
                cbTipoFarmco.DataSource    = dt;
            }
            catch (Exception ex)
            {
                FNotificao.AlerForm(ex.Message, TipoNotificacao.erro);
            }
        }
コード例 #10
0
        void MontaFooter(RepeaterItemEventArgs e)
        {
            List <EntCategoriaCustom> listCategoriaAdmin;
            List <EntCategoriaCustom> listCategoriaDigitador;
            RelFiltroRanking          objFiltroRanking = UCFiltroRanking1.GetFiltro();

            objFiltroRanking.TipoEtapaMpe = Vinit.SG.Common.EnumType.TipoEtapaMpe.InscriçãoCandidaturaEmpresa;

            objFiltroRanking.Estado = this.IdEstado;

            int qtd;
            int total          = 0;
            int totalEmpresa   = 0;
            int totalDigitador = 0;

            #region Gráfico
            PlaceHolder ph = (PlaceHolder)e.Item.FindControl("phGrafico");
            ph.Controls.Clear();

            List <EntCategoriaCustom> listCategoria = new BllCategoria().ObterCategoriaEmpresasInscritasPorFiltro(objFiltroRanking);

            Int32 RowIndex = 0;
            string[,] valorXY = new string[listCategoria.Count, 3];

            foreach (EntCategoriaCustom objCategoria in listCategoria)
            {
                decimal valor = 0;
                total = 0;

                listCategoriaAdmin     = new BllCategoria().ObterAdminEmpresasInscritasPorFiltro(objFiltroRanking).FindAll(delegate(EntCategoriaCustom Categoria) { return(Categoria.IdCategoria == objCategoria.IdCategoria); });
                listCategoriaDigitador = new BllCategoria().ObterDigitadorEmpresasInscritasPorFiltro(objFiltroRanking).FindAll(delegate(EntCategoriaCustom Categoria) { return(Categoria.IdCategoria == objCategoria.IdCategoria); });

                totalEmpresa = listCategoriaAdmin.Sum <EntCategoriaCustom>(TotalQtde => TotalQtde.CountEmpresas);
                total        = totalEmpresa;

                totalDigitador = listCategoriaDigitador.Sum <EntCategoriaCustom>(TotalQtde => TotalQtde.CountEmpresas);
                total         += totalDigitador;

                if (this.TotalGeral > 0)
                {
                    valor = (total * 100 / (this.TotalGeral));
                }

                valorXY[RowIndex, 0] = valor.ToString("0");
                valorXY[RowIndex, 1] = valor.ToString("0.00") + "%";
                valorXY[RowIndex, 2] = objCategoria.Categoria;

                RowIndex += 1;
            }

            Grafico grafico = new Grafico();
            ph.Controls.Add(grafico.GerarGraficoPizza(valorXY));

            //Criando Gráfico Pizza para Inscrições Realizadas
            string[,] valorXYRealizado = new string[2, 3];

            PlaceHolder phRealizado = (PlaceHolder)e.Item.FindControl("phGraficoRealizada");
            phRealizado.Controls.Clear();

            decimal valorRealizado = 0;
            try
            {
                valorRealizado = (totalEmpresa * 100 / (totalEmpresa + totalDigitador));
            }
            catch { }

            valorXYRealizado[0, 0] = valorRealizado.ToString("0");
            valorXYRealizado[0, 1] = valorRealizado.ToString("0.00") + "%";
            valorXYRealizado[0, 2] = "Empresa";

            valorRealizado = 0;
            try
            {
                valorRealizado = (totalDigitador * 100 / (totalEmpresa + totalDigitador));
            }
            catch { }

            valorXYRealizado[1, 0] = valorRealizado.ToString("0");
            valorXYRealizado[1, 1] = valorRealizado.ToString("0.00") + "%";
            valorXYRealizado[1, 2] = "Digitador";

            phRealizado.Controls.Add(grafico.GerarGraficoPizza(valorXYRealizado));

            #endregion

            #region Total Digitador

            // Total Digitador
            Label lblTotDigitador = (Label)e.Item.FindControl("lblTotDigitador");
            qtd = 0;

            listCategoriaDigitador = new BllCategoria().ObterDigitadorEmpresasInscritasPorFiltro(objFiltroRanking);

            qtd = listCategoriaDigitador.Sum <EntCategoriaCustom>(TotalQtde => TotalQtde.CountEmpresas);

            lblTotDigitador.Text = qtd.ToString();
            int TotDigitador = qtd;
            #endregion

            #region Total Empresa

            // Total Empresa
            Label lblTotEmpresa = (Label)e.Item.FindControl("lblTotEmpresa");
            qtd = 0;

            listCategoriaAdmin = new BllCategoria().ObterAdminEmpresasInscritasPorFiltro(objFiltroRanking);

            qtd = listCategoriaAdmin.Sum <EntCategoriaCustom>(TotalQtde => TotalQtde.CountEmpresas);

            lblTotEmpresa.Text = qtd.ToString();
            int TotEmpresa = qtd;

            #endregion

            #region Total Geral

            // Total Geral
            Label lblTotalGeral = (Label)e.Item.FindControl("lblTotalGeral");
            lblTotalGeral.Text = (TotDigitador + TotEmpresa).ToString();

            #endregion
        }