public void carregarGrafico()
        {
            try {
                Func <double, string> formatFunc = (x) => string.Format("{0}", x);
                List <Grafico>        lista      = new bllAux().carregarGraficoRanking();

                cartesianChart1.Series.Clear();
                cartesianChart1.AxisX.Clear();
                cartesianChart1.AxisY.Clear();

                ChartValues <int> chartv       = new ChartValues <int>();
                IList <string>    datasLegenda = new List <string>();
                foreach (Grafico c in lista)
                {
                    chartv.Add(c.qtdeVendida);

                    datasLegenda.Add(c.tituloLivro);
                }

                var converter = new System.Windows.Media.BrushConverter();
                var brush     = (System.Windows.Media.Brush)converter.ConvertFromString("#0971AE");
                var preenche  = (System.Windows.Media.Brush)converter.ConvertFromString("#00000000");

                cartesianChart1.Series = new SeriesCollection {
                    new ColumnSeries {
                        Title = "Mais vendidos", Values = chartv, Fill = brush,
                    }
                };

                brush = (System.Windows.Media.Brush)converter.ConvertFromString("#000000");
                cartesianChart1.AxisX.Add(new Axis {
                    Title      = "Titulo dos livros",
                    Labels     = datasLegenda,
                    Foreground = brush,
                    FontFamily = new System.Windows.Media.FontFamily("Segoe UI"),
                    FontSize   = 12,
                    Separator  = new Separator {
                        Step = 2
                    }
                });

                cartesianChart1.AxisY.Add(new Axis {
                    Title          = "Quantidade vendida",
                    LabelFormatter = formatFunc,
                    Foreground     = brush,
                    FontFamily     = new System.Windows.Media.FontFamily("Segoe UI"),
                    FontSize       = 12,
                });

                cartesianChart1.LegendLocation = LegendLocation.Right;
            }
            catch (Exception erro) {
                MessageBox.Show(erro.Message, "Erro", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Пример #2
0
        private void btnFinalizarVenda_Click(object sender, EventArgs e)
        {
            if (dgvPedidos.Rows.Count == 0)
            {
                MessageBox.Show("Coloque pelo menos um item no carrinho", "Carrinho vazio", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            if (lblVendedor.Text == "")
            {
                MessageBox.Show("É necessário que um funcionário esteja logado", "Login obrigatório", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            this.idCliente = 3;

            List <Pedido> lista = new List <Pedido>();

            foreach (DataGridViewRow linha in dgvPedidos.Rows)
            {
                lista.Add(new Pedido(int.Parse(linha.Cells[0].Value.ToString()), int.Parse(linha.Cells[1].Value.ToString()), double.Parse(linha.Cells[3].Value.ToString()), this.idCliente));
            }

            foreach (Pedido p in lista)
            {
                new bllVenda().validaQtde(txtQtde.Text, int.Parse(p.idLivro.ToString()));
            }

            if (!revendo)
            {
                idPedido = new bllAux().novoPedido();
                new bllVenda().salvarPedido(lista, idPedido);
            }

            numItens = retornaNumeroDeItensCarrinho();

            frmFinalizarVenda frmFinalizar = new frmFinalizarVenda(idPedido, decimal.Parse(lblPreco.Text), numItens);
            DialogResult      resultado    = frmFinalizar.ShowDialog();

            if (resultado == DialogResult.OK && frm != null)
            {
                limpar();
                frm.atribuirnumeroDeNotificacoes();
            }
            else if (resultado == DialogResult.OK)
            {
                limpar();
            }
            else if (resultado == DialogResult.Cancel)
            {
                new bllVenda().excluirPedido(idPedido);
            }
        }
Пример #3
0
        private void carregarMensagens()
        {
            List <Contato> contatos = new bllAux().geraMensagens();

            objLista.Items.Clear();

            foreach (Contato c in contatos)
            {
                ListViewItem oItem;
                email = c.emailCliente;

                oItem = objLista.Items.Add(c.emailCliente.Replace("<", "").Replace(">", ""), c.idContato);

                oItem.Font = new Font("Arial", 16, FontStyle.Bold);
                oItem.UseItemStyleForSubItems = false;

                oItem.SubItems.Add("Mensagem: " + c.mensagemContato).Font = new Font("Corbel", 12, FontStyle.Regular);
            }

            validaTotalDeNotificacoes();
        }
        public void carregarNotificacao()
        {
            List <notificacao> notificacoes = new bllAux().geraNotificacoes();

            objImagens.Images.Clear();
            objLista.Items.Clear();

            foreach (notificacao n in notificacoes)
            {
                ListViewItem oItem;

                objImagens.Images.Add(Image.FromFile(Application.StartupPath + "\\capas\\" + n.nomeCapa));
                oItem = objLista.Items.Add(n.livroNotificacao.ToString(), validaString(n.tituloLivroNotificacao), objImagens.Images.Count - 1);

                oItem.Font = new Font("Arial", 16, FontStyle.Bold);
                oItem.UseItemStyleForSubItems = false;

                oItem.SubItems.Add("Quantidade disponível: " + n.qtdeDisponivel.ToString()).Font   = new Font("Corbel", 12, FontStyle.Regular);
                oItem.SubItems.Add("Quantidade recomendada: " + n.qtdeRecomendada.ToString()).Font = new Font("Corbel", 12, FontStyle.Regular);
            }
            validaTotalDeNotificacoes();
        }
Пример #5
0
        public void carregarGrafico(string radio)
        {
            try {
                int contLegenda = 0;

                if (rdbDiario.Checked)
                {
                    radio = "diario";
                }
                else if (rdbMensal.Checked)
                {
                    radio = "mensal";
                }
                else
                {
                    radio = "anual";
                }

                List <Grafico> lista = new bllAux().carregarGrafico(radio);

                cartesianChart1.Series.Clear();
                cartesianChart1.AxisX.Clear();
                cartesianChart1.AxisY.Clear();

                ChartValues <decimal> chartv       = new ChartValues <decimal>();
                IList <string>        datasLegenda = new List <string>();
                foreach (Grafico c in lista)
                {
                    contLegenda++;

                    chartv.Add(c.valorTotal);

                    /*if (contLegenda % 5 == 0 && contLegenda != 0)
                     *  continue;*/

                    datasLegenda.Add(c.dataVenda);
                }

                var converter = new System.Windows.Media.BrushConverter();
                var brush     = (System.Windows.Media.Brush)converter.ConvertFromString("#0971AE");
                var preenche  = (System.Windows.Media.Brush)converter.ConvertFromString("#00000000");

                cartesianChart1.Series = new SeriesCollection {
                    new LineSeries {
                        Title = "Ganhos", Values = chartv, Stroke = brush, Fill = preenche
                    }
                };

                brush = (System.Windows.Media.Brush)converter.ConvertFromString("#000000");
                cartesianChart1.AxisX.Add(new Axis {
                    Title      = "Dias",
                    Labels     = datasLegenda,
                    Foreground = brush,
                    FontFamily = new System.Windows.Media.FontFamily("Segoe UI"),
                    FontSize   = 12,
                    Separator  = new Separator {
                        Step = 2.0
                    },
                });

                cartesianChart1.AxisY.Add(new Axis {
                    Title          = "Vendas",
                    LabelFormatter = value => value.ToString("C"),
                    Foreground     = brush,
                    FontFamily     = new System.Windows.Media.FontFamily("Segoe UI"),
                    FontSize       = 12,
                });

                cartesianChart1.LegendLocation = LegendLocation.Right;

                mudarLabelEstimativa();
            } catch (MinhaException erro) {
                MessageBox.Show(erro.Message, "Erro", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }