Esempio n. 1
0
        public void UpdateSystemDLLs(string source, string tarjet)
        {
            string startup = Application.StartupPath;

            //altera o path
            //..\ITSolution\ITSolution.Admin\bin\Debug
            //..\ITE\ITE.Forms\bin\Debug\
            if (string.IsNullOrEmpty(source))
            {
                source = startup.Replace(@"\ITSolution\ITSolution.Admin", @"\ITE\ITE.Forms");
                source = source.Replace(@"\ITE\ITE.Teste", @"\ITE\ITE.Forms");
            }


            var files = FileManagerIts.ToFiles(source, new string[] { ".dll", ".pdb", ".exe" });

            //vai o foreach normal mesmo
            foreach (var f in files)
            {
                string fileName = Path.GetFileName(f);
                if (fileName.StartsWith("ITE.") || fileName.StartsWith("ITSolution."))
                {
                    //gera o caminho do arquivo
                    string newSource = Path.Combine(tarjet, fileName);
                    //copia o arquivo para o diretorio ou sobreescreve se ele existir
                    FileManagerIts.CopyFile(f, newSource);
                    Console.WriteLine(fileName);
                }
            }
        }
Esempio n. 2
0
        private void barBtnExportarTo_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            if (gridViewAnexos.IsSelectOneRowWarning())
            {
                var anexo = gridViewAnexos.GetFocusedRow <AnexoPackage>();

                string ext = anexo.Extensao;
                //Text Files (*.txt)|*.txt|
                saveFileDialog1.Filter = "ITE Solution Attach (*" + ext + ")| *" + ext;

                saveFileDialog1.FileName = anexo.FileName;
                var op = saveFileDialog1.ShowDialog();


                if (op == DialogResult.OK)
                {
                    if (FileManagerIts.WriteBytesToFile(saveFileDialog1.FileName, anexo.DataFile))
                    {
                        XMessageIts.Mensagem("Arquivo salvo com sucesso!");
                    }
                    else
                    {
                        XMessageIts.Erro("Erro na exportação do relatório!");
                    }
                }
            }
        }
Esempio n. 3
0
        public static void ExportReport(ReportImage rpt)
        {
            SaveFileDialog sfd = new SaveFileDialog();

            sfd.Filter   = ReportFilter;
            sfd.FileName = "Export_" + rpt.ReportName;
            var op = sfd.ShowDialog();

            //novo
            var novo = new ReportImage();

            //gera um novo
            novo.Update(rpt);

            //serializa p relatorio
            var bytes = SerializeIts.SerializeObject(novo);

            if (op == DialogResult.OK)
            {
                if (FileManagerIts.WriteBytesToFile(sfd.FileName, bytes))
                {
                    XMessageIts.Mensagem("Arquivo salvo com sucesso!");
                }
                else
                {
                    XMessageIts.Erro("Erro na exportação do relatório!");
                }
            }
        }
Esempio n. 4
0
        public static void ExportDashboardList(List <DashboardImage> reports)
        {
            string outReports = Path.Combine(FileManagerIts.DeskTopPath, "Dashboards ITS");

            if (!Directory.Exists(outReports))
            {
                FileManagerIts.CreateDirectory(outReports);
            }

            bool flag = false;

            foreach (var rpt in reports)
            {
                var novo = new DashboardImage();
                //gera um novo
                novo.Update(rpt);


                string file = outReports + "\\" + rpt.ReportName + ".itsdsh";

                //serializa p relatorio
                var bytes = SerializeIts.SerializeObject(novo);
                flag = FileManagerIts.WriteBytesToFile(file, bytes);
            }
            if (flag)
            {
                XMessageIts.Mensagem("Dashboards exportados com sucesso!");
            }
            else
            {
                XMessageIts.Erro("Dashboards exportados com erro!");
            }
        }
        public static void WriteOnEventViewer(string message, params string[] msg)
        {
            var    logs    = "C:\\logs\\its\\excecoes";
            string sSource = "ITSolution.Framework";

            try
            {
                if (!EventLog.SourceExists(sSource))
                {
                    EventLog.CreateEventSource(sSource, "ITE.Forms");
                }

                EventLog MyEventLog = new EventLog(); MyEventLog.Source = sSource;
                // Id do Evento
                int eventID = 3300;
                // Categoria do Evento
                short categoriaID = 16;
                // Tipo do Erro
                EventLogEntryType typeEntry = EventLogEntryType.Information;
                MyEventLog.WriteEntry(message, typeEntry, eventID,
                                      categoriaID);
            }
            catch (Exception e)
            {
                FileManagerIts.AppendTextFileException(logs + @"\\eventViewLogFail.txt", e, msg);;
            }
        }
