static void Main(string[] args)

        {
            //
            //string gh = "user id=DPPADMIN; password=DPPADMIN; Connection Timeout=600; Max Pool Size=150; data source= (DESCRIPTION =(ADDRESS = (PROTOCOL = TCP)(HOST = 172.19.4.90)(PORT = 1700)) (CONNECT_DATA =(SERVER = DEDICATED)(SERVICE_NAME = TWODB))))";
            //string conString = "Data Source=172.19.4.103:1700/TWODB;User Id=DPPADMIN;password=DPPADMIN;";
            //string twoConString = !string.IsNullOrEmpty(System.Configuration.ConfigurationManager.AppSettings["TwoConfig"]) ? Convert.ToString(System.Configuration.ConfigurationManager.AppSettings["TwoConfig"]) : string.Empty;
            //string MEBSource = !string.IsNullOrEmpty(System.Configuration.ConfigurationManager.AppSettings["MEBSource"]) ? Convert.ToString(System.Configuration.ConfigurationManager.AppSettings["MEBSource"]) : string.Empty;
            //string MEBTarget = !string.IsNullOrEmpty(System.Configuration.ConfigurationManager.AppSettings["MEBTarget"]) ? Convert.ToString(System.Configuration.ConfigurationManager.AppSettings["MEBTarget"]) : string.Empty;
            string reportPath            = !string.IsNullOrEmpty(System.Configuration.ConfigurationManager.AppSettings["ReportPath"]) ? Convert.ToString(System.Configuration.ConfigurationManager.AppSettings["ReportPath"]) : string.Empty;
            string logopath              = !string.IsNullOrEmpty(System.Configuration.ConfigurationManager.AppSettings["LogoPath"]) ? Convert.ToString(System.Configuration.ConfigurationManager.AppSettings["LogoPath"]) : string.Empty;
            IDapperGeneralSettings _repo = new DapperGeneralSettings();

            // string conString = twoConString;
            // var dd =  new SettlementProcess().GetMSC_PERC("1654487896", "1199803451", "2044QF28", "2044OG00V000183", "VISA", "566", "8220", 20916, "566", "0", "0",0,0,0,0, "0");

            // int rec1 = _repo.PostMEB(MEBSource, MEBTarget, reportPath, logopath, "9622331", null);


            // DateTime? v_SETTDATE = null;

            //new SettlementProcess().SETTProcess("9622331");

            //(SETTDATE, reportPATH, lgopath,  NULL);
            IMainReport _repoSETT = new MainReport();

            ////string sett = _repoSETT.RPT_GenSettlementFile(DateTime.Parse("02-FEB-17"), reportPath, logopath, null);

            //var g = new EmailProcess();
            // g.SendMerchantarteeSettlementEmail("26-May-2017", "");
            // IMainReport _repoSETT = new MainReport();
            // g.SendMerchantVIPSettlementEmail("29-JUN-2017", "");
            //    string sett2 = _repoSETT.RPT_GenVIPMerchant(new DateTime(2017,09,06), reportPath, logopath, null);

            //new SettlementProcess_MEB().SETTProcess("9622331", "08-FEB-17");


            //string dtFrom2 = DateTime.Today.ToString("dd-MMM-yyyy");
            //new MEBCollectionClass().MEBProcess(dtFrom2);

            ////v_SETTDATE = DateTime.Today;
            ////v_SETTDATE.Value.Date.ToString("dd-MMM-yy");
            //IDapperSettlementReport _repoSETT = new DapperSettlementReport();
            // bool sett = _repoSETT.GenSettlementFileSETT(DateTime.Parse(v_SETTDATE.Value.Date.ToString("dd-MMM-yy")), null, reportPath, logopath, null);
            // bool sett = _repoSETT.GenSettlementFileSETT(DateTime.Parse("16-JAN-17"), null, reportPath, logopath, null);


            //   int rec2 = _repo.processSettlement(MEBTarget, reportPath, logopath, null);

            //P.SendSettlementInstitutionNotification("12-MAY-2017", "");

            //var cbn_code = "011";
            //var prefixM = string.Concat("2", cbn_code, "LA"); ;
            //var lastMidGen = "";
            //var recM = _repo.GetLastMidTidGenerated(prefixM, cbn_code, "M");
            //if(recM != null)
            //{
            //    lastMidGen = recM.MERCHANTID;
            //}
            //var mid = MidTidGenerator.GenMid(prefixM, "2011LAAAAAAAAA9");
            //Console.WriteLine("Start processing..........");
            //LogFunction lgfn = new LogFunction();
            //lgfn.loginfo("", null, DateTime.Now.ToString());
            ////var D = new EmailProcess();
            ////D.SendMerchantarteeSettlementEmail("24-MAY-2017", "");
            //var output = @"C:\POS_AUTOMATION\SETTLEMENT_DETAIL_SETT_28-Jul-2017\ACCESS BANK NIGERIA PLC\ACQUIRER\NAIRA SETTLEMENT\ACCESS BANK NIGERIA PLC_ACQUIRER.xlsx";
            //var ext = Path.GetExtension(output);
            //var fileNameNew = string.Concat(Path.GetFileNameWithoutExtension(output), "_", DateTime.Now.ToString("dd-MM-yyyy"), Path.GetExtension(output));
            //var dest = @"C:\FTP_Path\UBA";
            //if (File.Exists(output) && Directory.Exists(dest))
            //{
            //    LogFunction2.WriteMaintenaceLogToFile("Directory exist for both source and destination path");
            //    // copy file to ftp path
            //    File.Copy(output, Path.Combine(dest, fileNameNew));
            //    LogFunction2.WriteMaintenaceLogToFile("File Copied Successfully");
            //}
            Console.WriteLine("enter a report type..........");
            Console.WriteLine("1.  SETTLEMENT MASTER REPORTS");
            Console.WriteLine("2.  NIBSS SETTLEMENT REPORTS");
            Console.WriteLine("3.  ACQUIRERE/ISSUER/MDB REPORTS");
            Console.WriteLine("4.  MERCHANT REPORTS");
            Console.WriteLine("5.  PTSP/PTSA/TERW/SWTH REPORTS");
            Console.WriteLine("6.  ARTEE MERCHANT REPORTS");
            Console.WriteLine("7.  VIP MERCHANT REPORT");
            Console.WriteLine("8.  COLLECTION REPORT");
            Console.WriteLine("9.  UPHSS REPORT");
            Console.WriteLine("10. UPHSS REPORT CONSOLIDATED");
            string opt = Console.ReadLine();

            //GenHSSReportConsolidated
            Console.WriteLine("Select Date type..........");
            Console.WriteLine("1.  By Single Day");
            Console.WriteLine("2.  By Date Range");
            string optdatetype = Console.ReadLine();
            int    noofdays    = 0;
            string dtFrom      = "";

            if (optdatetype == "2")
            {
                Console.WriteLine("enter a report Start date..........");
                string fromdt = Console.ReadLine();
                Console.WriteLine("enter a report End date..........");
                string todt = Console.ReadLine();
                dtFrom   = fromdt;
                noofdays = (Convert.ToDateTime(todt) - Convert.ToDateTime(fromdt)).Days;
                Console.WriteLine("Starting From" + dtFrom);
                for (int i = 0; i < noofdays; i++)
                {
                    DateTime dtFromDate = Convert.ToDateTime(dtFrom);


                    ////IDapperSettlementReport _repoSETT = new DapperSettlementReport();
                    ////bool sett = _repoSETT.GenSettlementFileSETT_EEPLUS(dtFromDate, null, reportPath, logopath, null);
                    //IMainReport _repoSETT = new MainReport();
                    // _repoSETT.TestExport();


                    if (opt == "1")
                    {
                        Console.WriteLine("processing........SETTLEMENT MASTER REPORT" + dtFrom);
                        string sett = _repoSETT.RPT_GenSettlementMASTER(DateTime.Parse(dtFrom), reportPath, logopath, null);
                    }
                    if (opt == "2")
                    {
                        Console.WriteLine("processing.........NIBSS Settlement Report" + dtFrom);
                        //string sett = _repoSETT.RPT_GenSettlementFile2(DateTime.Parse(dtFrom), reportPath, logopath, null);
                    }
                    if (opt == "3")
                    {
                        Console.WriteLine("processing.........ACQUIRER/ISSUER/MDB REPORT" + dtFrom);
                        //string sett = _repoSETT.RPT_GenSettlementFile(DateTime.Parse(dtFrom), reportPath, logopath, null);
                    }
                    if (opt == "4")
                    {
                        Console.WriteLine("processing..........Merchant Reports" + dtFrom);
                        //string sett = _repoSETT.RPT_GenMerchants(DateTime.Parse(dtFrom), reportPath, logopath, null);
                    }

                    if (opt == "6")
                    {
                        Console.WriteLine("processing..........ARTEE Merchant Reports" + dtFrom);
                        //string sett = _repoSETT.RPT_GenARTEEMerchant(DateTime.Parse(dtFrom), reportPath, logopath, null);
                        //var P = new EmailProcess();
                        //P.SendMerchantarteeSettlementEmail(dtFrom, "");
                    }
                    if (opt == "7")
                    {
                        Console.WriteLine("processing..........VIP Merchant Reports" + dtFrom);
                        // string sett = _repoSETT.RPT_GenVIPMerchant(DateTime.Parse(dtFrom), reportPath, logopath, null);
                        // var P = new EmailProcess();
                        //P.SendMerchantVIPSettlementEmail(dtFrom, "");
                    }
                    if (opt == "8")
                    {
                        Console.WriteLine("processing..........Collection Merchant Reports" + dtFrom);
                        // string sett = _repoSETT.RPT_CollectionGenMerchants(DateTime.Parse(dtFrom), reportPath, logopath, null);
                        // var P = new EmailProcess();
                        //  P.SendMerchantVIPSettlementEmail(dtFrom, "");
                    }

                    ////if (opt == "5")
                    ////{
                    ////    Console.WriteLine("processing..........Merchant Report By Merchant Deposit Bank" + dtFrom);

                    ////    string sett = _repoSETT.RPT_GenMDBMerchants(DateTime.Parse(dtFrom), reportPath, logopath, null);
                    ////}

                    if (opt == "5")
                    {
                        Console.WriteLine("processing..........Party Report (PTSP/PTSA/TERW/SWTH)" + dtFrom);

                        //string sett = _repoSETT.RPT_Settlement(DateTime.Parse(dtFrom), reportPath, logopath, null);
                    }
                    Console.WriteLine("processing Completed For " + dtFrom);
                    dtFrom = Convert.ToDateTime(dtFrom).AddDays(1).ToString();
                }
                Console.WriteLine("processing Completed");
            }
            else
            {
                Console.WriteLine("enter a report processing date..........");
                dtFrom = Console.ReadLine();
                Console.WriteLine(dtFrom);

                //DateTime dtFromDate =DateTime.Parse(dtFrom);
                //DateTime dtFromDate = DateTime.ParseExact(dtFrom, "dd/MM/yyyy", null);

                //Console.WriteLine("enter a report type..........");
                //Console.WriteLine("1.  SETTLEMENT MASTER REPORTS");
                //Console.WriteLine("2.  NIBSS SETTLEMENT REPORTS");
                //Console.WriteLine("3.  ACQUIRERE/ISSUER/MDB REPORTS");
                //Console.WriteLine("4.  MERCHANT REPORTS");
                //Console.WriteLine("5.  PTSP/PTSA/TERW/SWTH REPORTS");
                //Console.WriteLine("6.  ARTEE MERCHANT REPORTS");
                //Console.WriteLine("7.  VIP MERCHANT REPORT");
                //Console.WriteLine("8.  COLLECTION REPORT");

                //   opt = Console.ReadLine();
                Thread.CurrentThread.CurrentCulture = new CultureInfo("en-GB"); //dd/MM/yyyy



                if (opt == "1")
                {
                    Console.WriteLine("processing........SETTLEMENT MASTER REPORT" + dtFrom);
                    string sett = _repoSETT.RPT_GenSettlementMASTER(DateTime.Parse(dtFrom), reportPath, logopath, null);
                }
                if (opt == "2")
                {
                    //Console.WriteLine("processing.........NIBSS Settlement Report" + dtFrom);
                    string sett = _repoSETT.RPT_NIBSS(DateTime.Parse(dtFrom), reportPath, logopath, null);
                }
                if (opt == "3")
                {
                    Console.WriteLine("processing.........ACQUIRERE/ISSUER/MDB REPORT" + dtFrom);
                    string sett = _repoSETT.RPT_ACQUIREREISSMDB(DateTime.Parse(dtFrom), reportPath, logopath, null);
                }
                if (opt == "4")
                {
                    Console.WriteLine("processing..........Merchant Reports" + dtFrom);
                    // string sett = _repoSETT.RPT_GenMerchants(DateTime.Parse(dtFrom), reportPath, logopath, null);
                }

                if (opt == "6")
                {
                    Console.WriteLine("processing..........ARTEE Merchant Reports" + dtFrom);
                    //string sett = _repoSETT.RPT_GenARTEEMerchant(DateTime.Parse(dtFrom), reportPath, logopath, null);
                    //var P = new EmailProcess();
                    //P.SendMerchantarteeSettlementEmail(dtFrom, "");
                }
                if (opt == "7")
                {
                    Console.WriteLine("processing..........VIP Merchant Reports" + dtFrom);
                    //string sett = _repoSETT.RPT_GenVIPMerchant(DateTime.Parse(dtFrom), reportPath, logopath, null);
                    //var P = new EmailProcess();
                    //P.SendMerchantVIPSettlementEmail(dtFrom, "");
                }
                if (opt == "8")
                {
                    Console.WriteLine("processing..........Collection Merchant Reports" + dtFrom);
                    //string sett = _repoSETT.RPT_CollectionGenMerchants(DateTime.Parse(dtFrom), reportPath, logopath, null);
                    // var P = new EmailProcess();
                    //  P.SendMerchantVIPSettlementEmail(dtFrom, "");
                }

                ////if (opt == "5")
                ////{
                ////    Console.WriteLine("processing..........Merchant Report By Merchant Deposit Bank" + dtFrom);

                ////    string sett = _repoSETT.RPT_GenMDBMerchants(DateTime.Parse(dtFrom), reportPath, logopath, null);
                ////}

                if (opt == "5")
                {
                    Console.WriteLine("processing..........Party Report (PTSP/PTSA/TERW/SWTH)" + dtFrom);

                    //string sett = _repoSETT.RPT_Settlement(DateTime.Parse(dtFrom), reportPath, logopath, null);
                }

                if (opt == "9")
                {
                    //string[] sessions = { "2018021916" };
                    Console.WriteLine("Enter Session ID: ");
                    string sessionID = Console.ReadLine();
                    //foreach (string sessionID in sessions)
                    //{
                    Console.WriteLine("processing..........UPHSS REPORT " + dtFrom + " SESSION: " + sessionID);

                    //string sett = _repoSETT.RPT_GenHSSReport(DateTime.Parse(dtFrom), reportPath, logopath, null, sessionID);

                    // }
                }

                if (opt == "10")
                {
                    //string[] sessions = { "2018021916" };
                    //  Console.WriteLine("Enter Session ID: ");
                    // string sessionID = Console.ReadLine();
                    //foreach (string sessionID in sessions)
                    //{
                    Console.WriteLine("processing..........UPHSS REPORT cosolidated ");

                    //string sett = _repoSETT.GenHSSReportConsolidated(DateTime.Parse(dtFrom), reportPath, logopath, null);

                    // }
                }



                Console.WriteLine("processing Completed");
            }
        }
