private void GetQuestionsFromXmls() { try { Log.Write("GetQuestionsFromXmls() was Started"); questionModelList = new List <QuestionModel>(); var questList = new List <string>(); questList = XmlManagerController.GetQuestions(); questList.ForEach(e => { questionModelList.Add(new QuestionModel() { Question = e }); }); impactModelList = new List <QuestionForExcel>(); var excelQuestList = XmlManagerController.GetExcelQuestions(); foreach (var excelQuest in excelQuestList) { impactModelList.Add(new QuestionForExcel() { ExcelColumnNumber = excelQuest.Key, Question = excelQuest.Value }); } Log.Write("GetQuestionsFromXmls() was Done"); } catch (Exception e) { Log.Write("Error was catched in MainWindow.GetQuestionsFromXmls(): " + e); Application.Current.Shutdown(); } }
private void InitUI() { var questList = XmlManagerController.GetQuestions(); foreach (var quest in questList) { var quest1 = new Question() { Parent = flowLayoutPanel1 }; quest1.SetQuestion(quest); flowLayoutPanel1.Controls.Add(quest1); } var excelQuestList = XmlManagerController.GetExcelQuestions(); foreach (var excelQuest in excelQuestList) { var quest1 = new QuestionForExcel() { Parent = ExcelQuestfLPanel, ExcelColumnNumber = excelQuest.Key }; quest1.SetQuestion(excelQuest.Value); ExcelQuestfLPanel.Controls.Add(quest1); } }
internal bool SetCheckResults() { foreach (CheckModel check in CheckList) { XmlManagerController.SetCheckResult(check); } return(true); }
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 List <CheckModel> SetCheckList() { Log.Write("SetCheckList() was Started"); Dictionary <string, bool> dic = new Dictionary <string, bool>(); foreach (QuestionModel quest in QuestionList) { string currentQuest = (quest as QuestionModel).Question; if (!dic.ContainsKey(currentQuest)) { dic.Add(currentQuest ?? throw new InvalidOperationException(), (quest as QuestionModel).IsRelevantQuestion); } } XmlManagerController.dictionaryChecks = dic; return(XmlManagerController.GetChecks()); }
private void InitUI() { var checklist = XmlManagerController.GetChecks(); checklist = checklist.GroupBy(c => c.CheckDescription).Select(c => c.First()).ToList(); var rnd = new Random(); checklist = checklist.OrderBy(item => rnd.Next()).ToList(); foreach (var check in checklist) { var check1 = new Check() { Parent = flowLayoutPanel1 }; check1.SetCheck(check.CheckDescription); check1.SetCheckFilePath(check.CheckFilePath); check1.SetToolTip(check.CheckToolTip); //check1.ExcelColumnNumber = check.ExcelColumnNumber; flowLayoutPanel1.Controls.Add(check1); } }
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"); }
private void button1_Click(object sender, EventArgs e) { bool filled = true; foreach (var check in flowLayoutPanel1.Controls) { if (check is Check) { if ((check as Check).GetCheckResult() != CheckResult.Nothing) { switch ((check as Check).GetCheckResult()) { case CheckResult.NotRelevant: XmlManagerController.SetCheckResult( new CheckModel { CheckDescription = (check as Check).GetCheck(), CheckFilePath = (check as Check).GetCheckFilePath(), //ExcelColumnNumber = (check as Check).ExcelColumnNumber }, CheckResult.NotRelevant); break; case CheckResult.Helpful: XmlManagerController.SetCheckResult( new CheckModel { CheckDescription = (check as Check).GetCheck(), CheckFilePath = (check as Check).GetCheckFilePath(), //ExcelColumnNumber = (check as Check).ExcelColumnNumber }, CheckResult.Helpful); break; case CheckResult.AlreadyCovered: XmlManagerController.SetCheckResult( new CheckModel { CheckDescription = (check as Check).GetCheck(), CheckFilePath = (check as Check).GetCheckFilePath(), //ExcelColumnNumber = (check as Check).ExcelColumnNumber }, CheckResult.AlreadyCovered); break; default: MessageBox.Show("Please Fill all Checklist!"); break; } } else { MessageBox.Show("Please Fill all the Checklist!"); filled = false; break; } } } if (filled) { MessageBox.Show("Now the commit is safer!"); Application.Exit(); } XmlManagerController.CreateNode(Environment.UserName); }