public List<Processo> Select()
        {
            ClienteModel clienteModel = new ClienteModel();
            List<string> sqlLista = new List<string>();

            foreach (string cliente in new List<string>() { "VERBALEGISINFO" })
            {
                sqlLista.Add("SELECT *,'" + cliente + "' as cliente FROM " + cliente.Replace(" ", "") + ".dbo.PROCESSO_CADASTRO_AGENDADO " + Environment.NewLine);
            }

            string sql = String.Join(" UNION ", sqlLista);


            SqlDataReader reader = bd.select(sql);
            DataTable dt = new DataTable();
            List<Processo> lista_registros = new List<Processo>();

            while (reader.Read())
            {
                Processo processo = new Processo();
                processo.idProcesso = reader[0].ToString();
                processo.emails = reader[1].ToString();
                processo.numProcesso = reader[2].ToString();
                processo.codUnicoProcesso = reader[3].ToString();
                processo.uf = reader[4].ToString();
                processo.comarca = reader[5].ToString();
                processo.tribunal = reader[6].ToString();
                processo.dataCadastro = DateTime.Parse(reader[7].ToString());
                processo.codEscritorio = int.Parse(reader[8].ToString());
                processo.tentativas = int.Parse(reader[9].ToString());
                processo.partes = reader[10].ToString();
                //if(!reader[11].ToString().Equals(""))
                //    processo.dataUltTentativa = DateTime.Parse(reader[11].ToString());
                processo.cliente = reader[12].ToString();
                
                lista_registros.Add(processo);
            }
            return lista_registros;
        }
 public List<string> listaComboboxCliente()
 {
     ClienteModel clienteModel = new ClienteModel();
     try
     {
         return clienteModel.getClientes();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
         return new List<string>();
     }
 }
        public List<Processo> Select(string where, string valorRecorte)
        {
            ClienteModel clienteModel = new ClienteModel();
            List<string> sqlLista = new List<string>();
            List<string> clientes = new List<string>();

            if(valorRecorte != null)
            {
               clientes.Add(valorRecorte);
            }
            else
            {
                clientes.Add("NELSONWILLIANS");
            }

            try
            {
                foreach (string cliente in clientes )
                {
                    sqlLista.Add(
                            "SELECT " +
                            "  ID_PROCESSO_CADASTRO" +
                            ", CODIGO, N_PROCESSO" +
                            ", N_PROCESSO_ANTIGO" +
                            ", CODIGO_UNICO_PROCESSO" +
                            ", UF" +
                            ", COMARCA" +
                            ", DATA_CADASTRO" +
                            ", ULT_ANDAMENTO" +
                            ", ULT_ANDAMENTO_ENVIADO" +
                            ", ULT_ENVIO" +
                            ", ULT_ATUALIZACAO_PROCESSO" +
                            ", ULT_ATUALIZACAO_SISTEMA" +
                            ", EMAIL" +
                            ", ANDAMENTO_COMPLETO" +
                            ", REU" +
                            ", FORUM" +
                            ", AUTOR" +
                            ", VARA" +
                            ", TRIBUNAL" +
                            ", PARTES" +
                            ", AUTOR_ADV" +
                            ", DIGITAL" +
                            ", ENCERRADO" +
                            ", REU_ADV" +
                            ", VALOR" +
                            ", SISTEMA" +
                            ", SEGREDO" +
                            ",'" + cliente + "' as cliente " +
                            " FROM " + cliente.Replace(" ", "") + ".dbo.PROCESSO_CADASTRO " +
                              where + " ORDER BY ID_PROCESSO_CADASTRO ");
                }

                string sql = String.Join(" UNION ", sqlLista);

                SqlDataReader reader = bd.select(sql);          
                List<Processo> lista_registros = new List<Processo>();

                while (reader.Read())
                {
                    Processo processo = new Processo();
                    processo.idProcessoCadastro = int.Parse(reader[0].ToString());
                    processo.codEscritorio = int.Parse(reader[1].ToString());
                    processo.numProcesso = reader[2].ToString();
                    processo.numProcessoAntigo = reader[3].ToString();
                    processo.codUnicoProcesso = reader[4].ToString();
                    processo.uf = reader[5].ToString();
                    processo.comarca = reader[6].ToString();
                    processo.dataCadastro = DateTime.Parse(reader[7].ToString());
                    processo.ultAndamento = reader[8].ToString();
                    processo.ultAndamentoEnviado = reader[9].ToString();
                    if (!reader[10].ToString().Equals(""))
                        processo.ultEnvio = DateTime.Parse(reader[10].ToString());
                    if (!reader[11].ToString().Equals(""))
                        processo.ultAtualizacaoProcesso = DateTime.Parse(reader[11].ToString());
                    if (!reader[12].ToString().Equals(""))
                        processo.ultAtualizacaoSistema = DateTime.Parse(reader[12].ToString());
                    processo.emails = reader[13].ToString();
                    processo.andamentoCompleto = reader[14].ToString();
                    processo.reu = reader[15].ToString();
                    processo.forum = reader[16].ToString();
                    processo.autor = reader[17].ToString();
                    processo.vara = reader[18].ToString();
                    processo.tribunal = reader[19].ToString();
                    processo.partes = reader[20].ToString();
                    processo.autor_adv = reader[21].ToString();
                    if (!reader[22].ToString().Equals(""))
                        processo.digital = int.Parse(reader[22].ToString());
                    if (!reader[23].ToString().Equals(""))
                        processo.encerrado = int.Parse(reader[23].ToString());
                    processo.reu_adv = reader[24].ToString();
                    if (!reader[25].ToString().Equals(""))
                        processo.valor = reader[25].ToString();
                    processo.sistema = reader[26].ToString();
                    processo.segredo = 0;
                    if (bool.Parse(reader[27].ToString()))
                        processo.segredo = 1;
                    processo.cliente = reader[28].ToString();

                    lista_registros.Add(processo);
                }
                return lista_registros;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                return new List<Processo>();
            }
        }