예제 #1
0
        public string abrirArquivoPDF(int CodAnexo, bool Wait, bool SomenteGerar)
        {
            ClassWebBI.ClassFuncoes clFuncoes = new ClassWebBI.ClassFuncoes();

            SqlCommand sCommand = new SqlCommand();

            System.Data.DataTable tblArq = new System.Data.DataTable();

            SqlParameter pCodigo = new SqlParameter("@COD_ANEXO", System.Data.SqlDbType.Int);

            sCommand.Parameters.Add(pCodigo);
            sCommand.Parameters["@COD_ANEXO"].Value = CodAnexo;
            sCommand.CommandText = "SELECT NOME, ARQUIVO FROM EXCEL_TITULO_ANEXOS WHERE COD_ANEXO = @COD_ANEXO";

            tblArq = clFuncoes.ExecReader(sCommand);
            string nomeArq = "";

            if (tblArq.Rows.Count > 0)
            {
                nomeArq = clFuncoes.GetProperties("fTempDirUsuario").ToString() + tblArq.Rows[0]["NOME"].ToString();
                byte[] arquivo = (byte[])tblArq.Rows[0]["ARQUIVO"];

                clFuncoes.SalvaArquivo(@nomeArq, arquivo);
            }

            if (!SomenteGerar)
            {
                if (File.Exists(@nomeArq))
                {
                    clFuncoes.ExecProcess(@nomeArq, Wait);
                }
            }

            return(@nomeArq);
        }
예제 #2
0
        public string abrirArquivoExcel(int CodExcel, bool Wait)
        {
            ClassWebBI.ClassFuncoes clFuncoes = new ClassWebBI.ClassFuncoes();

            SqlCommand sCommand = new SqlCommand();

            System.Data.DataTable tblArq = new System.Data.DataTable();

            SqlParameter pCodigo = new SqlParameter("@COD_EXCEL", System.Data.SqlDbType.Int);

            sCommand.Parameters.Add(pCodigo);
            sCommand.Parameters["@COD_EXCEL"].Value = CodExcel;
            sCommand.CommandText = "SELECT NOME, ARQUIVO FROM EXCEL WHERE COD_EXCEL = @COD_EXCEL";

            tblArq = clFuncoes.ExecReader(sCommand);
            string nomeArq = "";

            if (tblArq.Rows.Count > 0)
            {
                nomeArq = clFuncoes.GetProperties("fTempDirUsuario").ToString() + tblArq.Rows[0]["NOME"].ToString();
                byte[] arquivo = (byte[])tblArq.Rows[0]["ARQUIVO"];

                salvaArquivoExcel(CodExcel);
            }

            if (File.Exists(@nomeArq))
            {
                clFuncoes.ExecProcess(@nomeArq, Wait);
            }

            return(@nomeArq);
        }