Example #1
0
        public List <Palestrante> ListarPalestrantesEvento(string pathDB)
        {
            List <Palestrante> palestrantes = new List <Palestrante>();
            //Sala usuario = null;
            DataTable resultado = new DataTable();

            using (OleDbConnection oConn = new OleDbConnection(ConexaoSingle.conexaoRemota(pathDB)))
            {
                oConn.Open();

                using (OleDbCommand cmd = new OleDbCommand(" SELECT DISTINCT ID_PALESTR FROM SALA_PAL.DBF"))
                {
                    cmd.Connection = oConn;
                    OleDbDataAdapter DA = new OleDbDataAdapter(cmd);

                    DA.Fill(resultado);
                    if (resultado.Rows.Count > 0)
                    {
                        for (int i = 0; i < resultado.Rows.Count; i++)
                        {
                            Palestrante palestrante = new PalestranteDAO().BuscarPorCodigo(int.Parse(resultado.Rows[i]["ID_PALESTR"].ToString()), pathDB);
                            palestrantes.Add(palestrante);
                        }
                    }
                }
            }
            return(palestrantes.OrderBy(P => P.Nome).ToList());
        }
Example #2
0
        public void CriarDiretorios(string path, int pPalestrante, int pSala, DateTime Data, string pHora, string pTema, string pPathServer)
        {
            try
            {
                System.IO.DirectoryInfo infoDiretorio = null;
                Sala sala = new SalaDAO().BuscarPorCodigo(pSala, pPathServer);
                if (sala != null)
                {
                    if (!System.IO.Directory.Exists(path + @"\" + sala.Nome))                         //Se não existe a pasta da sala para a data
                    {
                        infoDiretorio = System.IO.Directory.CreateDirectory(path + @"\" + sala.Nome); //Cria
                    }
                }


                if (!System.IO.Directory.Exists(path + @"\" + sala.Nome + @"\" + ArquivoBD.FORMATARDATA_DIRETORIO(Data)))                         //Se não existe a pasta da data
                {
                    infoDiretorio = System.IO.Directory.CreateDirectory(path + @"\" + sala.Nome + @"\" + ArquivoBD.FORMATARDATA_DIRETORIO(Data)); //Cria
                }
                Palestrante palestrante = new PalestranteDAO().BuscarPorCodigo(pPalestrante, pPathServer);
                if (palestrante != null)
                {
                    //Verifico se já existe a pasta para o horário
                    if (!System.IO.Directory.Exists(path + @"\" + sala.Nome + @"\" + ArquivoBD.FORMATARDATA_DIRETORIO(Data) + @"\" + pHora.Replace(":", "-") + @" - " + palestrante.NomeSobreNome()))                         //Se não existe a pasta do horário para a sala e para a data
                    {
                        infoDiretorio = System.IO.Directory.CreateDirectory(path + @"\" + sala.Nome + @"\" + ArquivoBD.FORMATARDATA_DIRETORIO(Data) + @"\" + pHora.Replace(":", "-") + @" - " + palestrante.NomeSobreNome()); //Cria
                    }
                }
            }
            catch (Exception e)
            {
                throw new Exception("Ocorreu um erro ao criar as pastas no diretório de instalação " + path + ": " + e.Message);
            }
        }
Example #3
0
        public void CriarPastasRemoto(string pPath, DateTime pData, int pSala, int pPalestrante, string pHora, string pDestinoArquivo, System.IO.FileStream pArquivo, string pNomeArquivo)
        {
            string pathFinal = string.Empty;

            Sala sala = new SalaDAO().BuscarPorCodigo(pSala, pPath);

            if (sala != null)
            {
                if (!System.IO.Directory.Exists(pDestinoArquivo + @"\" + sala.Nome))         //Se não existe a pasta da sala para a data
                {
                    System.IO.Directory.CreateDirectory(pDestinoArquivo + @"\" + sala.Nome); //Cria
                }
            }

            //System.IO.Directory.CreateDirectory(pDestinoArquivo + @"\"  + @"\" + sala.Nome + ArquivoBD.FORMATARDATA_DIRETORIO(pData));//Cria

            if (!System.IO.Directory.Exists(pDestinoArquivo + @"\" + sala.Nome + @"\" + ArquivoBD.FORMATARDATA_DIRETORIO(pData)))         //Se não existe a pasta da data
            {
                System.IO.Directory.CreateDirectory(pDestinoArquivo + @"\" + sala.Nome + @"\" + ArquivoBD.FORMATARDATA_DIRETORIO(pData)); //Cria
            }
            Palestrante palestrante = new PalestranteDAO().BuscarPorCodigo(pPalestrante, pPath);

            if (palestrante != null)
            {
                //Verifico se já existe a pasta para o horário
                if (!System.IO.Directory.Exists(pDestinoArquivo + @"\" + @"\" + sala.Nome + @"\" + ArquivoBD.FORMATARDATA_DIRETORIO(pData) + @"\" + pHora.Replace(":", "-") + @" - " + palestrante.NomeSobreNome()))                       //Se não existe a pasta do horário para a sala e para a data
                {
                    pathFinal = System.IO.Directory.CreateDirectory(pDestinoArquivo + @"\" + sala.Nome + @"\" + ArquivoBD.FORMATARDATA_DIRETORIO(pData) + @"\" + pHora.Replace(":", "-") + @" - " + palestrante.NomeSobreNome()).FullName; //Cria
                }
                else
                {
                    pathFinal = pDestinoArquivo + @"\" + @"\" + sala.Nome + @"\" + ArquivoBD.FORMATARDATA_DIRETORIO(pData) + @"\" + pHora.Replace(":", "-") + @" - " + palestrante.NomeSobreNome(); //Cria
                }
            }


            if (!String.IsNullOrEmpty(pNomeArquivo))
            {
                System.IO.FileStream arquivoSaida = System.IO.File.Create(pathFinal + @"\ " + pNomeArquivo);
                int b;

                while ((b = pArquivo.ReadByte()) > -1)
                {
                    arquivoSaida.WriteByte((byte)b);
                }

                arquivoSaida.Flush();
                arquivoSaida.Close();
                pArquivo.Close();
            }
        }