private void lvwEfforts_DoubleClick(object sender, System.EventArgs e) { try{ const string COMMENT = "Comment"; const string REASON_FOR_CODE_FIX = "Reason for Code Fix"; const string REASON_FOR_ROLL_BACK = "Reason for Rollback"; const string WAS_CODE_FIXED = "Was Code Fixed"; const string RESPONSIBLE_DEPARTMENT_FOR_ERROR = "Dept Responsible"; ComboBox cb; if (lvwEfforts.SelectedItems[0] != null){ ListViewItem item = lvwEfforts.SelectedItems[0]; EffortRollout er = (EffortRollout)item.Tag; InputModal im = new InputModal("", COMMENT, REASON_FOR_CODE_FIX, REASON_FOR_ROLL_BACK); cb = new ComboBox(); cb.Name = WAS_CODE_FIXED; cb.Items.AddRange(new string[]{"", "Yes", "No"}); cb.DropDownStyle = ComboBoxStyle.DropDownList; cb.Text = er.CodeFixedYesNo; im.AddToPanel(cb); cb = new ComboBox(); cb.Name = RESPONSIBLE_DEPARTMENT_FOR_ERROR; cb.DisplayMember = "Name"; cb.DropDownStyle = ComboBoxStyle.DropDownList; foreach(Group gr in Groups.Inst.Active){ cb.Items.Add(gr); if (er.DepartmentResponsibleForError != null && er.DepartmentResponsibleForError.Id == gr.Id) cb.SelectedItem = gr; } im.AddToPanel(cb); ((TextBox)im.AnswerTable[COMMENT]).Text = er.FinalComments; ((TextBox)im.AnswerTable[REASON_FOR_CODE_FIX]).Text = er.ReasonForCodeFix; ((TextBox)im.AnswerTable[REASON_FOR_ROLL_BACK]).Text = er.ReasonForRollBack; if (im.ShowDialog(this) == DialogResult.OK){ er.FinalComments = ((TextBox)im.AnswerTable[COMMENT]).Text; er.ReasonForCodeFix = ((TextBox)im.AnswerTable[REASON_FOR_CODE_FIX]).Text; er.ReasonForRollBack = ((TextBox)im.AnswerTable[REASON_FOR_ROLL_BACK]).Text; string wasCodeFixed = (string)((ComboBox)im.AnswerTable[WAS_CODE_FIXED]).SelectedItem; er.CodeFixedYesNo = wasCodeFixed; if (((ComboBox)im.AnswerTable[RESPONSIBLE_DEPARTMENT_FOR_ERROR]).SelectedItem != null) er.DepartmentResponsibleForError = ((Group)((ComboBox)im.AnswerTable[RESPONSIBLE_DEPARTMENT_FOR_ERROR]).SelectedItem); if (er.IsValid){ er.Update(); item.SubItems[0].Text = er.Effort.ConventionalId; item.SubItems[1].Text = er.FinalComments; item.SubItems[2].Text = er.ReasonForRollBack; item.SubItems[3].Text = er.ReasonForCodeFix; item.SubItems[4].Text = er.CodeFixedYesNo; if (er.DepartmentResponsibleForError != null) item.SubItems[5].Text = er.DepartmentResponsibleForError.Name; }else{ MessageBox.Show(this, er.BrokenRules.ToString(), "QED"); } } } } catch(Exception ex){ MessageBox.Show(this, ex.Message, "QED"); } }
private bool GetFromTo(ref DateTimePicker dtpFrom, ref DateTimePicker dtpTo){ InputModal im = new InputModal("Select from and to date"); im.AddToPanel("From : ", dtpFrom); im.AddToPanel("To : ", dtpTo); DialogResult res = im.ShowDialog(this); dtpFrom.Value = dtpFrom.Value.Date; dtpTo.Value = dtpTo.Value.Date; return res == DialogResult.OK; }
private void lvRollDefectNotes_DoubleClick(object sender, System.EventArgs e) { ListViewItem item = lvRollDefectNotes.SelectedItems[0]; Defect def = (Defect)item.Tag; InputModal im = new InputModal("", "Description"); ComboBox cb = new ComboBox(); cb.Name = "Effort"; cb.DropDownStyle = ComboBoxStyle.DropDownList; cb.DisplayMember = "ExternalId_Desc"; im.AddToPanel(cb); ((TextBox)im.AnswerTable["Description"]).Text = def.Desc; foreach (Effort eff in _rollout.Efforts){ cb.Items.Add(eff); if (eff.Id == def.Effort.Id){ ((ComboBox)im.AnswerTable["Effort"]).SelectedItem = eff; } } if (im.ShowDialog() == DialogResult.OK){ def.Desc = ((TextBox)im.AnswerTable["Description"]).Text; def.Effort = ((Effort)((ComboBox)im.AnswerTable["Effort"]).SelectedItem); } if (UI.UpdateIfValid(this, def)){ item.SubItems[0].Text = def.Desc; item.SubItems[1].Text = def.Effort.ExternalId_Desc; } }
private void GetPPAndOSRollData(ref string PPBranch, ref string OSBranch, ref RollType rt, ref bool cancel){ const string PP_CVS_BRANCH = "PP CVS Branch"; const string OS_CVS_BRANCH = "OS CVS Branch"; const string ROLL_CODE_TO = "Roll code to:"; const string REMOTE_UAT_ROLL = "Remote UAT Site"; const string LOCAL_UAT_ROLL = "Local UAT Site"; string rollType = ""; rt = RollType.Local_UAT; // Compiler wants a default ComboBox cbo = new ComboBox(); cbo.Name = ROLL_CODE_TO; cbo.DropDownStyle = ComboBoxStyle.DropDownList; cbo.Items.Add(LOCAL_UAT_ROLL); cbo.Items.Add(REMOTE_UAT_ROLL); InputModal im = new InputModal("Enter Branches for this roll", PP_CVS_BRANCH, OS_CVS_BRANCH); im.AddToPanel(cbo); ((TextBox)im.AnswerTable[PP_CVS_BRANCH]).Text = "HEAD"; ((TextBox)im.AnswerTable[OS_CVS_BRANCH]).Text = "HEAD"; if (im.ShowDialog(this) == DialogResult.OK){ PPBranch = im.Answer(PP_CVS_BRANCH); OSBranch = im.Answer(OS_CVS_BRANCH); rollType = im.Answer(ROLL_CODE_TO); if (rollType == REMOTE_UAT_ROLL) rt = RollType.Remote_UAT; else if (rollType == LOCAL_UAT_ROLL) rt = RollType.Local_UAT; cancel = false; }else{ cancel = true; } }
private void mnuItemNotesAdd_Click(object sender, System.EventArgs e) { ListView lv = (ListView)this.ActiveControl; ListViewItem item = new ListViewItem(); QED.Business.Message msg = null; InputModal imRollDef = null; InputModelLarge im = null; const string DEFECT = "Description"; const string EFFORT = "Enter Effort: "; Defect def = null; if (lv.Name != "lvRollDefectNotes"){ im = new InputModelLarge(); }else{ if (_rollout.Efforts.Count > 0){ imRollDef = new InputModal("Enter Defect Info", DEFECT); ComboBox cb = new ComboBox(); cb.Name = EFFORT; cb.DropDownStyle = ComboBoxStyle.DropDownList; cb.DisplayMember = "ExternalId_Desc"; foreach(Effort eff in _rollout.Efforts){ cb.Items.Add(eff); } imRollDef.AddToPanel(cb); }else{ MessageBox.Show("No efforts have been assigned to this rollout."); } } if( (imRollDef != null && imRollDef.ShowDialog() == DialogResult.OK) || (im != null && im.ShowDialog(this) == DialogResult.OK) ){ switch (lv.Name) { case "lvTestNotes": msg = _testingEff.Messages.Add(new QED.Business.Message(im.Answer)); if (msg.IsValid) msg.Update(); else MessageBox.Show(this, msg.BrokenRules.ToString()); item.Text = msg.Text; item.Tag = msg; break; case "lvTestDefectNotes" : def = _testingEff.Defects.Add(new QED.Business.Defect(im.Answer)); def.ForRoll = false; if (def.IsValid) def.Update(); else MessageBox.Show(this, def.BrokenRules.ToString()); item.Text = def.Desc; item.Tag = def; break; case "lvRollNotes" : msg = _rollout.Messages.Add(new QED.Business.Message(im.Answer)); if (msg.IsValid) msg.Update(); else MessageBox.Show(this, msg.BrokenRules.ToString()); item.Text = msg.Text; item.Tag = msg; break; case "lvRollDefectNotes" : string defectMsg = ((TextBox)imRollDef.AnswerTable[DEFECT]).Text; Effort eff = null; if (((ComboBox)imRollDef.AnswerTable[EFFORT]).SelectedItem != null) eff = ((Effort)((ComboBox)imRollDef.AnswerTable[EFFORT]).SelectedItem); if (eff == null || defectMsg.Trim() == ""){ MessageBox.Show(this, "All values required", "QED"); }else{ def = _rollout.Defects.Add(new QED.Business.Defect(defectMsg)); def.ForRoll = true; def.Effort = eff; if (def.IsValid) def.Update(); else MessageBox.Show(this, def.BrokenRules.ToString()); item.Tag = def; item.Text = def.Desc; item.SubItems.Add(eff.ExternalId_Desc); } break; } if ( (def != null && def.IsValid) || (msg != null && msg.IsValid) ) lv.Items.Add(item); } }