Esempio n. 6
0
        /// <summary>
        /// Carrega um .xml em disco
        /// </summary>
        /// <param name="dash"></param>Objeto DashboardImage
        /// <returns></returns>Obtém o path do dashboard no banco
        public string LoadToChache(DashboardImage dash, bool overwrite = false)
        {
            using (var ctx = new ReportContext())
            {
                try
                {
                    //recupera o objeto do banco para alteração dos campos
                    dash = ctx.DashboardImageDao.Find(dash.IdReport);

                    //caminho do dashboard
                    string dashboardPath = generatePath(dash, ctx);


                    if (overwrite)
                    {
                        FileManagerIts.DeleteFile(dashboardPath);
                    }

                    //gera o arquivo atraves dos bytes salvos no banco e gera um arquivo em disco
                    if (!File.Exists(dashboardPath))
                    {
                        FileManagerIts.WriteBytesToFile(dashboardPath, dash.ReportImageData);
                    }

                    //caso contrario vou carregar diretamente do disco

                    return(dashboardPath);
                }
                catch (Exception)
                {
                    return(null);
                }
            }
        }
Esempio n. 7
0
        private void btnSelecionarUpdateFile_Click(object sender, EventArgs e)
        {
            var op = openFilePkg.ShowDialog();

            if (op == DialogResult.OK)
            {
                string pkgFile = openFilePkg.FileName;
                txtUpdateFile.Text = pkgFile;

                try
                {
                    var bytesFile = FileManagerIts.GetBytesFromFile(openFilePkg.FileName);
                    this._pacote = SerializeIts.DeserializeObject <Package>(bytesFile);
                    loadPackage(this._pacote);
                }
                catch (Exception ex)
                {
                    string msg = "O pacote de atualização informado é inválido!"
                                 + "\n\nContate o administrador para aplicar atualização.";

                    XMessageIts.ExceptionMessageDetails(ex, msg, "Atenção");

                    LoggerUtilIts.GenerateLogs(ex, msg);
                }
            }
        }
Esempio n. 8
0
        private static void InfoVersionDLLs()
        {
            //versao da dll
            var v = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version;

            //nome do projeto
            var n = System.Reflection.Assembly.GetExecutingAssembly().GetName().Name;

            var forms = @"D:\Program Files\TFS\ITE\ITE.Forms\bin\Debug\";

            var files      = FileManagerIts.ToFiles(forms, new string[] { ".dll" });
            var outversion = FileManagerIts.DeskTopPath + "\\out.txt";

            foreach (var f in files)
            {
                if (Path.GetFileName(f).StartsWith("ITE."))
                {
                    Console.WriteLine(f);
                    Console.WriteLine("==================================================================================");
                    var currentVersion = FileVersionInfo.GetVersionInfo(f);
                    var oldVersion     = FileVersionInfo.GetVersionInfo(f);

                    FileManagerIts.AppendLines(outversion, "File:" + f);
                    FileManagerIts.AppendLines(outversion, "File version:" + currentVersion.FileVersion);
                    FileManagerIts.AppendLines(outversion, "Product version:" + currentVersion.ProductVersion);
                }
            }
        }
