Exemplo n.º 1
0
        public Login()
        {
            InitializeComponent();
            try
            {
                ArquivoBD.CriarArquivosCronometroBD();
            }
            catch (Exception e)
            {
                MessageBox.Show("Ocorreu um erro ao definir as propriedades dos arquivos da aplicação. Contacte o administrador. Erro: " + e.Message);
            }
            Dictionary <int, string> dictionaryUsuarios = new Dictionary <int, string>();

            dictionaryUsuarios.Add(1, "ADMIN");
            dictionaryUsuarios.Add(2, "HOUSEMIX");
            ddlUsuarios.DataSource    = new BindingSource(dictionaryUsuarios, null);
            ddlUsuarios.DisplayMember = "Value";
            ddlUsuarios.ValueMember   = "Key";
            ddlUsuarios.SelectedIndex = -1;
            //panelBanner.BackgroundImage = Image.FromFile("d:\\teste.jpg");
            //Evento evento = new EventoDAO().VerificaExistenciaEvento();
            //if (evento != null) // Se for edição
            //{
            //    panelBanner.BackgroundImage = new Bitmap(evento.PathFile);
            //}
            //if (System.IO.File.Exists(Evento.DIRETORIO_INSTALACAO_BANNER(string.Empty)))
            //{
            //    //pictureBox1.Image = Resize(new Bitmap(evento.PathFile), pictureBox1.Width, pictureBox1.Height);
            //    panelBanner.BackgroundImage = Helper.Resize(new Bitmap(Evento.DIRETORIO_INSTALACAO_BANNER(string.Empty)), panelBanner.Width, panelBanner.Height);
            //}
        }
Exemplo n.º 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);
            }
        }
Exemplo n.º 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();
            }
        }
Exemplo n.º 4
0
 public Login()
 {
     InitializeComponent();
     try
     {
         ArquivoBD.CriarArquivosBD();
     }
     catch (Exception e)
     {
         MessageBox.Show("Ocorreu um erro ao definir as propriedades dos arquivos da aplicação. Contacte o administrador. Erro: " + e.Message);
     }
     tbxLogin.Focus();
     //panelBanner.BackgroundImage = Image.FromFile("d:\\teste.jpg");
     //Evento evento = new EventoDAO().VerificaExistenciaEvento();
     //if (evento != null) // Se for edição
     //{
     //    panelBanner.BackgroundImage = new Bitmap(evento.PathFile);
     //}
     if (System.IO.File.Exists(Evento.DIRETORIO_INSTALACAO_BANNER(string.Empty)))
     {
         //pictureBox1.Image = Resize(new Bitmap(evento.PathFile), pictureBox1.Width, pictureBox1.Height);
         panelBanner.BackgroundImage = Helper.Resize(new Bitmap(Evento.DIRETORIO_INSTALACAO_BANNER(string.Empty)), panelBanner.Width, panelBanner.Height);
     }
 }