コード例 #1
0
        public void TestMethod1()
        {
            ExcelTool.ExcelCreator Excel = new ExcelCreator();


            Excel.CreateExcelFile();
        }
コード例 #2
0
        public ActionResult View(string dateBegin, string dateEnd, string employeeFilter, string command)
        {
            if (!ModelState.IsValid)
            {
                return(RedirectToAction("View"));
            }

            if (!string.IsNullOrEmpty(dateBegin) && !string.IsNullOrEmpty(dateEnd))
            {
                _erService.DateBegin = Convert.ToDateTime(dateBegin);
                _erService.DateEnd   = Convert.ToDateTime(dateEnd).AddDays(1);
            }

            _erService.EmployeeFilter = employeeFilter;

            EmployeeReportViewModel model;

            if (command == "Загрузить Excel")
            {
                var excelCreator = new ExcelCreator();
                model = _erService.GetData();
                var fullPath = excelCreator.CreateFile(model);
                return(File(new FileStream(fullPath, FileMode.Open), "application/vnd.ms-excel", "Отчёт по сотрудникам.xlsx"));
            }

            model = _erService.GetData();
            return(View(model));
        }
コード例 #3
0
ファイル: Program.cs プロジェクト: radtek/Gradual
        static void Main(string[] args)
        {
            log4net.Config.XmlConfigurator.Configure();

            intra.gradual.financial.ValidateLogin validateLogin = new intra.gradual.financial.ValidateLogin();

            validateLogin.Username = "******";
            validateLogin.Password = "******";

            intra.gradual.financial.PosicaoCotistaWS ws = new intra.gradual.financial.PosicaoCotistaWS();

            ws.ValidateLoginValue = validateLogin;

            intra.gradual.financial.PosicaoCotistaViewModel[] vm = ws.Exporta(null, null, null);

            //MessageBox.Show("Recebeu " + vm.Length + " registros");

            int len = vm.Length;

            DataSet dataSet = new DataSet();
            //DataTableReader xreader = dataSet.CreateDataReader();

            DataTable tabela = parseToDataTable <intra.gradual.financial.PosicaoCotistaViewModel>(vm);

            dataSet.Tables.Add(tabela);

            if (ExcelCreator.CreateExcel(dataSet, @"c:\temp\fundos.xlsx", "Fundos"))
            {
            }
        }
コード例 #4
0
        public ActionResult Excel(string json)
        {
            List <ExcelTemplate> data = JsonConvert.DeserializeObject <List <ExcelTemplate> >(json);
            DataSet      dataSet      = Util.ToDataSet(data);
            ExcelCreator excelCreator = new ExcelCreator();

            return(File(excelCreator.Create(dataSet), "application/vnd.ms-excel", "kartexport.xls"));
        }
コード例 #5
0
        private void button1_Click(object sender, EventArgs e)
        {
            PlateCalculator calc = new PlateCalculator(order);

            calc.CalculateBoards();
            ExcelCreator excel = new ExcelCreator(calc.Plates, @"C:\Users\casp4\Documents");

            excel.CreateExcel();
        }
コード例 #6
0
ファイル: ExportController.cs プロジェクト: moxuanzhu/Hajk
        public string Excel([System.Web.Http.FromBody] UploadData uploadData)
        {
            List <ExcelTemplate> data = JsonConvert.DeserializeObject <List <ExcelTemplate> >(uploadData.data);
            DataSet      dataSet      = Util.ToDataSet(data);
            ExcelCreator excelCreator = new ExcelCreator();

            byte[]   bytes    = excelCreator.Create(dataSet);
            string[] fileInfo = byteArrayToFileInfo(bytes, "xls");
            return(Request.Url.GetLeftPart(UriPartial.Authority) + "/Temp/" + fileInfo[1]);
        }
コード例 #7
0
ファイル: ExcelServices.cs プロジェクト: salem84/GeCo
        public void EsportaExcel(string filepath, string nomeRuolo, List <ConfrontoConoscenzaCompetenza> confronti)
        {
            ExcelCreator excel = new ExcelCreator();

            excel.NomeRuolo       = nomeRuolo;
            excel.Dati            = confronti;
            excel.PunteggiMassimi = new ParametriConfronto();

            excel.CreaExcel(filepath);
        }