Esempio n. 9
0
        public static CentroCusto GetCentroCustoVenda()
        {
            using (var ctx = new BalcaoContext())
            {
                string codigo = TypeParametro.centro_custo_venda.ToString();
                try
                {
                    Parametro param = ctx.ParametroDao.Where(
                        c => c.CodigoParametro == codigo)
                                      .First();

                    var cc = ctx.CentroCustoDao.Find(ParseUtil.ToInt(param.ValorParametro));

                    return(cc);
                }
                catch (Exception ex)
                {
                    string msg = "Falha ao localizar o centro de custo da venda";

                    FileManagerIts.AppendTextFileException(@"C:\Logs\its\excecoes\" + ex.GetType().ToString() + ".txt", ex);

                    throw new Exception(msg);
                }
            }
        }
Esempio n. 10
0
 private void XFrmApplyPackage_FormClosed(object sender, FormClosedEventArgs e)
 {
     if (Directory.Exists(_resourceDir))
     {
         FileManagerIts.DeleteDirectory(_resourceDir);
     }
 }
Esempio n. 11
0
        private bool isRotinaChecagem()
        {
            string rotinaChecagem = Path.Combine(Application.StartupPath, "r_ch_vendas_lanctos");
            var    dataAtual      = DateTime.Now.Date;

            if (File.Exists(rotinaChecagem) == false)
            {
                //cria o arquivo
                FileManagerIts.CreateFile(rotinaChecagem);
            }
            try
            {
                string checagem          = FileManagerIts.GetDataStringFile(rotinaChecagem);
                Nullable <DateTime> data = DataUtil.ToDate(checagem).Date;

                if (data == dataAtual)
                {
                    return(true);
                }
                else
                {
                    //registra a ocorrencia da rotina no dia
                    FileManagerIts.OverWriteOnFile(rotinaChecagem, dataAtual.ToShortDateString());
                }
            }
            catch (Exception)
            {
                FileManagerIts.DeleteFile(rotinaChecagem);
            }
            return(false);
        }
Esempio n. 12
0
 private void completionWizardPage1_PageValidating(object sender, DevExpress.XtraWizard.WizardPageValidatingEventArgs e)
 {
     if (chExibirArquivo.Checked)
     {
         FileManagerIts.OpenFromSystem(Path.GetDirectoryName(txtPathBackup.Text));
     }
 }
Esempio n. 13
0
        private void barBtnExportarTodos_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            if (gridView1.IsSelectOneRowWarning())
            {
                var anexos = gridView1.GetItens <AnexoLancamento>();

                var destiny = Path.Combine(FileManagerIts.DeskTopPath,
                                           "Anexos" + DateTime.Now.ToString("dd-MM-yyyy"));

                FileManagerIts.CreateDirectory(destiny);
                foreach (var anexo in anexos)
                {
                    string name = anexo.IdentificacaoAnexo.Replace("/", "-")
                                  + anexo.Extensao;
                    string fileName = Path.Combine(destiny, name);

                    if (FileManagerIts.WriteBytesToFile(fileName, anexo.DataFile))
                    {
                        XMessageIts.Mensagem("Anexo salvo com sucesso!");
                    }
                    else
                    {
                        XMessageIts.Erro("Falha ao salvar anexo!\n" + anexo.PathFile);
                    }
                }
            }
        }
Esempio n. 14
0
        private void barBtnExportarAnexo_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            if (gridView1.IsSelectOneRowWarning())
            {
                SaveFileDialog sfd = new SaveFileDialog();
                sfd.Filter = "All Files | *.*";

                var anexo = gridView1.GetFocusedRow <AnexoLancamento>();

                sfd.FileName = anexo.IdentificacaoAnexo + anexo.Extensao;
                var op = sfd.ShowDialog();

                if (op == DialogResult.OK)
                {
                    if (FileManagerIts.WriteBytesToFile(sfd.FileName, anexo.DataFile))
                    {
                        XMessageIts.Mensagem("Anexo salvo com sucesso!");
                    }
                    else
                    {
                        XMessageIts.Erro("Falha ao salvar anexo!");
                    }
                }
            }
        }
Esempio n. 15
0
        private void barBtnViewAttach_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            if (gridViewAnexos.IsSelectOneRowWarning())
            {
                var row = gridViewAnexos.GetFocusedRow <AnexoPackage>();

                if (row != null)
                {
                    //evita um nome duplicado
                    string file = FileManagerIts.GetTempFile(row.PathFile);
                    FileManagerIts.DeleteFile(file);
                    FileManagerIts.WriteBytesToFile(file, row.DataFile);

                    if (file.EndsWith(".sql"))
                    {
                        var high = new XFrmHighlighting(file, ScintillaNET.Lexer.Sql);
                        high.ShowDialog();

                        if (high.IsTextSave)
                        {
                            row.DataFile = FileManagerIts.GetBytesFromFile(file);
                        }
                    }
                    else
                    {
                        //deixe o sistema se virar
                        FileManagerIts.OpenFromSystem(file);
                    }
                }
            }
        }
