public void LoadData(TestPlan _TestPlan)
        {
            // Test Plan General Information
            if (App.Worksheets["Test Plan"].Range["E1"].Value != null)
            {
                _TestPlan.Name = App.Worksheets["Test Plan"].Range["E1"].Value.ToString();
            }
            else
            {
                _TestPlan.Name = "";
            }

            if (App.Worksheets["Test Plan"].Range["E5"].Value != null)
            {
                _TestPlan.Introduction = App.Worksheets["Test Plan"].Range["E5"].Value.ToString();
            }
            else
            {
                _TestPlan.Introduction = "";
            }

            if (App.Worksheets["Test Plan"].Range["E11"].Value != null)
            {
                _TestPlan.SetupEnvironment = App.Worksheets["Test Plan"].Range["E11"].Value.ToString();
            }
            else
            {
                _TestPlan.SetupEnvironment = "";
            }

            if (App.Worksheets["Test Plan"].Range["E15"].Value != null)
            {
                _TestPlan.Scope = App.Worksheets["Test Plan"].Range["E15"].Value.ToString();
            }
            else
            {
                _TestPlan.Scope = "";
            }

            if (App.Worksheets["Test Plan"].Range["E19"].Value != null)
            {
                _TestPlan.Fixes = App.Worksheets["Test Plan"].Range["E19"].Value.ToString();
            }
            else
            {
                _TestPlan.Fixes = "";
            }

            if (App.Worksheets["Test Plan"].Range["E23"].Value != null)
            {
                _TestPlan.Regression = App.Worksheets["Test Plan"].Range["E23"].Value.ToString();
            }
            else
            {
                _TestPlan.Regression = "";
            }

            // Test Cases
            int      row = 2;
            TestCase tc  = new TestCase();

            while (App.Worksheets["Test Cases"].Range["A" + row.ToString()].Value != null)
            {
                tc.TestArea  = App.Worksheets["Test Cases"].Range["A" + row.ToString()].Value.ToString();
                tc.Component = App.Worksheets["Test Cases"].Range["B" + row.ToString()].Value.ToString();
                tc.Type      = App.Worksheets["Test Cases"].Range["C" + row.ToString()].Value.ToString();
                tc.ID        = App.Worksheets["Test Cases"].Range["D" + row.ToString()].Value.ToString();

                if (App.Worksheets["Test Cases"].Range["E" + row.ToString()].Value != null)
                {
                    tc.TestScenario = App.Worksheets["Test Cases"].Range["E" + row.ToString()].Value.ToString();
                }
                else
                {
                    tc.TestScenario = "";
                }

                if (App.Worksheets["Test Cases"].Range["F" + row.ToString()].Value != null)
                {
                    tc.Description = App.Worksheets["Test Cases"].Range["F" + row.ToString()].Value.ToString();
                }
                else
                {
                    tc.Description = "";
                }

                if (App.Worksheets["Test Cases"].Range["G" + row.ToString()].Value != null)
                {
                    tc.Tag = App.Worksheets["Test Cases"].Range["G" + row.ToString()].Value.ToString();
                }
                else
                {
                    tc.Tag = "";
                }

                if (App.Worksheets["Test Cases"].Range["H" + row.ToString()].Value != null)
                {
                    tc.PreConditions = App.Worksheets["Test Cases"].Range["H" + row.ToString()].Value.ToString();
                }
                else
                {
                    tc.PreConditions = "";
                }

                if (App.Worksheets["Test Cases"].Range["I" + row.ToString()].Value != null)
                {
                    tc.Steps = App.Worksheets["Test Cases"].Range["I" + row.ToString()].Value.ToString();
                }
                else
                {
                    tc.Steps = "";
                }

                if (App.Worksheets["Test Cases"].Range["J" + row.ToString()].Value != null)
                {
                    tc.ExpectedBehaviour = App.Worksheets["Test Cases"].Range["J" + row.ToString()].Value.ToString();
                }
                else
                {
                    tc.ExpectedBehaviour = "";
                }

                if (App.Worksheets["Test Cases"].Range["K" + row.ToString()].Value != null)
                {
                    tc.Status = App.Worksheets["Test Cases"].Range["K" + row.ToString()].Value.ToString();
                }
                else
                {
                    tc.Status = "";
                }

                if (App.Worksheets["Test Cases"].Range["L" + row.ToString()].Value != null)
                {
                    tc.Result = App.Worksheets["Test Cases"].Range["L" + row.ToString()].Value.ToString();
                }
                else
                {
                    tc.Result = "";
                }

                if (App.Worksheets["Test Cases"].Range["M" + row.ToString()].Value != null)
                {
                    tc.Notes = App.Worksheets["Test Cases"].Range["M" + row.ToString()].Value.ToString();
                }
                else
                {
                    tc.Notes = "";
                }

                _TestPlan.AddTestCase(new TestCase(tc));

                ++row;
            }

            Workbook.Close(false);
            App.Quit();
        }
        public void PerformChanges(TestPlan _TestPlan)
        {
            try
            {
                Clear();

                _TestPlan.BuildDatasets();
                _TestPlan.BuildResults();

                // Test Plan General Information
                App.Worksheets["Test Plan"].Range["E1"].Value  = _TestPlan.Name;
                App.Worksheets["Test Plan"].Range["E5"].Value  = _TestPlan.Introduction;
                App.Worksheets["Test Plan"].Range["E11"].Value = _TestPlan.SetupEnvironment;
                App.Worksheets["Test Plan"].Range["E15"].Value = _TestPlan.Scope;
                App.Worksheets["Test Plan"].Range["E19"].Value = _TestPlan.Fixes;
                App.Worksheets["Test Plan"].Range["E23"].Value = _TestPlan.Regression;

                // Test Cases
                int          row = 2;
                string       range;
                _Excel.Range selectedCells;

                foreach (TestCase tc in _TestPlan.GetTestCasesReadOnly())
                {
                    App.Worksheets["Test Cases"].Range["A" + row.ToString()].Value = tc.TestArea;
                    App.Worksheets["Test Cases"].Range["B" + row.ToString()].Value = tc.Component;
                    App.Worksheets["Test Cases"].Range["C" + row.ToString()].Value = tc.Type;
                    App.Worksheets["Test Cases"].Range["D" + row.ToString()].Value = tc.ID;
                    App.Worksheets["Test Cases"].Range["E" + row.ToString()].Value = tc.TestScenario;
                    App.Worksheets["Test Cases"].Range["F" + row.ToString()].Value = tc.Description;
                    App.Worksheets["Test Cases"].Range["G" + row.ToString()].Value = tc.Tag;
                    App.Worksheets["Test Cases"].Range["H" + row.ToString()].Value = tc.PreConditions;
                    App.Worksheets["Test Cases"].Range["I" + row.ToString()].Value = tc.Steps;
                    App.Worksheets["Test Cases"].Range["J" + row.ToString()].Value = tc.ExpectedBehaviour;
                    App.Worksheets["Test Cases"].Range["K" + row.ToString()].Value = tc.Status;
                    App.Worksheets["Test Cases"].Range["L" + row.ToString()].Value = tc.Result;
                    App.Worksheets["Test Cases"].Range["M" + row.ToString()].Value = tc.Notes;

                    range         = "A" + row.ToString() + ":" + "M" + row.ToString();
                    selectedCells = App.Worksheets["Test Cases"].Range[range];
                    selectedCells.Borders.Color  = Color.LightGray;
                    selectedCells.Borders.Weight = 2;

                    ++row;
                }

                // Passed - Failed
                App.Worksheets["Charts Data"].Range["A4"].Value = _TestPlan.FunctionalNewFeaturesResults[0];
                App.Worksheets["Charts Data"].Range["B4"].Value = _TestPlan.FunctionalNewFeaturesResults[1];
                App.Worksheets["Charts Data"].Range["C4"].Value = _TestPlan.FunctionalEnhancementsResults[0];
                App.Worksheets["Charts Data"].Range["D4"].Value = _TestPlan.FunctionalEnhancementsResults[1];
                App.Worksheets["Charts Data"].Range["E4"].Value = _TestPlan.NonFunctionalNewFeaturesResults[0];
                App.Worksheets["Charts Data"].Range["F4"].Value = _TestPlan.NonFunctionalNewFeaturesResults[1];
                App.Worksheets["Charts Data"].Range["G4"].Value = _TestPlan.NonFunctionalEnhancementsResults[0];
                App.Worksheets["Charts Data"].Range["H4"].Value = _TestPlan.NonFunctionalEnhancementsResults[1];

                // General Charts | A == 65, Q == 81.
                string[] functionalNF    = _TestPlan.FunctionalNewFeatures.Split(',');
                string[] functionalEN    = _TestPlan.FunctionalEnhancements.Split(',');
                string[] nonFunctionalNF = _TestPlan.NonFunctionalNewFeatures.Split(',');
                string[] nonFunctionalEN = _TestPlan.NonFunctionalEnhancements.Split(',');


                for (int i = 65; i < 82; ++i)
                {
                    App.Worksheets["Charts Data"].Range[(char)i + "8"].Value  = functionalNF[i - 65];
                    App.Worksheets["Charts Data"].Range[(char)i + "12"].Value = functionalEN[i - 65];
                    App.Worksheets["Charts Data"].Range[(char)i + "16"].Value = nonFunctionalNF[i - 65];
                    App.Worksheets["Charts Data"].Range[(char)i + "20"].Value = nonFunctionalEN[i - 65];
                }

                App.ActiveWorkbook.Sheets[1].Select();
                Workbook.Close(true);
                _TestPlan.ClearResults();
                App.Quit();
            }
            catch
            {
                App.Quit();
                MainFormNotifyIcon.ShowBalloonTip(100, "Error", "An error occurred trying to save changes", ToolTipIcon.Error);
            }
        }