コード例 #8
0
        public async Task <byte[]> AddToExcelVacancy(int skip, int amount,
                                                     VacancySearchModel searchModel, VacancySortModel sortModel)
        {
            var vacancies = await vacancyService.Search(skip, amount, searchModel, sortModel);

            var excelVacancyList = vacancies.Select(ConvertToExcelModel).ToList();

            var result = ExcelCreator.GenerateExcel(excelVacancyList);

            return(result);
        }
コード例 #9
0
        public async Task <byte[]> AddToExcelCandidate(int skip, int amount,
                                                       CandidateSearchModel searchOptions, CandidateSortModel sortModel)
        {
            var candidates = await candidateService.Find(skip, amount, searchOptions, sortModel);

            var excelCandidateList = candidates.Select(ConvertToExcelModel).ToList();

            var result = ExcelCreator.GenerateExcel(excelCandidateList);

            return(result);
        }
コード例 #10
0
ファイル: Tests.cs プロジェクト: MathiasRossen/DesignMobler
        public void ExcelThing()
        {
            order.AddBoard(new Board(1000, br));
            order.AddBoard(new Board(1100, br));
            order.AddBoard(new Board(1200, br));
            order.AddBoard(new Board(1300, br));
            order.AddBoard(new Board(1400, br));
            pc.CalculateBoards();

            ExcelCreator ec = new ExcelCreator(pc.Plates, @"C:\Users\Mathias\Documents\PathToExcel");
            //ec.CreateExcel();
        }
コード例 #11
0
        public ActionResult ExportToExcel()
        {
            // Read session for filterstring .To get same table result on index when export is clicked.
            var filterStr = HttpContext.Session.GetString("FilterStr");

            var stream = ExcelCreator.CreateExcelFileStream(_service.GetProductsByFilter(filterStr).Result.Select(p => new { p.Code, p.Name, p.Price }));

            var responseStream = new FileStreamResult(stream, "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet")
            {
                FileDownloadName = $"Export.xlsx"
            };

            return(responseStream);
        }
コード例 #12
0
ファイル: FirController.cs プロジェクト: sweco-se/hajk-fork
        private string GenExcel(string name, List <ExcelTemplate> xls)
        {
            try
            {
                System.Data.DataSet dataSet      = Util.ToDataSet(xls);
                ExcelCreator        excelCreator = new ExcelCreator();
                byte[]   bytes    = excelCreator.Create(dataSet);
                string[] fileInfo = byteArrayToFileInfo(name, bytes, "xls");

                return(Request.Url.GetLeftPart(UriPartial.Authority) + "/Temp/" + fileInfo[1]);
            }
            catch (Exception e)
            {
                _log.FatalFormat("Can't generate excel file: {0}", e);
                throw e;
            }
        }
コード例 #13
0
        private void toolStripButton2_Click(object sender, EventArgs e)
        {
            if (dataGridView1.DataSource != null)
            {
                ExcelCreator excel = new ExcelCreator((DataTable)dataGridView1.DataSource);

                saveFileDialog1.Filter = "xls files (*.xls)|*.xls";
                if (saveFileDialog1.ShowDialog() == DialogResult.OK)
                {
                    excel.Save(saveFileDialog1.FileName);
                }
            }
            else
            {
                MessageBox.Show("List is empty!");
            }
        }
コード例 #14
0
        static void Main(string[] args)
        {
            var ps = new ParserService(db);

            //string dir = string.Format(@"C:\temp\images");
            //DirectoryInfo di = new DirectoryInfo(dir);
            //di.GetFiles().ToList().ForEach(file =>
            //{
            //    var image = ps.resizeImage(40, 40, file.FullName);
            //    image.Save(file.FullName);
            //});

            //return;
            int orderId = 1;// ps.ParseCategories();

            ExcelCreator excelCreator = new ExcelCreator(db, orderId);

            excelCreator.Generate();
        }
コード例 #15
0
ファイル: ExportController.cs プロジェクト: sbk-gbg/GOkart
        public string Excel(string json)
        {
            _log.DebugFormat("Received json: {0}", json);
            // try to decode input string to see if it is base64 encoded
            try
            {
                byte[] decoded = Convert.FromBase64String(json);
                json = System.Text.Encoding.UTF8.GetString(decoded);
                _log.DebugFormat("json after decode: {0}", json);
            }
            catch (Exception e)
            {
                _log.DebugFormat("Could not decode base64. Will treat as non-base64 encoded: {0}", e.Message);
            }
            List <ExcelTemplate> data = JsonConvert.DeserializeObject <List <ExcelTemplate> >(json);
            DataSet      dataSet      = Util.ToDataSet(data);
            ExcelCreator excelCreator = new ExcelCreator();

            byte[]   bytes    = excelCreator.Create(dataSet);
            string[] fileInfo = byteArrayToFileInfo(bytes, "xls");

            return(Request.Url.GetLeftPart(UriPartial.Authority) + "/Temp/" + fileInfo[1]);
        }