Esempio n. 16
0
        public string GeneratePackageSystemDLLs()
        {
            string raiz = Application.StartupPath;
            //altera o path
            //..\ITSolution\ITSolution.Admin\bin\Debug
            //..\ITE\ITE.Forms\bin\Debug\
            string resource = raiz.Replace(@"\ITSolution\ITSolution.Admin", @"\ITE\ITE.Forms");


            var files = FileManagerIts.ToFiles(resource, new string[] { ".dll", ".pdb", ".exe" });
            var dlls  = new List <string>();

            //vai o foreach normal mesmo
            foreach (var f in files)
            {
                string fileName = Path.GetFileName(f);
                if (fileName.StartsWith("ITE.") || fileName.StartsWith("ITSolution."))
                {
                    //gera o caminho do arquivo
                    string newSource = Path.Combine(resource, fileName);
                    dlls.Add(newSource);
                }
            }
            string dllsPackage = Path.Combine(Path.GetTempPath(), "System DLLs Package " + DateTime.Now.ToString("dd-MM-yyyy") + ".zip");

            ZipUtil.CompressFileList(dlls, dllsPackage);

            return(dllsPackage);
        }
Esempio n. 17
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="flag"></param>true Permissao para criptografar
        public void SelectAppConfigFile(bool flag)
        {
            //string local = Application.StartupPath;
            //string appConfigName = "ITE.Forms.exe.config";
            //..\ITSolution\ITSolution.Admin\bin\Debug
            //..\ITE\ITE.Forms\bin\Debug\
            //local = local.Replace(@"\ITSolution\ITSolution.Admin", @"\ITE\ITE.Forms");
            //local = local.Replace(@"ITE.Teste", @"ITE.Forms");

            //string appConfig = Path.Combine(local, appConfigName);

            if (openFileAppConfig.ShowDialog() == DialogResult.OK)
            {
                string appFile = openFileAppConfig.FileName;

                if (!appFile.ToLower().EndsWith(".config"))
                {
                    XMessageIts.Advertencia("Selecione o arquivo de configuração do seu projeto App.config.");
                }
                else if (FileManagerIts.IsEmpty(appFile))
                {
                    XMessageIts.Erro("Arquivo de configuração está vazio.");
                }
                else
                {
                }
            }
        }
Esempio n. 18
0
        /// <summary>
        /// Localiza um relatorio no banco e carrega para um arquivo temporario
        /// Este cache irá ser salvo no banco
        /// </summary>
        /// <param name="reportID"></param>
        public string LoadToCache(ReportImage report)
        {
            try
            {
                using (var ctx = new ReportContext())
                {
                    //recupera o objeto do banco para alteração dos campos
                    report = ctx.ReportImageDao.Find(report.IdReport);

                    //caminho do relatorio
                    string reportPath = string.Format("{0}\\{1}", _reportDir, report.ReportName + ".repx");

                    //gera o arquivos atraves dos bytes salvo no banco
                    if (!File.Exists(reportPath))
                    {
                        FileManagerIts.WriteBytesToFile(reportPath, report.ReportImageData);
                    }

                    return(reportPath);
                }
            }
            catch (Exception)
            {
                return(null);
            }
        }
Esempio n. 19
0
        /// <summary>
        /// Seta os grupo de skin disponiveis do DevExpress
        /// Achamada deste metodo deve ser obrigatóriamente antes da inicialização de qualquer form
        /// </summary>
        private void setTheme()
        {
            // The following line provides localization for the application's user interface.
            Thread.CurrentThread.CurrentUICulture =
                new CultureInfo("pt-BR");

            // The following line provides localization for data formats.
            Thread.CurrentThread.CurrentCulture =
                new CultureInfo("pt-BR");

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            DevExpress.Skins.SkinManager.EnableMdiFormSkins();
            DevExpress.Skins.SkinManager.EnableFormSkins();
            DevExpress.UserSkins.BonusSkins.Register();
            //use o tema DEFAULT do VS
            string skin        = "Office 2010 Blue";
            var    preferences = FileManagerIts.GetDataFile(PREFERENCIAS);

            if (File.Exists(PREFERENCIAS) && preferences.Count > 0)
            {
                skin = preferences.FirstOrDefault();
            }
            DevExpress.LookAndFeel.UserLookAndFeel.Default.SkinName = skin;
        }
Esempio n. 20
0
        internal void MonitorarFilial()
        {
            if (UnitWork.Filial == null)
            {
                UnitWork.Filial = new EmpresaFilial();
                if (FormsUtil.isFormDisposedOrNull(this._xFrmSetMatFilial))
                {
                    _xFrmSetMatFilial = new XFrmSetMatrizFilial();
                }


                if (this._xFrmSetMatFilial.Visible == false)
                {
                    FileManagerIts.DeleteFile(UnitWork.PREFERENCIAS);
                    _xFrmSetMatFilial.Text = "Conexão com nova base detectada";
                    _xFrmSetMatFilial.ChangeIconBtnOk(Properties.Resources.bolocalization_16x16);

                    _xFrmSetMatFilial.ShowDialog();

                    if (!_xFrmSetMatFilial.IsFilial)
                    {
                        MessageBoxTick.Show("Seleção de matriz cancelada o programa será encerrado!",
                                            "Atenção", 5);//5 segundso
                        Application.Exit();
                    }
                }
            }
        }
