Exemple #1
0
 private void readFromExcel(string filePath)
 {
     try
     {
         codes = CostCodeControl.getCostCodesFromExcel(filePath, standardsDic, standardColDic);
     }
     catch (FormatException error)
     {
         MessageBox.Show(error.Message);
         //codes = new List<CostCode>();
     }
 }
Exemple #2
0
        private void importCodesBtn_Click(object sender, EventArgs e)
        {
            codesListBox.Items.Clear();
            string filePath = codesImportFileTxt.Text;

            t1.Start();
            //don't open if file pathis empty
            if (!string.IsNullOrEmpty(filePath))
            {
                if (filePath.EndsWith(".csv"))
                {
                    readFromCSV(filePath);
                }
                else if (filePath.EndsWith("xlsx") || filePath.EndsWith("xls"))
                {
                    readFromExcel(filePath);
                }

                try
                {
                    foreach (CostCode code in codes)
                    {
                        codesListBox.Items.Add(CostCodeControl.getCostCodeString(code));
                    }
                }
                catch (Exception error)
                {
                    MessageBox.Show("Something unexpected went wrong. Please email " + suportEmail + " for help.");
                    codesListBox.Items.Clear();
                }
            }
            else
            {
                MessageBox.Show("Must enter a file path to a csv file.");
            }
            t1.Stop();
            speedTxtBox.Text = t1.Elapsed.ToString();
            t1.Reset();
        }
Exemple #3
0
 public Form1()
 {
     InitializeComponent();
     standardsDic   = CostCodeControl.buildStandardsDic(@"S:\Documents\SwiftEst\standardsDic.csv");
     standardColDic = CostCodeControl.buildColCountDic(@"S:\Documents\SwiftEst\standersColsCnt.csv");
 }