コード例 #16
0
        /// <summary>
        /// Gera o relatorio de usuarios logados no HB e saldo
        /// quebrou o esquema, pq tem que buscar a relacao de contas x assessor do oracle pra cruzar com
        /// a consulta do MSSQL
        /// </summary>
        /// <param name="functionName"></param>
        public void GenerateLogadosHBSaldo(string functionName)
        {
            try
            {
                logger.Info("GenerateLogadosHBSaldo(" + functionName + ")");

                if (!dctParametros.ContainsKey(functionName))
                {
                    logger.Error("GenerateLogadosHBSaldo(" + functionName + ") nao ha parametros definidos");
                    return;
                }

                BaseParam parametros = dctParametros[functionName];

                string scriptPath = ConfigurationManager.AppSettings["DiretorioScripts"].ToString();
                string sheetPath  = ConfigurationManager.AppSettings["DiretorioPlanilhas"].ToString();
                string rede       = "";

                if (ConfigurationManager.AppSettings["DiretorioRede"] != null)
                {
                    rede = ConfigurationManager.AppSettings["DiretorioRede"].ToString();
                }

                string scriptFilename   = scriptPath + Path.DirectorySeparatorChar + parametros.ScriptFile;
                string scriptAssessores = scriptPath + Path.DirectorySeparatorChar + "getassess.sql";
                string excelFile        = sheetPath + Path.DirectorySeparatorChar + parametros.ExcelFilePrefix + "-" + DateTime.Now.ToString("yyyMMdd-HHmmss") + ".xlsx";

                logger.Info("GenerateLogadosHBSaldo(" + functionName + ") Carregando script: " + scriptFilename);


                PersistenciaDB db = new PersistenciaDB();

                string idlogins = "select distinct(IdLogin) from tb_logacesso where Sistema='Portal' and DataLogIn > DATEADD(dd, 0, DATEDIFF(dd, 0, GETDATE()))";

                DataSet dsLogins = db.ExecutarScriptSqlServer("ControleAcesso", idlogins);

                string idClientes = "select C.cd_codigo,L.id_login  from tb_cliente_conta C, tb_cliente L where C.cd_sistema = 'BOL' and L.id_cliente = C.id_cliente";

                DataSet dsClientes = db.ExecutarScriptSqlServer("Cadastro", idClientes);


                string scriptAssessor = File.ReadAllText(scriptAssessores);

                logger.Info("GenerateLogadosHBSaldo(" + functionName + ") obtendo tabela assessores");

                DataSet dsAss = db.ExecutarScriptRetDS(scriptAssessor);

                logger.Info("GenerateLogadosHBSaldo(" + functionName + ") executando script");

                string scriptSQL = File.ReadAllText(scriptFilename);

                DataSet ds = db.ExecutarScriptSqlServer(parametros.ConnStringName, scriptSQL);

                if (ds.Tables.Count == 0 || (ds.Tables.Count > 0 && ds.Tables[0].Rows.Count == 0))
                {
                    logger.Error("GenerateLogadosHBSaldo(" + functionName + ") Nao ha registros para se gerar uma planilha");
                    return;
                }

                var query = from record in ds.Tables[0].AsEnumerable()
                            join assessor in dsAss.Tables[0].AsEnumerable()
                            on record.Field <string>("Cliente") equals assessor.Field <string>("Cliente")
                            select new
                {
                    Cliente         = record.Field <string>("Cliente").Trim(),
                    Nome            = assessor.Field <string>("Nome").Trim(),
                    CpfCnpj         = assessor.Field <string>("CPF/CNPJ").Trim(),
                    Assessor        = assessor.Field <string>("Assessor").Trim(),
                    NomeAssessor    = assessor.Field <string>("Nome Assessor").Trim(),
                    Titulo          = record.Field <string>("Titulo").Trim(),
                    Aplicacao       = record.Field <string>("Aplicacao").Trim(),
                    Vencimento      = record.Field <string>("Vencimento").Trim(),
                    Taxa            = record.Field <string>("Taxa").Trim(),
                    Quantidade      = record.Field <string>("Quantidade").Trim(),
                    Indice          = record.Field <string>("Indice").Trim(),
                    ValorOriginal   = record.Field <string>("ValorOriginal").Trim(),
                    IRRF            = record.Field <string>("IRRF").Trim(),
                    IOF             = record.Field <string>("IOF").Trim(),
                    SaldoLiquido    = record.Field <string>("SaldoLiquido").Trim(),
                    DataAtualizacao = record.Field <string>("DataAtualizacao").Trim(),
                };

                DataSet ds1 = new DataSet();

                ds1.Tables.Add(query.ToDataTable());

                logger.Info("GenerateVctosRendaFixa(" + functionName + ") dataset carregado, gerando planilha");

                if (ExcelCreator.CreateExcel(ds1, excelFile, parametros.WorksheetName))
                {
                    logger.Info("GenerateVctosRendaFixa(" + functionName + ") planilha gerada com sucesso");


                    string subject = parametros.Subject + " - " + DateTime.Now.ToString("dd/MM/yyyy HH:mm:ss");

                    string message = "Planilha " + functionName + " gerada as " + DateTime.Now.ToString("dd/MM/yyyy HH:mm:ss");
                    message += "\n\n";
                    message += "Gravado em [" + excelFile + "]";

                    if (!String.IsNullOrEmpty(rede))
                    {
                        message += "\n\n";

                        message += "Disponivel na pasta de rede: [" + rede + "]";
                    }


                    if (!String.IsNullOrEmpty(parametros.Message))
                    {
                        message += "\n\n" + parametros.Message;
                    }

                    message += "\n\n";

                    string[] anexos = new string[1];
                    anexos[0] = excelFile;

                    MailUtil.EnviarPlanilhaPorEmail(parametros.MailFrom,
                                                    parametros.MailTo,
                                                    null,
                                                    null,
                                                    subject,
                                                    message,
                                                    anexos);
                }

                try
                {
                    if (!String.IsNullOrEmpty(rede))
                    {
                        FileInfo excelInfo = new FileInfo(excelFile);
                        rede += Path.DirectorySeparatorChar;
                        rede += excelInfo.Name;

                        logger.Info("GenerateVctosRendaFixa(" + functionName + ") Copiando arquivo [" + excelFile + "] para [" + rede + "]");
                        File.Copy(excelFile, rede);
                    }
                    else
                    {
                        logger.Info("GenerateVctosRendaFixa(" + functionName + ") Chave appsettings 'DiretorioRede' nao existe para copia do arquivo!");
                    }
                }
                catch (Exception ex)
                {
                    logger.Error("GenerateVctosRendaFixa(" + functionName + "): Erro ao copiar para pasta de rede");
                    logger.Error("GenerateVctosRendaFixa(" + functionName + "): " + ex.Message, ex);
                }
            }
            catch (Exception ex)
            {
                logger.Error("GenerateVctosRendaFixa(" + functionName + "): " + ex.Message, ex);
            }
        }
