private void inviaSGA() { string percorso = ""; Classi.RptRtf.SGA_DIE sd = new TheSite.Classi.RptRtf.SGA_DIE(); percorso = sd.GENERAPDFSGA(itemId, LblSga.Text, Context.User.Identity.Name); }
private void DataGridRicercaP_ItemCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e) { #region download if (e.CommandName == "Download") { string file; string filename; string filedownload = ""; if (e.Item.Cells[7].Text == "SGA") { file = Server.MapPath("../Doc_DB/SGA") + "\\" + e.Item.Cells[6].Text; filename = e.Item.Cells[6].Text; filedownload = Server.MapPath("../Doc_DB/SGA/DOWNLOAD") + "\\" + e.Item.Cells[6].Text.Trim(); Response.Clear(); Response.ContentType = "application/pdf"; if (File.Exists(filedownload)) { File.Delete(filedownload); } File.Copy(file, filedownload); } if (e.Item.Cells[7].Text == "DIE") { //param=e.CommandArgument.ToString().Split(','); file = Server.MapPath("../Doc_DB/DIE") + "\\" + e.Item.Cells[6].Text.Trim(); filename = e.Item.Cells[6].Text; filedownload = Server.MapPath("../Doc_DB/DIE/DOWNLOAD") + "\\" + e.Item.Cells[6].Text.Trim(); Response.Clear(); Response.ContentType = "application/pdf"; if (File.Exists(filedownload)) { File.Delete(filedownload); } File.Copy(file, filedownload); } // else // { // filedownload= Server.MapPath("../Doc_DB/SGA/")+"\\"+ e.Item.Cells[6].Text.Trim(); // filedownload=filedownload.Replace(".xls",".zip"); // Response.Clear(); // Response.ContentType = "application/zip"; // } Response.AddHeader("content-disposition", "attachment; filename=" + Path.GetFileName(filedownload)); Response.WriteFile(filedownload); Response.End(); } #endregion #region invio if (e.CommandName == "Invio") { Classi.RptRtf.SGA_DIE _sd = new TheSite.Classi.RptRtf.SGA_DIE(); string percorso = ""; if (e.Item.Cells[7].Text == "SGA") { percorso = _sd.GENERAPDFSGA(int.Parse(e.Item.Cells[12].Text.ToString()), e.Item.Cells[5].Text, Context.User.Identity.Name); } if (e.Item.Cells[7].Text == "DIE") { percorso = _sd.GENERAPDFDIE(int.Parse(e.Item.Cells[12].Text.ToString()), e.Item.Cells[5].Text, Context.User.Identity.Name); } Ricerca(); #endregion } }