Example #1
0
 /// <summary>
 /// Inheritance constructor - itself referenced as a model when this is a parent object
 /// </summary>
 /// <param name="model"></param>
 /// <remarks></remarks>
 public ImportRedemptions(ImportRedemptions model)
     : base(model)
 {
     //Initialize local variables
     this.BatchId = model.BatchId;
     this.BatchDate = model.BatchDate;
 }
Example #2
0
        public void Execute(String[] Arguments)
        {
            Trace.TraceInformation("Begin Execution: " + Application.ProductName);
            EventLog.WriteEntry(Application.ProductName, "Begin Execution: " + Application.ProductName, EventLogEntryType.Information);

            //Set global properties
            //---------------------------------------------------------------------
            ErrorLog = new List<String>();
            this.FTPAddress = AppSettings.Default.FTPAddress;
            this.FTPUser = AppSettings.Default.FTPUserID;
            this.FTPPass = AppSettings.Default.FTPPassword;
            this.FTPUseSSL = AppSettings.Default.FTPUseSSL;
            this.FTPUseSFTP = AppSettings.Default.FTPUseSFTP;
            this.FTPLeaveOnServer = AppSettings.Default.FTPLeaveOnServer;
            this.FTPMoveToArchive = AppSettings.Default.FTPMoveToArchive;
            this.FTPArchiveFolder = AppSettings.Default.FTPArchiveFolder;
            this.FTPSendEmailNotification = AppSettings.Default.FTPSendEmailNotification;
            this.FTPSendEmailNotificationAddress = AppSettings.Default.FTPSendEmailNotificationAddress;

            this.LocalFileStore = AppSettings.Default.LocalFileStore;
            if (AppSettings.Default.DatabaseUDL != null) {
                this.DatabaseUDL = AppSettings.Default.DatabaseUDL;
            }
            this.OLEDBConnection = AppSettings.Default.OLEDB_Connection;
            this.TableOwner = AppSettings.Default.TableOwner;
            this.SaleslogixConnection = AppSettings.Default.Saleslogix_Connection;
            //----------------------------------------------------------------------

            switch (Arguments[0].ToUpper()) {
                case "TEST":
                    Trace.TraceInformation("Option: Testing");
                    EventLog.WriteEntry(Application.ProductName, "Option: Testing", EventLogEntryType.Information);
                    //Send processed email
                    if (this.FTPSendEmailNotification == true) {
                        Utility.SMTP.SendSMTPMail(this.FTPSendEmailNotificationAddress, "Test Message", "Testing Body", "1");
                    }
                    break;

                case "FTPONLY":
                    Trace.TraceInformation("Option: Run FTP Only");
                    EventLog.WriteEntry(Application.ProductName, "Option: Run FTP Only", EventLogEntryType.Information);

                    //download from FTP Only
                    Source.FTPDownload retrieveFiles = new Source.FTPDownload(this);
                    retrieveFiles.Process();
                    break;

                case "IMPORTFILESONLY":
                    Trace.TraceInformation("Option: Run Import Files Only");
                    EventLog.WriteEntry(Application.ProductName, "Option: Run Import Files Only", EventLogEntryType.Information);

                    //load the files into sql
                    Source.FixedImportFromInfiles loadToDB = new Source.FixedImportFromInfiles(this);
                    List<String> result = loadToDB.Process();
                    break;

                case "IMPORTSINGLEFILEONLY":
                    Trace.TraceInformation("Option: Run Import Single Files Only");
                    EventLog.WriteEntry(Application.ProductName, "Option: Run Import Single File Only", EventLogEntryType.Information);

                    //load the files into sql
                    Source.FixedImportFromInfiles loadToDBSingle = new Source.FixedImportFromInfiles(this);
                    List<String> resultsingle = loadToDBSingle.ProcessSingleFile(Arguments[1].ToString());
                    break;

                case "IMPORTREPSONLY":
                    Trace.TraceInformation("Option: Run Import Reps Only");
                    EventLog.WriteEntry(Application.ProductName, "Option: Run Import Reps Only", EventLogEntryType.Information);

                    //Import the dealers and reps only
                    Source.ImportDealerRepsToSLX dealerRepsonly = new Source.ImportDealerRepsToSLX(this);
                    dealerRepsonly.Process();
                    break;

                //case "IMPORTTRANSACTIONSONLY":
                //    Trace.TraceInformation("Option: Run Import Transactions Only");
                //    EventLog.WriteEntry(Application.ProductName, "Option: Run Import Transactions Only", EventLogEntryType.Information);

                //    //Import the transactions
                //    Source.ImportTransactions transactionsonly2 = new Source.ImportTransactions(this);
                //    transactionsonly2.Process();
                //    break;

                case "IMPORTHOLDINGSREPONLY":
                    Trace.TraceInformation("Option: Run Import Holdings Only");
                    EventLog.WriteEntry(Application.ProductName, "Option: Run Import Holdings Only", EventLogEntryType.Information);

                    //Import the Rep holdings
                    Source.ImportRepHoldings holdingsReponly2 = new Source.ImportRepHoldings(this);
                    holdingsReponly2.Process();
                    break;

                case "IMPORTHOLDINGSDEALERONLY":
                    Trace.TraceInformation("Option: Run Import Holdings Only");
                    EventLog.WriteEntry(Application.ProductName, "Option: Run Import Holdings Only", EventLogEntryType.Information);

                    //Import the Dealer holdings
                    Source.ImportDealerHoldings holdingsDealeronly2 = new Source.ImportDealerHoldings(this);
                    holdingsDealeronly2.Process();
                    break;

                case "IMPORTREDEMPTIONSONLY":
                    Trace.TraceInformation("Option: Run Import Redemptions Only");
                    EventLog.WriteEntry(Application.ProductName, "Option: Run Import Redemptions Only", EventLogEntryType.Information);

                    //Import the Redemptions
                    Source.ImportRedemptions redemptionsonly2 = new Source.ImportRedemptions(this);
                    redemptionsonly2.Process();
                    break;

                case "IMPORTLOCALONLY":
                    Trace.TraceInformation("Option: Run Full Process, using local files only");
                    EventLog.WriteEntry(Application.ProductName, "Option: Run Full Process", EventLogEntryType.Information);

                    //Download from FTP and import files to sql
                    //Source.FTPDownload downloadFiles = new Source.FTPDownload(this);
                    //bool downloaded = downloadFiles.Process();
                    //if (downloaded) {
                    //load the files into sql
                    Source.FixedImportFromInfiles loadDB2 = new Source.FixedImportFromInfiles(this);
                    List<String> importResult2 = loadDB2.Process();

                    if (importResult2.Count > 0) {
                        //Import the dealers and reps
                        Source.ImportDealerRepsToSLX dealerReps2 = new Source.ImportDealerRepsToSLX(this);
                        dealerReps2.Process();

                        ////Import the transactions
                        //Source.ImportTransactions transactions2 = new Source.ImportTransactions(this);
                        //transactions2.Process();

                        //Import the holdings
                        Source.ImportRepHoldings holdingsRep2 = new Source.ImportRepHoldings(this);
                        int holdingscount2 = holdingsRep2.Process();

                        if (holdingscount2 > 0) {
                            //Import the Redemptions
                            Source.ImportRedemptions redemptions = new Source.ImportRedemptions(this);
                            redemptions.Process();
                        }

                        //Import the Dealer holdings
                        Source.ImportDealerHoldings holdingsDealer2 = new Source.ImportDealerHoldings(this);
                        holdingsDealer2.Process();

                        //Send Processed Email
                        if (this.FTPSendEmailNotification == true && importResult2.Count > 0) {
                            string subject = "SLX Fund File Processed";
                            string body = "SLX Fund Integration has finished processing " + importResult2.Count;
                            body += " files.\n\nTime: " + DateTime.Now.ToString();
                            body += "\nFileNames:\n";

                            foreach (string file in importResult2) {
                                body += file + "\n";
                            }

                            Utility.SMTP.SendSMTPMail(this.FTPSendEmailNotificationAddress, subject, body, this.GetHashCode().ToString());
                        }

                    }
                    //}
                    break;

                case "RBCIS":
                    Trace.TraceInformation("Option: Run Full Process");
                    EventLog.WriteEntry(Application.ProductName, "Option: Run Full Process", EventLogEntryType.Information);

                    //Download from FTP and import files to sql
                    Source.FTPDownload downloadFiles = new Source.FTPDownload(this);
                    List<String> downloaded = downloadFiles.Process();
                    //if (downloaded.Count > 0) {

                    //load the files into sql
                    Source.FixedImportFromInfiles loadDB = new Source.FixedImportFromInfiles(this);
                    List<String> importedFiles = loadDB.Process();

                    //if (importedFiles.Count > 0) {
                        //Import the dealers and reps
                        Source.ImportDealerRepsToSLX dealerReps = new Source.ImportDealerRepsToSLX(this);
                        dealerReps.Process();

                        ////Import the transactions
                        //Source.ImportTransactions transactions = new Source.ImportTransactions(this);
                        //transactions.Process();

                        //Import the holdings
                        Source.ImportRepHoldings holdingsRep = new Source.ImportRepHoldings(this);
                        int holdingscount = holdingsRep.Process();

                        if (holdingscount > 0) {
                            //Import the Redemptions
                            Source.ImportRedemptions redemptions = new Source.ImportRedemptions(this);
                            redemptions.Process();
                        }

                        //Import the Dealer holdings
                        Source.ImportDealerHoldings holdingsDealer = new Source.ImportDealerHoldings(this);
                        holdingsDealer.Process();

                        //Send Processed Email
                        if (this.FTPSendEmailNotification == true && importedFiles.Count > 0) {
                            string subject = Application.ProductName + " File Processed";
                            string body = Application.ProductName + " has finished processing " + importedFiles.Count;
                            body += " set of files.\n\nTime: " + DateTime.Now.ToString();
                            body += "\nFile Set Names:\n";

                            foreach (string file in importedFiles) {
                                body += file + "\n";
                            }

                            Utility.SMTP.SendSMTPMail(this.FTPSendEmailNotificationAddress, subject, body, this.GetHashCode().ToString());
                        }
                    //}
                    //}
                    break;

                default:
                    break;
            }

            //Send error email
            if (ErrorLog.Count > 0) {
                if (this.FTPSendEmailNotification == true) {
                    string subject = Application.ProductName + " Error";
                    string body = Application.ProductName + " has encountered " + ErrorLog.Count;
                    body += " Errors. See Server Event Log for more details.\n\nTime: " + DateTime.Now.ToString();
                    body += "\nError List:\n";

                    foreach (string err in ErrorLog) {
                        body += err + "\n";
                    }

                    Utility.SMTP.SendSMTPMail(this.FTPSendEmailNotificationAddress, subject, body, this.GetHashCode().ToString());
                }
            }

            Trace.TraceInformation("Execution Complete: " + Application.ProductName);
            EventLog.WriteEntry(Application.ProductName, "Execution Complete: " + Application.ProductName, EventLogEntryType.Information);
        }