コード例 #17
0
 public void SetUp()
 {
     _excelCreator = new ExcelCreator();
 }
コード例 #18
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="functionName"></param>
        public void GerarBase(string functionName)
        {
            try
            {
                logger.Info("GerarBase(" + functionName + ")");

                if (!dctParametros.ContainsKey(functionName))
                {
                    logger.Error("GerarBase(" + functionName + ") nao ha parametros definidos");
                    return;
                }

                BaseParam parametros = dctParametros[functionName];

                string scriptPath = ConfigurationManager.AppSettings["DiretorioScripts"].ToString();
                string sheetPath  = ConfigurationManager.AppSettings["DiretorioPlanilhas"].ToString();
                string rede       = "";

                if (ConfigurationManager.AppSettings["DiretorioRede"] != null)
                {
                    rede = ConfigurationManager.AppSettings["DiretorioRede"].ToString();
                }

                string scriptFilename = scriptPath + Path.DirectorySeparatorChar + parametros.ScriptFile;
                string excelFile      = sheetPath + Path.DirectorySeparatorChar + parametros.ExcelFilePrefix + "-" + DateTime.Now.ToString("yyyMMdd-HHmmss") + ".xlsx";

                logger.Info("GerarBase(" + functionName + ") Carregando script: " + scriptFilename);

                string scriptSQL = File.ReadAllText(scriptFilename);

                PersistenciaDB db = new PersistenciaDB();

                logger.Info("GerarBase(" + functionName + ") executando script");

                DataSet ds = db.ExecutarScriptRetDS(scriptSQL);

                if (ds.Tables.Count == 0 || (ds.Tables.Count > 0 && ds.Tables[0].Rows.Count == 0))
                {
                    logger.Error("GerarBase(" + functionName + ") Nao ha registros para se gerar uma planilha");
                    return;
                }

                logger.Info("GerarBase(" + functionName + ") dataset carregado, gerando planilha");

                if (ExcelCreator.CreateExcel(ds, excelFile, parametros.WorksheetName))
                {
                    logger.Info("GerarBase(" + functionName + ") planilha gerada com sucesso");

                    string subject = parametros.Subject + " - " + DateTime.Now.ToString("dd/MM/yyyy HH:mm:ss");

                    string message = "Planilha " + functionName + " gerada as " + DateTime.Now.ToString("dd/MM/yyyy HH:mm:ss");
                    message += "\n\n";
                    message += "Gravado em [" + excelFile + "]";

                    if (!String.IsNullOrEmpty(rede))
                    {
                        message += "\n\n";
                        message += "Disponivel na pasta de rede: [" + rede + "]";
                    }


                    if (!String.IsNullOrEmpty(parametros.Message))
                    {
                        message += "\n\n" + parametros.Message;
                    }

                    message += "\n\n";

                    string [] anexos = new string[1];
                    anexos[0] = excelFile;

                    MailUtil.EnviarPlanilhaPorEmail(parametros.MailFrom,
                                                    parametros.MailTo,
                                                    null,
                                                    null,
                                                    subject,
                                                    message,
                                                    anexos);
                }

                try
                {
                    if (!String.IsNullOrEmpty(rede))
                    {
                        FileInfo excelInfo = new FileInfo(excelFile);
                        rede += Path.DirectorySeparatorChar;
                        rede += excelInfo.Name;

                        logger.Info("GerarBase(" + functionName + ") Copiando arquivo [" + excelFile + "] para [" + rede + "]");
                        File.Copy(excelFile, rede);
                    }
                    else
                    {
                        logger.Info("GerarBase(" + functionName + ") Chave appsettings 'DiretorioRede' nao existe para copia do arquivo!");
                    }
                }
                catch (Exception ex)
                {
                    logger.Error("GerarBase(" + functionName + "): Erro ao copiar para pasta de rede");
                    logger.Error("GerarBase(" + functionName + "): " + ex.Message, ex);
                }
            }
            catch (Exception ex)
            {
                logger.Error("GerarBase(" + functionName + "): " + ex.Message, ex);
            }
        }