Exemplo n.º 2
0
        private void SchedularCallback(object e)
        {
            try
            {
                DateTime dtFromA;
                LogFunction2.WriteMaintenaceLogToFile("Start processing..........");
                var conDate = ConfigurationManager.AppSettings["SettlementDate"].ToUpper();
                var dtFrom  = "";
                if (DateTime.TryParse(conDate, out dtFromA))
                {
                    dtFrom = dtFromA.ToString("dd-MMM-yyyy");
                }
                else
                {
                    dtFrom = DateTime.Now.ToString("dd-MMM-yyyy");
                }
                LogFunction2.WriteMaintenaceLogToFile("enter a report processing date..........");
                // string dtFrom = Console.ReadLine();

                LogFunction2.WriteMaintenaceLogToFile(dtFrom);

                DateTime dtFromDate = Convert.ToDateTime(dtFrom);


                ////IDapperSettlementReport _repoSETT = new DapperSettlementReport();
                ////bool sett = _repoSETT.GenSettlementFileSETT_EEPLUS(dtFromDate, null, reportPath, logopath, null);

                //LogFunction2.WriteMaintenaceLogToFile("enter a report type..........");
                //LogFunction2.WriteMaintenaceLogToFile("1.  SETTLEMENT MASTER REPORTS");
                //LogFunction2.WriteMaintenaceLogToFile("2.  NIBSS SETTLEMENT REPORTS");
                //LogFunction2.WriteMaintenaceLogToFile("3.  ACQUIRERE/ISSUER/MDB REPORTS");
                //LogFunction2.WriteMaintenaceLogToFile("4.  MERCHANT REPORTS");
                //LogFunction2.WriteMaintenaceLogToFile("5.  PTSP/PTSA/TERW/SWTH REPORTS");

                //string opt = Console.ReadLine();
                IMainReport _repoSETT = new MainReport();
                //var P = new EmailProcess();
                //string emailSubject = string.Format("SETTLEMENT REPORT FOR {0} ", dtFromDate.ToString("dd-MMM-yyyy"));

                try
                {
                    LogFunction2.WriteMaintenaceLogToFile("processing........SETTLEMENT MASTER REPORT" + dtFrom);
                    //LogFunction2.WriteMaintenaceLogToFile("processing........Settlement Date--" + dtFromDate);
                    // LogFunction2.WriteMaintenaceLogToFile("processing........Settlement Report Path--" + reportPath);
                    //LogFunction2.WriteMaintenaceLogToFile("processing........Settlement Logo Path--" + logopath);

                    string sett = _repoSETT.RPT_GenSettlementMASTER(dtFromDate, reportPath, logopath, null);
                    try
                    {
                        //SEND EMAIL HERE
                        //  P.SendSettlementMasterNotification(dtFrom, string.Concat(emailSubject, ":SETTLEMENT MASTER REPORT"));
                    }
                    catch (Exception ex)
                    {
                        LogFunction2.WriteMaintenaceLogToFile("Maintenance Settlement Email Service Error on: {0} " + ex.Message + ex.StackTrace);
                    }
                    LogFunction2.WriteMaintenaceLogToFile("completed........SETTLEMENT MASTER REPORT: {0}" + dtFrom);
                }
                catch (Exception ex)
                {
                    LogFunction2.WriteMaintenaceLogToFile("Maintenance Service Error on: {0} " + ex.Message + ex.StackTrace);
                }

                //try
                //{
                //    LogFunction2.WriteMaintenaceLogToFile("processing..........Merchant Reports" + dtFrom);
                //    string sett = _repoSETT.RPT_GenARTEEMerchant(dtFromDate, reportPath, logopath, null);
                //    try
                //    {
                //        LogFunction2.WriteMaintenaceLogToFile("completed..........Merchant Reports" + dtFrom);
                //        P.SendMerchantarteeSettlementEmail(dtFrom, "");
                //    }
                //    catch
                //    {

                //    }
                //}
                //catch (Exception ex)
                //{
                //    LogFunction2.WriteMaintenaceLogToFile("Maintenance Service Error on: {0} " + ex.Message + ex.StackTrace);
                //}

                //try
                //{
                //    LogFunction2.WriteMaintenaceLogToFile("processing.........NIBSS Settlement Report" + dtFrom);
                //    string sett = _repoSETT.RPT_GenSettlementFile2(dtFromDate, reportPath, logopath, null);
                //    try
                //    {
                //        P.SendSettlementMasterNotification(dtFrom, string.Concat(emailSubject, ":NIBSS REPORT"));
                //    }
                //    catch (Exception ex)
                //    {
                //        LogFunction2.WriteMaintenaceLogToFile("Maintenance Nibss Email Service Error on: {0} " + ex.Message + ex.StackTrace);
                //    }
                //    LogFunction2.WriteMaintenaceLogToFile("completed.........NIBSS Settlement Report" + dtFrom);
                //}
                //catch (Exception ex)
                //{
                //    LogFunction2.WriteMaintenaceLogToFile("Maintenance Service Error on: {0} " + ex.Message + ex.StackTrace);
                //}

                //try
                //{
                //    LogFunction2.WriteMaintenaceLogToFile("processing.........ACQUIRER/ISSUER/MDB REPORT" + dtFrom);
                //    string sett = _repoSETT.RPT_GenSettlementFile(dtFromDate, reportPath, logopath, null);
                //    //SEND EMAIL HERE
                //    //P.SendSettlementInstitutionNotification("12-MAY-2017", "");
                //    LogFunction2.WriteMaintenaceLogToFile("completed.........ACQUIRER/ISSUER/MDB REPORT" + dtFrom);
                //}
                //catch (Exception ex)
                //{
                //    LogFunction2.WriteMaintenaceLogToFile("Maintenance Service Error on: {0} " + ex.Message + ex.StackTrace);
                //}

                //try
                //{
                //    LogFunction2.WriteMaintenaceLogToFile("processing..........Party Report (PTSP/PTSA/TERW/SWTH)" + dtFrom);

                //    string sett = _repoSETT.RPT_Settlement(dtFromDate, reportPath, logopath, null);
                //    LogFunction2.WriteMaintenaceLogToFile("completed..........Party Report (PTSP/PTSA/TERW/SWTH)" + dtFrom);
                //}
                //catch (Exception ex)
                //{
                //    LogFunction2.WriteMaintenaceLogToFile("Maintenance Service Error on: {0} " + ex.Message + ex.StackTrace);
                //}
                //try
                //{
                //    LogFunction2.WriteMaintenaceLogToFile("processing..........Merchant Reports" + dtFrom);
                //    string sett = _repoSETT.RPT_GenMerchants(dtFromDate, reportPath, logopath, null);
                //    LogFunction2.WriteMaintenaceLogToFile("completed..........Merchant Reports" + dtFrom);
                //}
                //catch (Exception ex)
                //{
                //    LogFunction2.WriteMaintenaceLogToFile("Maintenance Service Error on: {0} " + ex.Message + ex.StackTrace);
                //}

                //try
                //{
                //    LogFunction2.WriteMaintenaceLogToFile("processing..........Merchant Reports" + dtFrom);
                //    string sett = _repoSETT.RPT_GenMerchants(dtFromDate, reportPath, logopath, null);
                //    LogFunction2.WriteMaintenaceLogToFile("completed..........Merchant Reports" + dtFrom);
                //}
                //catch (Exception ex)
                //{
                //    LogFunction2.WriteMaintenaceLogToFile("Maintenance Service Error on: {0} " + ex.Message + ex.StackTrace);
                //}


                ////if (opt == "5")
                ////{
                ////    LogFunction2.WriteMaintenaceLogToFile("processing..........Merchant Report By Merchant Deposit Bank" + dtFrom);

                ////    string sett = _repoSETT.RPT_GenMDBMerchants(DateTime.Parse(dtFrom), reportPath, logopath, null);
                ////}



                LogFunction2.WriteMaintenaceLogToFile("processing Completed");
            }
            catch (Exception ex)
            {
                LogFunction2.WriteMaintenaceLogToFile("Maintenance Service Error on: {0} " + ex.Message + ex.StackTrace);
            }
            //try
            //{
            //   var pDays = ConfigurationManager.AppSettings["purgedays"].ToUpper();
            //    int purgeDays = 0;
            //    if (int.TryParse(pDays, out purgeDays))
            //    {
            //        LogFunction2.WriteMaintenaceLogToFile("Maintenance Service Log: {0}");
            //        var gen = new Maintenance();
            //        gen.Purge(purgeDays);
            //        LogFunction2.WriteMaintenaceLogToFile("Maintenance Service Completed Log: {0}");
            //    }
            //        this.ScheduleService();

            //}
            //catch (Exception ex)
            //{
            //    LogFunction2.WriteMaintenaceLogToFile("Maintenance Service Error on: {0} " + ex.Message + ex.StackTrace);

            //    //Stop the Windows Service.
            //    //using (System.ServiceProcess.ServiceController serviceController = new System.ServiceProcess.ServiceController("SimpleService"))
            //    //{
            //    //    serviceController.Stop();
            //    //}
            //}
        }