Esempio n. 21
0
        /// <summary>
        /// Visualiza um relatório.
        /// <br>
        /// O relatório sempre será escrito no disco.
        /// </br>
        /// O designer é montando manualmente.
        /// </summary>
        /// <param name="report"></param>
        public static void PrintReportOverwrite(ReportImage report)
        {
            try
            {
                using (var ctx = new ReportContext())
                {
                    var    current = ctx.ReportImageDao.Find(report.IdReport);
                    string path    = Path.Combine(Application.StartupPath, "Reports", current.ReportName + ".repx");

                    FileManagerIts.WriteBytesToFile(path, current.ReportImageData);

                    //carregue a estrutura do relatório
                    XtraReport xreport = XtraReport.FromFile(path, true);

                    //objeto para gerar a tela de parametros
                    ReportPrintTool reportPrintTool = new ReportPrintTool(xreport);

                    //chama a tela de parametros
                    xreport.CreateDocument();

                    //gera o relatorio
                    PrintPreviewFormEx preview = new PrintPreviewFormEx();
                    preview.PrintingSystem = xreport.PrintingSystem;
                    //exibe o relatorio
                    preview.ShowDialog();
                }
            }
            catch (Exception ex)
            {
                XMessageIts.Erro("Falha gerar relatório\n\n" + ex.Message, "Atenção!!!");
                LoggerUtilIts.GenerateLogs(ex);
            }
        }
Esempio n. 22
0
        public static void ImportReportFromFiles(params string[] filesReports)
        {
            using (var ctx = new ReportContext())
            {
                try
                {
                    Dictionary <string, bool> importados = new Dictionary <string, bool>();

                    foreach (var file in filesReports)
                    {
                        var bytesFile        = FileManagerIts.GetBytesFromFile(file);
                        var rptDeserializado = SerializeIts.DeserializeObject <ReportImage>(bytesFile);

                        var rptCreateUpdate = ctx.ReportImageDao.Where(r =>
                                                                       r.ReportName == rptDeserializado.ReportName)
                                              .FirstOrDefault();

                        //relatorio ja existe
                        if (rptCreateUpdate != null)
                        {
                            var msg     = "O relatório selecionado já existe, deseja atualiza-lo?";
                            var confirm = XMessageIts.Confirmacao(msg);
                            if (confirm == DialogResult.Yes)
                            {
                                rptCreateUpdate.Update(rptDeserializado);

                                var traUpd = ctx.ReportImageDao.Update(rptCreateUpdate);
                                if (traUpd)
                                {
                                    XMessageIts.Mensagem("Relatório atualizado com sucesso!");
                                }
                            }
                        }
                        //relatorio nao existe, entao vai criar
                        else
                        {
                            var newReport = new ReportImage();
                            newReport.IdGrpReport       = rptDeserializado.IdGrpReport;
                            newReport.ReportDescription = rptDeserializado.ReportDescription;
                            newReport.ReportImageData   = rptDeserializado.ReportImageData;
                            newReport.ReportName        = rptDeserializado.ReportName;
                            importados.Add(newReport.ReportName, ctx.ReportImageDao.Save(newReport));
                        }
                    }
                    if (importados.Where(i => i.Value == false).Count() == 0)
                    {
                        XMessageIts.Mensagem("Relatórios importado com sucesso!");
                    }
                    else
                    {
                        XMessageIts.Advertencia("Ocorreram erros ao importar o(s) dashboard(s) !");
                    }
                }
                catch (Exception ex)
                {
                    XMessageIts.ExceptionMessageDetails(ex, "Falha ao importar o relatório");
                }
            }
        }
Esempio n. 23
0
 private void completionWizardPage1_PageValidating(object sender, DevExpress.XtraWizard.WizardPageValidatingEventArgs e)
 {
     //inicia a aplicação
     if (chExibirArquivo.Checked)
     {
         FileManagerIts.OpenFromSystem(Path.Combine(txtInstallDir.Text, "ITE.Forms.exe"));
     }
 }
