Example #1
0
        private bool getAbbreviations()
        {
            int lineCount = 0;
            string line;
            string[] lineparts;
            string[] otherunits;
            GLEONCodeData = new List<testTypeUnits>();
            try
            {
                StreamReader reader = new StreamReader(System.Windows.Forms.Application.StartupPath+ @"\Control Files\ABBREVIATIONS.txt");

                while ((line = reader.ReadLine()) != null)
                {
                    lineCount++;
                    lineparts = line.Split('\t');

                        string recUnit;
                        testTypeUnits units = new testTypeUnits();
                        units.possibleUnits = new List<string>();
                        units.testCode = lineparts[0];
                        units.testName = lineparts[1];
                        if (lineparts.Count() >= 3)
                            recUnit = lineparts[2];
                        else
                            recUnit = "";
                        units.RecommendedUnits = recUnit;
                        units.possibleUnits.Add(recUnit);
                        if (lineparts.Count() == 4)
                        {
                            otherunits = lineparts[3].Split(',');
                            for (int i = 0; i < otherunits.Count(); i++)
                            {
                                units.possibleUnits.Add(otherunits[i]);
                            }
                        }
                        GLEONCodeData.Add(units);

                }
                return true;
            }
            catch (Exception excep)
            {
                MessageBox.Show(excep.ToString());
                return false;
            }
        }
Example #2
0
 private void addNewVaribleToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (InputTable != null)
     {
         FrmNewVariable newVariable = new FrmNewVariable();
         newVariable.ShowDialog();
         if (newVariable.exitByCancel == false)
         {
             try
             {
                 StreamWriter writer = File.AppendText(@"Control Files\ABBREVIATIONS.txt");
                 string output = newVariable.testCode + '\t' + newVariable.testName;
                 testTypeUnits newTest = new testTypeUnits();
                 newTest.possibleUnits = new List<string>();
                 newTest.testCode = newVariable.testCode;
                 newTest.testName = newVariable.testName;
                 if (newVariable.RecommendedUnits != "")
                 {
                     output += '\t' + newVariable.RecommendedUnits;
                     newTest.RecommendedUnits = newVariable.RecommendedUnits;
                     newTest.possibleUnits.Add(newVariable.RecommendedUnits);
                     if (newVariable.possibleUnits.Count != 0)
                     {
                         output += '\t';
                         foreach (string posUnits in newVariable.possibleUnits)
                         {
                             output += posUnits;
                             newTest.possibleUnits.Add(posUnits);
                         }
                     }
                 }
                 writer.WriteLine(output);
                 writer.Close();
                 GLEONCodeData.Add(newTest);
                 newVariable.Close();
             }
             catch (Exception excep)
             {
                 MessageBox.Show(excep.ToString());
             }
         }
     }
     else
     {
         MessageBox.Show("You have not opened a valid data table yet", "Invalid Data", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
     }
 }