void CarregaDados() { try { string sPath = ""; if (cbxPrograma.SelectedIndex == 0) { sPath = ConfigurationManager.AppSettings["DownloadGera"].ToString(); } else { sPath = ConfigurationManager.AppSettings["DownloadSPED"].ToString(); } DirectoryInfo dinfo = new DirectoryInfo(sPath); DirectoryInfo[] diretorios; if (cbxTpExe.SelectedIndex == 0) { diretorios = dinfo.GetDirectories().Where(c => !c.Name.ToUpper().Contains("TESTE")).OrderByDescending(c => c.LastWriteTime).ToArray(); } else { diretorios = dinfo.GetDirectories().Where(c => c.Name.ToUpper().Contains("TESTE")).OrderByDescending(c => c.LastWriteTime).ToArray(); } List <Versoes> lVersoes = new List <Versoes>(); Versoes versao; int iCountID = 1; foreach (DirectoryInfo pasta in diretorios) { versao = new Versoes(); versao.id = iCountID; versao.Versao = pasta.Name; string sFileZip = pasta.Name.Replace("_TESTE", ""); versao.Path = pasta.FullName + "\\" + sFileZip + ".zip"; if (File.Exists(versao.Path)) { versao.Data = File.GetCreationTime(versao.Path); string PathDetalhe = pasta.FullName + "\\" + "Detalhes.txt"; if (File.Exists(PathDetalhe)) { StreamReader sr = File.OpenText(PathDetalhe); versao.Detalhes = sr.ReadToEnd(); } lVersoes.Add(versao); iCountID++; } } Session["Versoes"] = lVersoes; gvVersoes.DataSource = lVersoes; gvVersoes.DataBind(); } catch (Exception ex) { HlpMessageBox.ShowPopUpMsg(ex.Message, this); } }
protected void gvVersoes_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "Baixar") { int index = Convert.ToInt32(e.CommandArgument); GridViewRow row = gvVersoes.Rows[index]; int id = Convert.ToInt32(row.Cells[1].Text); Versoes versao = ((List <Versoes>)Session["Versoes"]).FirstOrDefault(c => c.id == id); Response.AddHeader("content-disposition", string.Format("attachment; filename={0}.zip", versao.Versao)); Response.TransmitFile(versao.Path); Response.End(); } }
private static void IniciaClassesInterface(bool suportaViasDiferenciadas, bool suportaViasReduzidas, bool troco, bool desconto) { System.String versaoAutomacao; try { //versaoAutomacao = mainActivity.getPackageManager().getPackageInfo( // mainActivity.getPackageName(), 0).versionName; versaoAutomacao = mainActivity.PackageManager.GetPackageInfo(mainActivity.PackageName, 0).VersionName; } catch (PackageManager.NameNotFoundException e) { Console.WriteLine("Exception" + e); versaoAutomacao = "Indisponivel"; } mPersonalizacao = setPersonalizacao(false); mDadosAutomacao = new DadosAutomacao("Automacao Demo", versaoAutomacao, "SETIS", troco, desconto, suportaViasDiferenciadas, suportaViasReduzidas, true, mPersonalizacao); mTransacoes = Transacoes.ObtemInstancia(mDadosAutomacao, mainActivity); versoes = mTransacoes.ObtemVersoes(); }
void CarregaDados() { try { string sPath = ""; if (cbxPrograma.SelectedIndex == 0) { sPath = ConfigurationManager.AppSettings["DownloadGera"].ToString(); } else { sPath = ConfigurationManager.AppSettings["DownloadSPED"].ToString(); } DirectoryInfo dinfo = new DirectoryInfo(sPath); DirectoryInfo[] diretorios; if (cbxTpExe.SelectedIndex == 0) { diretorios = dinfo.GetDirectories().Where(c => !c.Name.ToUpper().Contains("TESTE")).OrderByDescending(c => c.LastWriteTime).ToArray(); } else { diretorios = dinfo.GetDirectories().Where(c => c.Name.ToUpper().Contains("TESTE")).OrderByDescending(c => c.LastWriteTime).ToArray(); } List<Versoes> lVersoes = new List<Versoes>(); Versoes versao; int iCountID = 1; foreach (DirectoryInfo pasta in diretorios) { versao = new Versoes(); versao.id = iCountID; versao.Versao = pasta.Name; string sFileZip = pasta.Name.Replace("_TESTE", ""); versao.Path = pasta.FullName + "\\" + sFileZip + ".zip"; if (File.Exists(versao.Path)) { versao.Data = File.GetCreationTime(versao.Path); string PathDetalhe = pasta.FullName + "\\" + "Detalhes.txt"; if (File.Exists(PathDetalhe)) { StreamReader sr = File.OpenText(PathDetalhe); versao.Detalhes = sr.ReadToEnd(); } lVersoes.Add(versao); iCountID++; } } Session["Versoes"] = lVersoes; gvVersoes.DataSource = lVersoes; gvVersoes.DataBind(); } catch (Exception ex) { HlpMessageBox.ShowPopUpMsg(ex.Message, this); } }