[STAThread]     // make sure this is in your program - very necessary!

        static void Main(string[] args)
        {
            String UserName = Environment.GetEnvironmentVariable("USERNAME").ToUpper();

            AMC_Functions.GeneralFunctions oGenFun = new AMC_Functions.GeneralFunctions();

            bool TestMode = false;

            DateTime StartTime = DateTime.Now;

            DateTime EndTime;

            if (UserName == "MACRO" || UserName == "ADMINISTRATOR")
            {
                try
                {
                    OSF_Pro_Ambulance_NB oOSF = new OSF_Pro_Ambulance_NB(TestMode);

                    // after completion, store the current time, to pass through for the write log function
                    EndTime = DateTime.Now;

                    // write the log file, as long as it gets through
                    oGenFun.WriteLogFile(true, StartTime, EndTime, false, "jerrodr");
                }
                catch (Exception Ex)
                {
                    // after completion, store the current time, to pass through for the write log function
                    EndTime = DateTime.Now;

                    oGenFun.WriteLogFile(false, StartTime, EndTime, true, "jerrodr", Ex);
                }
            }
            else
            {
                if (TestMode)
                {
                    OSF_Pro_Ambulance_NB oOSF = new OSF_Pro_Ambulance_NB(TestMode);
                }
                else
                {
                    try
                    {
                        OSF_Pro_Ambulance_NB oOSF = new OSF_Pro_Ambulance_NB(TestMode);
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine("Error encountered:\n" + ex + "\nPress any key to continue...");
                        Console.ReadLine();
                    }
                }
            }

            Environment.Exit(0);
        }
예제 #2
0
        static void Main(string[] args)
        {
            String UserName = Environment.GetEnvironmentVariable("USERNAME").ToUpper();

            AMC_Functions.GeneralFunctions oGenFun = new AMC_Functions.GeneralFunctions();

            bool TestMode = true;

            DateTime StartTime = DateTime.Now;

            DateTime EndTime;


            if (UserName == "MACRO" || UserName == "ADMINISTRATOR")
            {
                try
                {
                    // run all clients, so query for all
                    EBO_Statement_Detail_Update oStatementUpdate = new EBO_Statement_Detail_Update(TestMode);

                    // after completion, store the current time, to pass through for the write log function
                    EndTime = DateTime.Now;

                    // write the log file, as long as it gets through
                    oGenFun.WriteLogFile(true, StartTime, EndTime, false, "jerrodr");
                }
                catch (Exception Ex)
                {
                    // after completion, store the current time, to pass through for the write log function
                    EndTime = DateTime.Now;

                    oGenFun.WriteLogFile(false, StartTime, EndTime, true, "jerrodr", Ex);
                }
            }
            else
            {
                // called by a person, so need to get the arguments if any, and pass those through, otherwise query for all
                if (args.Length >= 1)
                {
                    EBO_Statement_Detail_Update oStatementUpdate = new EBO_Statement_Detail_Update(TestMode, args[0]);
                }
                else
                {
                    EBO_Statement_Detail_Update oStatementUpdate = new EBO_Statement_Detail_Update(TestMode);
                }
            }
        }
예제 #3
0
        /// <summary>
        /// if any data is in the export data table, then export it, otherwise leave it
        /// </summary>
        private void ExportDataIfApplicable(string inCredGrp)
        {
            Console.WriteLine("Exporting data if applicable.");

            if (dt_ExportData.Rows.Count >= 1)
            {
                string fileName;

                if (inCredGrp == string.Empty)
                {
                    fileName = DateTime.Now.ToString("yyyyMMdd_HH.mm.ss") + "_" + ChangePerson + "_ALL_Statement_ADATA_Mismatch.xlsx";
                }
                else
                {
                    fileName = DateTime.Now.ToString("yyyyMMdd_HH.mm.ss") + "_" + ChangePerson + "_" + inCredGrp + "_Statement_ADATA_Mismatch.xlsx";
                }

                XLWorkbook excelExport = new XLWorkbook();
                excelExport.Worksheets.Add(dt_ExportData);
                excelExport.SaveAs(@"G:\Instructions\Visual_Studio\Jerrod\Exports\EBO Statement Data Manuals\" + fileName);
            }

            if (dt_UpdateData.Rows.Count >= 1)
            {
                string fileName;

                if (inCredGrp == string.Empty)
                {
                    fileName = DateTime.Now.ToString("yyyyMMdd_HH.mm.ss") + "_" + ChangePerson + "_ALL_Statement_ADATA_Updates.xlsx";
                }
                else
                {
                    fileName = DateTime.Now.ToString("yyyyMMdd_HH.mm.ss") + "_" + ChangePerson + "_" + inCredGrp + "_Statement_ADATA_Updates.xlsx";
                }

                XLWorkbook excelExport = new XLWorkbook();
                excelExport.Worksheets.Add(dt_ExportData);
                excelExport.SaveAs(@"G:\Instructions\Visual_Studio\Jerrod\Exports\EBO Statement Data Manuals\" + fileName);

                AMC_Functions.GeneralFunctions oGenFun = new AMC_Functions.GeneralFunctions();

                oGenFun.SendEmail("*****@*****.**", "", "Statement Updater - EBO - Complete", "Please review the data stored here: " + fileName, "*****@*****.**", "", false, true);
            }
        }