コード例 #19
0
        private void btGerarPlanilha_Click(object sender, EventArgs e)
        {
            btGerarPlanilha.Enabled = false;

            DataTable deta = new DataTable("MDTD");

            deta.Columns.Add("CodigoAgenteCustodia", typeof(System.String));
            deta.Columns.Add("CodigoCliente", typeof(System.String));
            deta.Columns.Add("DigitoCodigoCliente", typeof(System.String));
            deta.Columns.Add("CpfCpnjCliente", typeof(System.String));
            deta.Columns.Add("TipoTitulo", typeof(System.String));
            deta.Columns.Add("DataVctoTitulo", typeof(System.String));
            deta.Columns.Add("CodigoSelic", typeof(System.String));
            deta.Columns.Add("CodigoISIN", typeof(System.String));
            deta.Columns.Add("TipoTransacao", typeof(System.String));
            deta.Columns.Add("IDContabilTransacao", typeof(System.String));
            deta.Columns.Add("QuantitadeTitulosTransacao", typeof(System.String));
            deta.Columns.Add("NumeroProtocolo", typeof(System.String));
            deta.Columns.Add("Usuario", typeof(System.String));
            deta.Columns.Add("AgenteCustodiaContraparte", typeof(System.String));
            deta.Columns.Add("PrecoUnitarioTransacao", typeof(System.String));
            deta.Columns.Add("ValorTransacao", typeof(System.String));
            deta.Columns.Add("ValorTaxaAgente", typeof(System.String));
            deta.Columns.Add("ValorTotal", typeof(System.String));
            deta.Columns.Add("PrecoUnitarioOriginal", typeof(System.String));
            deta.Columns.Add("ValorOriginal", typeof(System.String));
            deta.Columns.Add("DataPrecoOriginal", typeof(System.String));
            deta.Columns.Add("OrigemSaldo", typeof(System.String));
            deta.Columns.Add("DataOperacao", typeof(System.String));
            deta.Columns.Add("DataMovimento", typeof(System.String));
            deta.Columns.Add("DataFinalDoacaoCupom", typeof(System.String));
            deta.Columns.Add("ValorTxSemBMFBovespa", typeof(System.String));
            deta.Columns.Add("ValorTxSemAgenteCustodia", typeof(System.String));
            deta.Columns.Add("PercentualReinvestimento", typeof(System.String));
            deta.Columns.Add("ProtocoloAgendamento", typeof(System.String));
            deta.Columns.Add("DataEmissaoTitulo", typeof(System.String));
            deta.Columns.Add("DataPagtoCupomAnterior", typeof(System.String));
            deta.Columns.Add("DataPagtoPrimeiroCupom", typeof(System.String));
            deta.Columns.Add("PUPrimeiroCupomJurosPago", typeof(System.String));
            deta.Columns.Add("DataPgtoCupomAnteriorCompra", typeof(System.String));
            deta.Columns.Add("DataLiquidacaoCompra", typeof(System.String));
            deta.Columns.Add("Filler", typeof(System.String));

            deta.AcceptChanges();



            //try
            //{
            logger.Info("Inicio processamento arquivo MDTD_01_IDENTIFICACAO_X");

            string[] lines = File.ReadAllLines(arquivo);

            long tamstrut = Marshal.SizeOf(typeof(MDTD_01_IDENTIFICACAO_X));

            foreach (string line in lines)
            {
                string tipo     = line.Substring(0, 2);
                string registro = line.Substring(2);

                if (tipo.Equals("01"))
                {
                    DataRow row = deta.NewRow();

                    MDTD_01_IDENTIFICACAO_X strut = Utilities.MarshalFromStringBlock <MDTD_01_IDENTIFICACAO_X>(line);

                    row["CodigoAgenteCustodia"]       = Convert.ToInt32(strut.CodigoAgenteCustodia.ByteArrayToString()).ToString();
                    row["CodigoCliente"]              = Convert.ToInt32(strut.CodigoCliente.ByteArrayToString()).ToString();
                    row["DigitoCodigoCliente"]        = Convert.ToInt32(strut.DigitoCodigoCliente.ByteArrayToString()).ToString();
                    row["CpfCpnjCliente"]             = strut.CpfCpnjCliente.ByteArrayToString();
                    row["TipoTitulo"]                 = strut.TipoTitulo.ByteArrayToString();
                    row["DataVctoTitulo"]             = strut.DataVctoTitulo.ByteArrayToString();
                    row["CodigoSelic"]                = strut.CodigoSelic.ByteArrayToString();
                    row["CodigoISIN"]                 = strut.CodigoISIN.ByteArrayToString();
                    row["TipoTransacao"]              = strut.TipoTransacao.ByteArrayToString();
                    row["IDContabilTransacao"]        = strut.IDContabilTransacao.ByteArrayToString();
                    row["QuantitadeTitulosTransacao"] = strut.QuantitadeTitulosTransacao.ByteArrayToDecimal(2).ToString();
                    row["NumeroProtocolo"]            = strut.NumeroProtocolo.ByteArrayToString();
                    row["Usuario"] = strut.Usuario.ByteArrayToString();
                    row["AgenteCustodiaContraparte"] = strut.CodigoAgenteCustodia.ByteArrayToString().ToString();
                    row["PrecoUnitarioTransacao"]    = strut.PrecoUnitarioTransacao.ByteArrayToDecimal(2).ToString();
                    row["ValorTransacao"]            = strut.ValorTransacao.ByteArrayToDecimal(2).ToString();
                    row["ValorTaxaAgente"]           = strut.ValorTaxaAgente.ByteArrayToDecimal(2).ToString();
                    row["ValorTotal"]                  = strut.ValorTotal.ByteArrayToDecimal(2).ToString();
                    row["PrecoUnitarioOriginal"]       = Convert.ToInt32(strut.PrecoUnitarioOriginal.ByteArrayToDecimal(2)).ToString();
                    row["ValorOriginal"]               = strut.ValorOriginal.ByteArrayToDecimal(2).ToString();
                    row["DataPrecoOriginal"]           = strut.DataPrecoOriginal.ByteArrayToString();
                    row["OrigemSaldo"]                 = strut.OrigemSaldo.ByteArrayToString();
                    row["DataOperacao"]                = strut.DataOperacao.ByteArrayToString();
                    row["DataMovimento"]               = strut.DataMovimento.ByteArrayToString();
                    row["DataFinalDoacaoCupom"]        = strut.DataFinalDoacaoCupom.ByteArrayToString();
                    row["ValorTxSemBMFBovespa"]        = strut.ValorTxSemBMFBovespa.ByteArrayToDecimal(2).ToString();
                    row["ValorTxSemAgenteCustodia"]    = strut.ValorTxSemAgenteCustodia.ByteArrayToDecimal(2).ToString();
                    row["PercentualReinvestimento"]    = strut.PercentualReinvestimento.ByteArrayToString();
                    row["ProtocoloAgendamento"]        = strut.ProtocoloAgendamento.ByteArrayToString();
                    row["DataEmissaoTitulo"]           = strut.DataEmissaoTitulo.ByteArrayToString();
                    row["DataPagtoCupomAnterior"]      = strut.DataPagtoCupomAnterior.ByteArrayToString();
                    row["DataPagtoPrimeiroCupom"]      = strut.DataPagtoPrimeiroCupom.ByteArrayToString();
                    row["PUPrimeiroCupomJurosPago"]    = strut.PUPrimeiroCupomJurosPago.ByteArrayToDecimal(2).ToString();
                    row["DataPgtoCupomAnteriorCompra"] = strut.DataPgtoCupomAnteriorCompra.ByteArrayToString();
                    row["DataLiquidacaoCompra"]        = strut.DataLiquidacaoCompra.ByteArrayToString();
                    row["Filler"] = strut.Filler.ByteArrayToString();

                    deta.Rows.Add(row);
                }
            }

            DataSet ds1 = new DataSet("DS1");

            ds1.Tables.Add(deta);
            ds1.AcceptChanges();

            if (ExcelCreator.CreateExcel(ds1, excelFile, "Sheet1"))
            {
                logger.Info("Movimento Diario Tesouro Direto planilha gerada com sucesso");


                string subject = " Movimento Diario Tesouro Direto - " + DateTime.Now.ToString("dd/MM/yyyy HH:mm:ss");

                string message = "Planilha Movimento Diario Tesouro Direto gerada as " + DateTime.Now.ToString("dd/MM/yyyy HH:mm:ss");
                message += "\n\n";
                message += "Gravado em [" + excelFile + "]";

                if (!String.IsNullOrEmpty(rede))
                {
                    message += "\n\n";

                    message += "Disponivel na pasta de rede: [" + rede + "]";
                }


                //if (!String.IsNullOrEmpty(parametros.Message))
                //{
                //    message += "\n\n" + parametros.Message;
                //}

                message += "\n\n";

                string[] anexos = new string[1];
                anexos[0] = excelFile;

                MailUtil.EnviarPlanilhaPorEmail("*****@*****.**",
                                                "*****@*****.**",
                                                null,
                                                null,
                                                subject,
                                                message,
                                                anexos);
            }

            //try
            //{
            //    if (!String.IsNullOrEmpty(rede))
            //    {
            //        FileInfo excelInfo = new FileInfo(excelFile);
            //        rede += Path.DirectorySeparatorChar;
            //        rede += excelInfo.Name;

            //        logger.Info("GenerateVctosRendaFixa(" + functionName + ") Copiando arquivo [" + excelFile + "] para [" + rede + "]");
            //        File.Copy(excelFile, rede);
            //    }
            //    else
            //        logger.Info("GenerateVctosRendaFixa(" + functionName + ") Chave appsettings 'DiretorioRede' nao existe para copia do arquivo!");
            //}
            //catch (Exception ex)
            //{
            //    logger.Error("GenerateVctosRendaFixa(" + functionName + "): Erro ao copiar para pasta de rede");
            //    logger.Error("GenerateVctosRendaFixa(" + functionName + "): " + ex.Message, ex);
            //}
            //}
            //catch (Exception ex)
            //{
            //    logger.Error("_processa_ItauFJ_03_Cotacoes(): " + ex.Message, ex);
            //}

            btGerarPlanilha.Enabled = true;
        }