예제 #1
0
 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); }
 }
예제 #2
0
 public SwitchObj(short id, string name, string description, string value, enumSwitchType type, bool canWrite)
 {
     Id          = id;
     Name        = name;
     Description = description;
     Value       = value;
     SwType      = type;
     CanWrite    = canWrite;
 }
예제 #3
0
 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();
         }
     }
 }
예제 #4
0
 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();
         }
     }
 }
예제 #5
0
        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); }
        }