Пример #1
0
        public void Show(ObservableCollection <mPF_Ext> lista_pessoas)
        {
            try
            {
                List <string> _sexo    = new List <string>();
                List <string> _setor   = new List <string>();
                List <string> _perfil  = new List <string>();
                List <string> _negocio = new List <string>();

                foreach (mPF_Ext at in lista_pessoas)
                {
                    switch (at.Sexo)
                    {
                    case 1:
                        _sexo.Add("FEMININO");
                        break;

                    case 2:
                        _sexo.Add("MASCULINO");
                        break;
                    }

                    _setor.Add(at.Bairro);

                    _perfil.Add(at.Perfil.PerfilString);

                    if (at.Perfil.Perfil == 1)
                    {
                        if (at.Perfil.Negocio.ToString() == "True")
                        {
                            _negocio.Add("COM NEGÓCIO");
                        }
                        else
                        {
                            _negocio.Add("SEM NEGÓCIO");
                        }
                    }
                }

                var c_sexo = from x in _sexo
                             group x by x into g
                             let count = g.Count()
                                         orderby count descending
                                         select new { Value = g.Key, Count = count };

                foreach (var x in c_sexo)
                {
                    Sexo.Add(new KeyValuePair <string, int>(x.Value, x.Count));
                }

                var c_setor = from x in _setor
                              group x by x into g
                              let count = g.Count()
                                          orderby count descending
                                          select new { Value = g.Key, Count = count };

                foreach (var x in c_setor)
                {
                    Setor.Add(new KeyValuePair <string, int>(x.Value, x.Count));
                }

                var c_negocio = from x in _negocio
                                group x by x into g
                                let count = g.Count()
                                            orderby count descending
                                            select new { Value = g.Key, Count = count };

                foreach (var x in c_negocio)
                {
                    Negocio.Add(new KeyValuePair <string, int>(x.Value, x.Count));
                }

                var c_perfil = from x in _perfil
                               group x by x into g
                               let count = g.Count()
                                           orderby count descending
                                           select new { Value = g.Key, Count = count };

                foreach (var x in c_perfil)
                {
                    Perfil.Add(new KeyValuePair <string, int>(x.Value, x.Count));
                }
            }
            catch { }
        }
Пример #2
0
        public void Show(ObservableCollection <mPJ_Ext> lista_empresas, List <object> commands)
        {
            try
            {
                List <string> _periodo   = new List <string>();
                List <string> _atividade = new List <string>();
                List <string> _setor     = new List <string>();
                List <string> _porte     = new List <string>();
                List <string> _usolocal  = new List <string>();

                foreach (mPJ_Ext at in lista_empresas)
                {
                    _atividade.Add(at.AtividadePrincipal.ToUpper().TrimEnd());

                    if (at.Segmentos.Agronegocio == true)
                    {
                        _setor.Add("AGRONEGOCIO");
                    }

                    if (at.Segmentos.Comercio == true)
                    {
                        _setor.Add("COMERCIO");
                    }

                    if (at.Segmentos.Industria == true)
                    {
                        _setor.Add("INDUSTRIA");
                    }

                    if (at.Segmentos.Servicos == true)
                    {
                        _setor.Add("SERVICOS");
                    }

                    if (at.Formalizada.Porte == 1)
                    {
                        _porte.Add("MEI");
                    }

                    if (at.Formalizada.Porte == 2)
                    {
                        _porte.Add("EIRELI");
                    }

                    if (at.Formalizada.Porte == 3)
                    {
                        _porte.Add("ME");
                    }

                    if (at.Formalizada.Porte == 4)
                    {
                        _porte.Add("EPP");
                    }

                    if (at.Formalizada.Porte == 5)
                    {
                        _porte.Add("OUTROS");
                    }

                    if (at.Formalizada.UsoLocal == 1)
                    {
                        _usolocal.Add("ESTABELECIMENTO");
                    }

                    if (at.Formalizada.UsoLocal == 2)
                    {
                        _usolocal.Add("SOMENTE PARA CORRESPONDENCIA");
                    }
                }


                var c_atividade = from x in _atividade
                                  group x by x into g
                                  let count = g.Count()
                                              orderby count descending
                                              select new { Value = g.Key, Count = count };

                foreach (var x in c_atividade)
                {
                    Atividade.Add(new KeyValuePair <string, int>(x.Value, x.Count));
                }

                var c_setor = from x in _setor
                              group x by x into g
                              let count = g.Count()
                                          orderby count descending
                                          select new { Value = g.Key, Count = count };

                foreach (var x in c_setor)
                {
                    Setor.Add(new KeyValuePair <string, int>(x.Value, x.Count));
                }

                var c_usolocal = from x in _usolocal
                                 group x by x into g
                                 let count = g.Count()
                                             orderby count descending
                                             select new { Value = g.Key, Count = count };

                foreach (var x in c_usolocal)
                {
                    UsoLocal.Add(new KeyValuePair <string, int>(x.Value, x.Count));
                }

                var c_porte = from x in _porte
                              group x by x into g
                              let count = g.Count()
                                          orderby count descending
                                          select new { Value = g.Key, Count = count };

                foreach (var x in c_porte)
                {
                    Porte.Add(new KeyValuePair <string, int>(x.Value, x.Count));
                }
            }
            catch { }
        }