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 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 bool GetBranch(ref string branch){ const string CVS_BRANCH = "Enter Branch"; InputModal im = new InputModal("Enter Branches for this roll", CVS_BRANCH); ((TextBox)im.AnswerTable[CVS_BRANCH]).Text = "HEAD"; if (im.ShowDialog(this) == DialogResult.OK){ branch = im.Answer(CVS_BRANCH); return (branch.Trim() != ""); } return false; }
public void Roller_Prompt(Roller roller, EventArgs args){ if (args is DialogEventArgs){ DialogEventArgs diaArgs = (DialogEventArgs) args; diaArgs.DialogResults = MessageBox.Show(this, diaArgs.Message, "QED", diaArgs.MessageBoxButtons, diaArgs.MessageBoxIcon, diaArgs.MessageBoxDefaultButton); } if (args is AskEventArgs){ AskEventArgs askArgs = (AskEventArgs) args; InputModal im = new InputModal(askArgs.Prompt, askArgs.Questions); askArgs.DialogResult = im.ShowDialog(this); askArgs.AnswerTable = im.AnswerTable; } }
private RollType AskForRollType(ref bool cancel, params RollType[] rollTypes){ RollType rt = RollType.Local_UAT; object selectedItem; ComboBox cb = new ComboBox(); cb.DropDownStyle = ComboBoxStyle.DropDownList; cb.Name = "Select Roll Type"; foreach(RollType rollType in rollTypes){ cb.Items.Add(rollType); } InputModal im = new InputModal("Select Roll Type", cb); if (im.ShowDialog() == DialogResult.OK){ selectedItem = ((ComboBox)im.AnswerTable["Select Roll Type"]).SelectedItem; if (selectedItem == null){cancel = true; return rt;}; rt = (RollType) selectedItem; if (rt == RollType.Prod){ if (MessageBox.Show(this, "This will roll code to the production environment. Before doing this you must have already done a PROD_PREP roll. If you have done the PROD_PREP roll and are ready to roll code to the production server then click OK.", "QED", MessageBoxButtons.OKCancel, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button2) == DialogResult.Cancel){ cancel = true; return rt; } } cancel = false; }else{ cancel = true; } return rt; }
private void lv_DoubleClick(object sender, System.EventArgs e) { try{ if (lv.SelectedItems[0] != null){ Business.Time _time = (Business.Time) lv.SelectedItems[0].Tag; InputModal im = new InputModal("", "Minutes", "Date", "User", "Comments"); ((TextBox)im.AnswerTable["Minutes"]).Text = _time.Minutes.ToString(); ((TextBox)im.AnswerTable["Date"]).Text = _time.Date.ToShortDateString(); ((TextBox)im.AnswerTable["User"]).Text = _time.User; ((TextBox)im.AnswerTable["Comments"]).Text = _time.Text; if (im.ShowDialog(this) == DialogResult.OK){ _time.Minutes = Int32.Parse(((TextBox)im.AnswerTable["Minutes"]).Text); _time.Date = DateTime.Parse(((TextBox)im.AnswerTable["Date"]).Text); _time.User = ((TextBox)im.AnswerTable["User"]).Text; _time.Text = ((TextBox)im.AnswerTable["Comments"]).Text; if (_time.IsValid){ _time.Update(); this.UpdateLv(); }else{ MessageBox.Show(this, _time.BrokenRules.ToString(), "QED"); } } } } catch(Exception ex){ MessageBox.Show(this, ex.Message, "QED"); } }
private void mnuItemListHierRename_Click(object sender, System.EventArgs e) { const string ENTER_NEW_NAME = "Enter New Name"; InputModal im = new InputModal("", ENTER_NEW_NAME); Entry ent = (Entry)tvwHier.SelectedNode.Tag; ((TextBox)im.AnswerTable[ENTER_NEW_NAME]).Text = ent.Key; if (im.ShowDialog(this) == DialogResult.OK){ string newKey = im.Answer(ENTER_NEW_NAME); if (newKey != "") { ent.Key = newKey; if (ent.IsValid){ ent.Update(); tvwHier.SelectedNode.Text = newKey; }else{ MessageBox.Show(this, "New entry could not be added because is was invalid:\r\n" + ent.BrokenRules.ToString()); } } } }
private void btnFindRollByRollDate_Click(object sender, System.EventArgs e) { try{ bool cancel = false; Business.Time time = _times.item(_rollout); if (time != null){ PromptTimerStop(time, ref cancel); } if (!cancel){ Client client = (Client)this.cboClients.SelectedItem; Rollouts rolls = new Rollouts(client, this.dtpRoll.Value, SearchBy.RollDate); // Client can have 1 roll scheduled for a day. bool found = false; switch (rolls.Count){ case 0: MessageBox.Show(this, "Can't find rollout", "QED"); break; case 1: _rollout = rolls[0]; UpdateRolloutTab(); found = true; break; default: // Multiple ComboBox cbo = new ComboBox(); cbo.Name = "Select Rollout by Id"; cbo.DisplayMember = "Id"; foreach(Rollout roll in rolls){ cbo.Items.Add(roll); } InputModal im = new InputModal("Multiple entries returned", cbo); if (im.ShowDialog(this) == DialogResult.OK){ Rollout roll = (Rollout)cbo.SelectedItem; if (roll != null){ _rollout = roll; UpdateRolloutTab(); found = true; } } break; } if (found){ time = _times.item(_rollout); if (time == null){ time = new Business.Time(_rollout); PromptTimerStart(time); }else{ HookUpTimer(time); } } } } catch(Exception ex) { MessageBox.Show(this, ex.Message, "Exception"); } }
public void SubmitTime(Business.Time time, ref bool cancel){ /* This function is public because it is used by CurrentTimerManager */ string minutes = time.Minutes.ToString(); InputModal im = new InputModal("Submit this timing information", "Minutes", "Date", "Comment"); TextBox txtMin = (TextBox)im.AnswerTable["Minutes"]; TextBox txtDate = (TextBox)im.AnswerTable["Date"]; txtMin.Text = minutes; txtDate.Text = DateTime.Now.ToString(); if (im.ShowDialog(this) == DialogResult.OK){ time.Minutes = Int32.Parse(txtMin.Text); time.Date = DateTime.Parse(txtDate.Text); time.User = Thread.CurrentPrincipal.Identity.Name; time.Text =((TextBox)im.AnswerTable["Comment"]).Text; if (time.IsValid) time.Update(); else MessageBox.Show(this, time.BrokenRules.ToString()); cancel = false; }else{ cancel = true; } }
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 mnuItemGenListBoxAdd_Click(object sender, System.EventArgs e) { try{ ComboBox cb = new ComboBox(); cb.Name = "Select Effort"; cb.DisplayMember = "ExternalId_Desc"; cb.DropDownStyle = ComboBoxStyle.DropDown; Efforts rolloutEfforts = _rollout.Efforts; foreach (Effort eff in Efforts.Unrolled()){ if ( !rolloutEfforts.Contains(eff.Id) && eff.Approved && (eff.EffortType == EffortType.Project || (eff.Client.Id == _rollout.Client.Id))) cb.Items.Add(eff); } InputModal im = new InputModal("", cb); if (im.ShowDialog(this) == DialogResult.OK) { if (cb.Text.Trim() != ""){ Effort eff = (Effort)cb.SelectedItem; if (eff == null) { eff = new Effort(cb.Text, true); if (rolloutEfforts.Contains(eff.Id)){ MessageBox.Show(this, "This effort has already been assigned. Can't re-assign", "QED"); return; } if (!eff.Approved){ MessageBox.Show(this, "This effort has not been marked approved yet.", "QED"); return; } if (eff.Rolled){ MessageBox.Show(this, "This effort has been rolled. Can't add.", "QED"); return; } } _rollout.AddUnrolled(eff); if (_rollout.IsValid) { _rollout.Update(); lstUnrolled.Items.Add(eff); }else{ MessageBox.Show(this, _rollout.BrokenRules.ToString(), "Error"); } } } UpdateRolloutTab(); } catch(Exception ex){ UI.ShowException(this, ex); } }
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); } }
private void lvKVP_DoubleClick(object sender, System.EventArgs e) { const string KEY= "Enter Key"; const string VAL = "Enter Value"; Entry ent = (Entry)lvKVP.SelectedItems[0].Tag; InputModal im = new InputModal("Edit Entry", KEY, VAL); ((TextBox)im.AnswerTable[KEY]).Text = ent.Key; ((TextBox)im.AnswerTable[VAL]).Text = ent.Value; if (im.ShowDialog(this) == DialogResult.OK){ ent.Key = im.Answer(KEY); ent.Value = im.Answer(VAL); if (ent.IsValid){ ent.Update(); lvKVP.SelectedItems[0].SubItems[0].Text = ent.Key; lvKVP.SelectedItems[0].SubItems[1].Text = ent.Value; }else{ MessageBox.Show("Entry could not be saved because it was invalid:\r\n" + ent.BrokenRules); } } }
private void AddEntToKVP(){ const string KEY= "Enter Key"; const string VAL = "Enter Value"; bool beenHere = false; Entry ent = (Entry)tvwHier.SelectedNode.Tag; DialogResult res; InputModal im = new InputModal("", KEY, VAL); do { if (beenHere) { MessageBox.Show(this, "All fields required", "Error"); }else{ } res = im.ShowDialog(this); beenHere = true; } while (res == DialogResult.OK && (im.Answer(KEY) == "" || im.Answer(VAL) == "")); if (res == DialogResult.OK){ Entry newEnt = ent.Entries.Add(im.Answer(KEY), im.Answer(VAL)); if (newEnt.IsValid){ newEnt.Update(); this.AddEntToKVP(newEnt); }else{ MessageBox.Show("Entry can not be saved:\r\n" + newEnt.BrokenRules); } } }
private void mnuItemGenListBoxAdd_Click(object sender, System.EventArgs e) { InputModal im = new InputModal("", "Connection Name"); if (im.ShowDialog(this) == DialogResult.OK) { _conn = new Connection(); _conn.SystemName = im.Answer("Connection Name"); _conns.Add(_conn); this.lstConns.Items.Add(_conn); this.UpdateScreen(); this.lstConns.SelectedItem = _conn; } }
private void mnuItemIBM_UAT_MAX_Click(object sender, System.EventArgs e) { try{ const string SERVER = "Server: "; const string BRANCH = "Branch: "; string server = ""; string branch = ""; InputModal im = new InputModal("Enter information for production roll", SERVER, BRANCH); if (im.ShowDialog(this) == DialogResult.OK){ server = im.Answer(SERVER); branch = im.Answer(BRANCH); IBM_MAX_Roller roller = new IBM_MAX_Roller(RollType.Prod, server, branch); this.SetupRoller(roller); roller.Roll(); } } catch(Exception ex){ MessageBox.Show(this, ex.Message, "QED"); } }
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 void GetMaxMergeInfo(ref string server, ref string user, ref string passwd, ref string branch, ref string comment, ref bool cancel){ const string MAX_SERVER = "Max Server"; const string MAX_USER = "******"; const string MAX_PW = "Max Password"; const string CVS_BRANCH = "CVS Branch"; const string CVS_COMMENT = "CVS Comment"; InputModal im = new InputModal("Enter Merge Information", MAX_SERVER, MAX_USER, MAX_PW, CVS_BRANCH, CVS_COMMENT); ((TextBox)im.AnswerTable[MAX_PW]).PasswordChar = '*'; ((TextBox)im.AnswerTable[MAX_USER]).Text = ((BusinessIdentity)System.Threading.Thread.CurrentPrincipal.Identity).UserName; if (im.ShowDialog(this) == DialogResult.OK){ server = im.Answer(MAX_SERVER); user = im.Answer(MAX_USER); passwd = im.Answer(MAX_PW); branch = im.Answer(CVS_BRANCH); comment = im.Answer(CVS_COMMENT); cancel = false; }else{ cancel = true; } }
private void mnuItemTimeAdd_Click(object sender, System.EventArgs e) { try{ InputModal im = new InputModal("", "Minutes", "Date", "User", "Comments"); ((TextBox)im.AnswerTable["User"]).Text = System.Threading.Thread.CurrentPrincipal.Identity.Name; if (im.ShowDialog(this) == DialogResult.OK){ _time = new Business.Time(); _time.Minutes = Int32.Parse(im.Answer("Minutes")); _time.Date = DateTime.Parse(im.Answer("Date").Trim()); _time.User = im.Answer("User"); _time.Text = im.Answer("Comments"); if (_eff !=null){ _eff.Times.Add(_time); _time.Effort = _eff; }else{ _roll.Times.Add(_time); _time.Rollout = _roll; } if (_time.IsValid){ _time.Update(); ListViewItem lvi = new ListViewItem(new string[]{_time.Minutes.ToString(), _time.Date.ToShortDateString(), _time.User, _time.Text}); lvi.Tag = _time; lv.Items.Add(lvi); }else{ MessageBox.Show(this, _time.BrokenRules.ToString(), "QED"); } } } catch(Exception ex){ MessageBox.Show(this, ex.Message, "QED"); } }
private void mnuItemListHierCatAdd_Click(object sender, System.EventArgs e) { const string CATEGORY_NAME = "Enter Category Name"; TreeNode tn; Entry ent; string key; if (tvwHier.SelectedNode != null) { ent = (JCSLA.Entry)tvwHier.SelectedNode.Tag; InputModal im = new InputModal("", CATEGORY_NAME ); if (im.ShowDialog(this) == DialogResult.OK){ key = im.Answer(CATEGORY_NAME); if (key != ""){ Entry newEnt = ent.Entries.Add(key); if (newEnt.IsValid){ newEnt.Update(); tn = new TreeNode(newEnt.Key); tn.Tag = newEnt; tvwHier.SelectedNode.Nodes.Add(tn); }else{ MessageBox.Show(this, "New entry could not be added because is was invalid:\r\n" + newEnt.BrokenRules.ToString()); } } } }else { InputModal im = new InputModal("", CATEGORY_NAME); if (im.ShowDialog(this) == DialogResult.OK){ key = im.Answer(CATEGORY_NAME); if (key.Trim() != ""){ ent = _pubList.AddRoot(key); if (ent.IsValid){ ent.Update(); tn = new TreeNode(ent.Key); tn.Tag = ent; tvwHier.Nodes.Add(tn); }else{ MessageBox.Show(this, "Entry is invalid\r\n" + ent.BrokenRules); } } } } }