Esempio n. 24
0
        private static void showResultBuilder(StringBuilder sb)
        {
            Console.WriteLine(sb);
            var file = FileManagerIts.DeskTopPath + "\\out.txt";

            FileManagerIts.DeleteFile(file);
            FileManagerIts.AppendLines(file, sb.ToString());
            FileManagerIts.OpenFromSystem(file);
        }
Esempio n. 25
0
        /// <summary>
        /// Remove os dashboard criados no disco
        /// <br>Todos .xml será apagado</br>
        /// </summary>
        /// <param name="dashboardAnt"></param>
        public void ClearCache()
        {
            var dashs = FileManagerIts.ToFiles(_dashboardDir, new string[] { "", ".xml" });

            foreach (var path in dashs)
            {
                FileManagerIts.DeleteFile(path);
            }
        }
Esempio n. 26
0
        public void ClearCache()
        {
            var reports = FileManagerIts.ToFiles(_reportDir, new string[] { "", ".repx" });

            foreach (var f in reports)
            {
                File.Delete(f);
            }
        }
Esempio n. 27
0
        public bool PublicarPacote(Package pacote)
        {
            try
            {
                using (var ctx = new AdminContext())
                {
                    var pkgCurrent = ctx.PackageDao.Find(pacote.IdPacote);
                    var pkgNew     = new Package();

                    //passa tudo do pacote atual pro novo
                    pkgNew.Update(pkgCurrent);

                    //novo status
                    pkgNew.Status = Enumeradores.TypeStatusPackage.Publicado;

                    foreach (var anx in pacote.Anexos)
                    {
                        var anxSalvar = new AnexoPackage(anx.DataFile, anx.FileName, anx.PathFile);
                        pkgNew.Anexos.Add(anxSalvar);
                    }

                    var            bytes = SerializeIts.SerializeObject(pkgNew);
                    SaveFileDialog sfd   = new SaveFileDialog();
                    sfd.Filter = "IT Solution package| *.itspkg";
                    //sfd.FilterIndex = 0;
                    //sfd.DefaultExt = ".itsPkg";
                    sfd.FileName = "ITS_Package_" + pkgNew.NumeroPacote;
                    var op = sfd.ShowDialog();

                    if (op == DialogResult.OK)
                    {
                        if (FileManagerIts.WriteBytesToFile(sfd.FileName, bytes))
                        {
                            //publicar o pacote
                            pkgCurrent.Publish(DateTime.Now, bytes);

                            var transation = ctx.PackageDao.Update(pkgCurrent);
                            if (transation)
                            {
                                XMessageIts.Mensagem("Pacote publicado com sucesso!");

                                pacote.Update(pkgCurrent);
                                return(transation);
                            }
                        }
                    }
                    return(false);
                }
            }
            catch (Exception ex)
            {
                XMessageIts.ExceptionMessage(ex, "Falha ao publicar pacote", "Publicação de Pacote");

                return(false);
            }
        }
        /// <summary>
        /// Log no arquivo de log
        /// </summary>
        /// <param name="ex"></param>
        public static void GenerateLogs(Exception ex, params string[] msg)
        {
            var logs     = "C:\\logs\\its\\excecoes";
            var fileName = logs + "\\" + ex.GetType() + "-" + DateTime.Now.ToString("dd-MM-yyyy") + ".txt";

            FileManagerIts.CreateDirectory(logs);
            File.Delete(fileName);
            FileManagerIts.AppendTextFileException(fileName, ex, msg);;
            WriteOnEventViewer(ex, msg);
        }
Esempio n. 29
0
 private void groupControlLogo_DoubleClick(object sender, EventArgs e)
 {
     if (pictureFotoProduto.Image != null)
     {
         var img  = ImageUtilIts.GetBytesFromImage(pictureFotoProduto.Image);
         var path = Path.Combine(Path.GetTempPath(), Path.GetTempFileName() + ".jpg");
         FileManagerIts.WriteBytesToFile(path, img);
         FileManagerIts.OpenFromSystem(path);
     }
 }
Esempio n. 30
0
        private void barBtnSelectDir_ItemClick(object sender, ItemClickEventArgs e)
        {
            var op = fBrowserFileCs.ShowDialog();

            if (op == DialogResult.OK)
            {
                this._fileClassList.Clear();

                var files = FileManagerIts.ToFiles(fBrowserFileCs.SelectedPath, new string[] { ".cs" });
                addFilecs(files);
                this.gridViewClasses.SelectAllRow();
            }
        }