public static string generateOutputFile(enumOutputType outputType,string strTemplate, StyleSheet Style,int SwitchID,enumSwitchType SwitchType) { try { clsClient client = new clsClient(HttpContext.Current.Session["requestclientid"].ToString()); switch (outputType) { case enumOutputType.PDF: string Path = HttpContext.Current.Server.MapPath("~/Output/PDF/"); string PDFPath = string.Format("{0}{1}_{2}_{3}_{4:yyyy-MM-dd}.pdf", Path, SwitchType.ToString(), (new clsIFA(int.Parse(HttpContext.Current.Session["ifaid"].ToString()))).propIFA_Name, client.propForename +" "+ client.propSurname, DateTime.Now); using (clsPDF O = new clsPDF(){StyleSheet = Style}) { O.PageSetup(PageSize.LETTER, 40, 40, 30, 15); O.FromHTMLString(strTemplate); O.StartCreate(PDFPath); LogOutput(enumSwitchType.Portfolio,SwitchID,PDFPath,enumOutputType.PDF); } return PDFPath; default: return ""; } } catch (System.Net.Mail.SmtpException SE) { throw new clsOutputException(SE.Message, SE); } catch (Exception ex) { throw new clsOutputException(ex.Message, ex); } }
public static string generateOutputFile(enumOutputType outputType, string strTemplate, StyleSheet Style, int SwitchID, enumSwitchType SwitchType) { try { clsClient client = new clsClient(HttpContext.Current.Session["requestclientid"].ToString()); switch (outputType) { case enumOutputType.PDF: string Path = HttpContext.Current.Server.MapPath("~/Output/PDF/"); string PDFPath = string.Format("{0}{1}_{2}_{3}_{4:yyyy-MM-dd}.pdf", Path, SwitchType.ToString(), (new clsIFA(int.Parse(HttpContext.Current.Session["ifaid"].ToString()))).propIFA_Name, client.propForename + " " + client.propSurname, DateTime.Now); using (clsPDF O = new clsPDF() { StyleSheet = Style }) { O.PageSetup(PageSize.LETTER, 40, 40, 30, 15); O.FromHTMLString(strTemplate); O.StartCreate(PDFPath); LogOutput(enumSwitchType.Portfolio, SwitchID, PDFPath, enumOutputType.PDF); } return(PDFPath); default: return(""); } } catch (System.Net.Mail.SmtpException SE) { throw new clsOutputException(SE.Message, SE); } catch (Exception ex) { throw new clsOutputException(ex.Message, ex); } }
public static void LogOutput(enumSwitchType switchType, int SwitchID, string Filename, enumOutputType outputType) { using (System.Data.SqlClient.SqlConnection con = new clsSystem_DBConnection(clsSystem_DBConnection.strConnectionString.NavIntegrationDB).propConnection ) { con.Open(); using (System.Data.SqlClient.SqlCommand cmd = new System.Data.SqlClient.SqlCommand()) { cmd.Connection = con; cmd.CommandType = System.Data.CommandType.StoredProcedure; cmd.CommandText = "[SWITCH_Output_Log]"; cmd.Parameters.Add("@SwitchType", System.Data.SqlDbType.VarChar).Value = switchType.ToString(); cmd.Parameters.Add("@SwitchID", System.Data.SqlDbType.Int).Value = SwitchID; cmd.Parameters.Add("@Filename", System.Data.SqlDbType.VarChar).Value = Filename; cmd.Parameters.Add("@OutputType", System.Data.SqlDbType.VarChar).Value = outputType.ToString(); cmd.ExecuteNonQuery(); } } }
public static void LogOutput(enumSwitchType switchType, int SwitchID, string Filename, enumOutputType outputType) { using (System.Data.SqlClient.SqlConnection con = new clsSystem_DBConnection(clsSystem_DBConnection.strConnectionString.NavIntegrationDB).propConnection) { con.Open(); using (System.Data.SqlClient.SqlCommand cmd = new System.Data.SqlClient.SqlCommand()) { cmd.Connection = con; cmd.CommandType = System.Data.CommandType.StoredProcedure; cmd.CommandText = "[SWITCH_Output_Log]"; cmd.Parameters.Add("@SwitchType", System.Data.SqlDbType.VarChar).Value = switchType.ToString(); cmd.Parameters.Add("@SwitchID", System.Data.SqlDbType.Int).Value = SwitchID; cmd.Parameters.Add("@Filename", System.Data.SqlDbType.VarChar).Value = Filename; cmd.Parameters.Add("@OutputType", System.Data.SqlDbType.VarChar).Value = outputType.ToString(); cmd.ExecuteNonQuery(); } } }