Пример #1
0
        public void Listar()
        {
            Company emp = new Company();

            for (int cont = 0; cont < 10; cont++)
            {
                emp.Nome         = "Empresa" + cont;
                emp.NomeFantasia = "Fantasia" + cont;
                emp.Email        = "email" + cont + "@mail.com";
                emp.TipoServico  = "Alimento";
                emp.Senha        = "senha" + cont;
                emp.Rua          = "rua" + cont;
                emp.Bairro       = "bairro" + cont;
                emp.Cnpj         = long.Parse("" + cont + "" + cont + "" + cont + "" + cont + "" + cont);
                emp.Numero       = int.Parse("" + cont + "" + cont);
                emp.Cep          = int.Parse("" + cont + "" + cont + "" + cont + "" + cont + "" + cont + "" + cont);
                comp.CompAdd(emp);
            }
            int count = 0;

            foreach (var item in comp.selectAll())
            {
                ProfileCompany profComp = new ProfileCompany();
                profComp.Especialidade = "Especialidade" + count;
                profComp.Contato       = "Contato" + count;
                profComp.HoraInicio    = DateTime.Now;
                profComp.HoraFim       = DateTime.Now;
                profComp.Telefone      = int.Parse("" + count + "" + count + "" + count + "" + count + "" + count);
                profComp.Cep           = emp.Cep;
                profComp.Cel           = int.Parse("" + count + "" + count + "" + count + "" + count + "" + count);
                profComp.CodigoCompany = comp.selectAll().IndexOf(item);
                prof.ProfileAdd(profComp);
                count++;

                prof.AddAvaliacao(count, profComp.CodigoCompany, count);
                prof.AddAvaliacao(10, profComp.CodigoCompany, count);
                prof.ApuraAvaliacao(profComp.CodigoCompany);
            }
            foreach (var teste in prof.TopList(prof.selectAll()))
            {
                foreach (var teste2 in comp.selectAll())
                {
                    if (teste.CodigoCompany == comp.selectAll().IndexOf(teste2))
                    {
                        UserControl1 te = new UserControl1(teste2.NomeFantasia);
                        te.Location = new Point(0, local1);
                        local1      = local1 + te.Height + 5;
                        Top5.Controls.Add(te);
                    }
                }
            }

            /*foreach (var ava in prof.selectEvaluation())
             * {
             *  foreach (var itemEmp in comp.selectAll()) {
             *      if (ava.IndexEmp == comp.selectAll().IndexOf(itemEmp)) {
             *          UserControl1 te = new UserControl1(ava.Nota);
             *          te.Location = new Point(0, local1);
             *          local1 = local1 + te.Height + 5;
             *          Top5.Controls.Add(te);
             *      }
             *  }
             * }*/

            lista = comp.selectAll();
            foreach (var item in lista)
            {
                ExibirEmpresa exbEmp = new ExibirEmpresa(item.Nome, lista.IndexOf(item));
                exbEmp.Location = new Point(0, local);
                local           = local + exbEmp.Height + 5;
                Restaurantes.Controls.Add(exbEmp);
            }
        }