Exemple #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            Dictionary <string, bool> dic = new Dictionary <string, bool>();
            bool isFilled = true;

            foreach (var quest in flowLayoutPanel1.Controls)
            {
                if (((Question)quest).GetQuestionResult() == QuestResult.Nothing)
                {
                    MessageBox.Show("Please fill all questions");
                    isFilled = false;
                    break;
                }

                dic.Add((quest as Question)?.GetQuestion() ?? throw new InvalidOperationException(), (quest as Question).IsRelevantQuestion());
            }

            foreach (var quest in ExcelQuestfLPanel.Controls)
            {
                if (((QuestionForExcel)quest).GetQuestionResult() == QuestResult.Nothing)
                {
                    MessageBox.Show("Please fill all questions");
                    isFilled = false;
                    break;
                }
            }

            if (tbTaskId.Text == String.Empty)
            {
                MessageBox.Show("Please fill the workItem Id");
                isFilled = false;
            }

            if (isFilled && !ExcelManagerController.IsFileLocked())
            {
                int lastColum = 0;
                ExcelManagerController.OpenExcel();
                ExcelManagerController.OpenAndSet(1, DateTime.Now.ToShortDateString());
                ExcelManagerController.OpenAndSet(2, XmlManagerController.GetDeveloperName());
                ExcelManagerController.OpenAndSet(3, tbTaskId.Text);
                foreach (Control quest in ExcelQuestfLPanel.Controls)
                {
                    ExcelManagerController.OpenAndSet(((QuestionForExcel)quest).ExcelColumnNumber, (((QuestionForExcel)quest).GetQuestionResult() == QuestResult.Yes) ? "Y" : "N");
                    lastColum = ((QuestionForExcel)quest).ExcelColumnNumber;
                }
                ExcelManagerController.Close();
                XmlManagerController.dictionaryChecks = dic;
                Form2 f2 = new Form2(); // Instantiate a Form3 object.
                f2.Show();              // Show Form3 and
                this.Hide();
            }
        }
 internal void SeTImpactInExcel()
 {
     Log.Write("SeTImpactInExcel() was Started");
     if (ExcelManagerController.FileIsReady())
     {
         ExcelManagerController.OpenAndSet(1, DateTime.Now.ToShortDateString());
         ExcelManagerController.OpenAndSet(2, XmlManagerController.GetDeveloperName());
         ExcelManagerController.OpenAndSet(3, WorkItem);
         foreach (var quest in ImpactList)
         {
             ExcelManagerController.OpenAndSet(quest.ExcelColumnNumber, quest.QuestionResult == QuestResult.Yes ? "Y" : "N");
         }
         ExcelManagerController.Close();
     }
     if (Settings.Default.SendExcelByMail)
     {
         CreateMailItem(WorkItem);
     }
     Finished = true;
     Log.Write("SeTImpactInExcel() was Done");
 }