Пример #1
0
 public ReceiveReport()
 {
     InitializeComponent();
     ConfigData     = (NameValueCollection)ConfigurationManager.GetSection("appSettings");
     lm.LogFilePath = ConfigData.Get("logFilePath");  //full path with trailing "\"
     lm.LogFile     = ConfigData.Get("logFile");
     lm.Write(dtu.DateTimeToShortDate(DateTime.Now));
     om.Debug          = Convert.ToBoolean(ConfigData.Get("debug"));
     om.AttachmentPath = ConfigData.Get("xport_path");
     om.DateTimeCoded  = dtu.DateTimeCoded();
     om.LogPath        = ConfigData.Get("logFilePath");
     recipientList     = ConfigData.Get("recipientList");
     recipients        = recipientList.Split(",".ToCharArray());
     ODMDataSetFactory = new ODMDataFactory();
     xportPath         = ConfigData.Get("xport_path");
     dbConnect         = ConfigData.Get("connect");
     foreach (string recipient in recipients)
     {
         om.RecipientList.Add(recipient);
     }
     LoadDataSet();
 }
Пример #2
0
 public void SaveSpreadSheet()
 {
     outFileName = outFilePath + "StockStatus" + dtu.DateTimeCoded() + ".xlsx";
     sldStockStatus.SaveAs(outFileName);
     SendMail();
 }
Пример #3
0
        static void Main(string[] args)
        {
            try
            {
                //checked the App.config  <updateTables> value

                //USE THESE NEXT 2 LINES IF ALL YOU NEED TO DO IS RECREATE THE [uwm_MPOUS_LocProcCode] TABLE
                ////////////////PointOfUse pou = new PointOfUse();
                ////////////////pou.RefreshPreviousValues();
                //Set App.config <updateTables> = true. As a precaution, comment the rest of this Main()
                //down to the closing brace of the try block. - location is marked by this //^^<>^^

                ConfigData     = (NameValueCollection)ConfigurationSettings.GetConfig("PatientChargeUpdate");
                debug          = Convert.ToBoolean(ConfigData.Get("debug"));
                trace          = Convert.ToBoolean(ConfigData.Get("trace"));
                verbose        = Convert.ToBoolean(ConfigData.Get("verbose"));
                lm.LogFile     = ConfigData.Get("logFile") + dtu.DateTimeCoded() + ".txt";
                lm.LogFilePath = ConfigData.Get("logFilePath");
                lm.Debug       = debug;

                ////////this was used to test the ErrorMonitor class - it records the error messages in the catch block
                ////////comment out every line from the IF stmnt to the call to SendMail below
                ////errMssg.Notify += "Program: Main: " + "ErrorMonitor Test" + Environment.NewLine;
                ////SendEmail();

                if (args.Length == 0 || debug)
                {
                    currentTask  = ConfigData.Get("task");          //full or incremental
                    locationCode = ConfigData.Get("location_code"); //....see comment in the app.config file
                }
                else
                {
                    locationCode = args[0];                                              //16 = HMC; 4  = MPOUS; 20 = HMC & MPOUS  etc. See PCUpdate.ParseLocationCode()
                    currentTask  = args[1];                                              //full or incremental
                    debug        = args.Length > 2 ? Convert.ToBoolean(args[2]) : false; //true = debug mode
                }
                dbugText = debug ? "DEBUG" : "";
                lm.Write("Update Tables: " + ConfigData.Get("updateTables"));
                lm.Write("Trace: " + trace);
                lm.Write(("Debug: " + debug));
                lm.Write("PCUConsole.Program: Start " + locations + "   Type: " + currentTask);
                if (verbose)
                {
                    Console.WriteLine(Environment.NewLine + "Running... " + dbugText);
                }
                ProcessFiles();
                if (locations.Contains("mpous"))
                {
                    lm.Write("PCUConsole.Program: MPOUS UPDATES FOLLOW:");
                    MPOUSProcessFiles();
                }
                lm.Write("PCUConsole.Program: PCUConsole End " + dbugText);
                if (verbose)
                {
                    Console.WriteLine("Complete");
                }
                //^^<>^^   To recreate the [uwm_MPOUS_LocProcCode] table comment out the try block to this point
                SendEmail();
            }
            catch (Exception ex)
            {
                lm.Write("Program: Main: " + ex.Message + Environment.NewLine);
                errMssg.Notify += "Program: Main: " + ex.Message + Environment.NewLine;
            }
        }
Пример #4
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (trace)
            {
                lm.Write("Form1.btnSave_Click");
            }
            string[] pathInfo;
            saveFileDlog                  = new SaveFileDialog();
            saveFileDlog.Filter           = "CSV files (*.csv)|*.csv|All files (*.*)|*.*";
            saveFileDlog.FilterIndex      = 1;
            saveFileDlog.RestoreDirectory = true;
            saveFileDlog.FileName         = "VIZIENT_IMPORT_";

            if (saveFileDlog.ShowDialog() == DialogResult.OK)
            {
                Cursor.Current  = Cursors.WaitCursor;
                enteredRowCount = CountRows();
                pathInfo        = saveFileDlog.FileName.Split(@"\".ToCharArray());
                currentPath     = "";
                currentFileName = pathInfo[pathInfo.Length - 1];
                for (int x = 0; x < pathInfo.Length - 1; x++)
                {
                    currentPath += pathInfo[x] + @"\";
                }
                int rowCount = enteredRowCount;
                if (changed)
                {
                    try
                    {
                        if (ParseItemList())
                        {
                            if (listAsString.Length > 0)
                            {
                                if (currentFileName.Length == 0)
                                {   //shouldn't ever get here, but just in case...
                                    currentFileName = "VIZIENT_IMPORT_" + dtu.DateTimeCoded() + ".csv";
                                }
                                else if (File.Exists(currentPath + currentFileName))
                                {   //if a file by this name does exist, delete the old back up and create a new one
                                    if (File.Exists(backupPath + "bu" + currentFileName))
                                    {
                                        File.Delete(backupPath + "bu" + currentFileName);
                                    }
                                    File.Move(currentPath + currentFileName, backupPath + "bu" + currentFileName);
                                }
                                WriteColsHeaders();
                                File.AppendAllText(currentPath + currentFileName, listAsString);
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        lm.Write("btnSave_Click: " + ex.Message);
                    }
                }
                ClearGrid();
                //dGrid.Rows.Clear();
                //dGrid.Rows.Clear();
                ////dGrid = new DataGridView();
                ////CreateGridViewCols();
                //AddGridRows(defaultRowCount);
                //listAsString = "";
                //enteredRowCount = 0;
                //changed = false;
                //required.Clear();
            }
        }