public bool Contains(Time obj) { foreach(Time child in List) { if (obj.Equals(child)){ return true; } } return false; }
public Time Add(Time obj) { obj.BusinessCollection = this; List.Add(obj); return obj; }
private void btnFindRollByScheduledRollDate_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.ScheduledDate); Rollout roll = rolls[0]; if (roll.IsNew) { if (MessageBox.Show(this, "Rollout for " + client.Name + " on " + dtpRoll.Value.ToLongDateString() + " doesn't exist. Create?", "Create", MessageBoxButtons.YesNo) == DialogResult.Yes){ roll.Update(); _rollout = roll; UpdateRolloutTab(); } }else{ _rollout = roll; UpdateRolloutTab(); } if (_rollout != null){ time = _times.item(_rollout); if (time == null){ time = new QED.Business.Time(_rollout); PromptTimerStart(time); }else{ HookUpTimer(time); } } } } catch(Exception ex) { MessageBox.Show(this, ex.Message, "Exception"); } }
public Times(Rollout parent) { Time obj; _parent = parent; using(MySqlConnection conn = Connections.Inst.item("QED_DB").MySqlConnection){ using(MySqlDataReader dr = MySqlDBLayer.LoadWhereColumnIs(conn, _table, "rollId", parent.Id)){ while(dr.Read()) { obj = new Time(dr); obj.BusinessCollection = this; List.Add(obj); } } } }
private void btnSearchTestingEffort_Click(object sender, System.EventArgs e) { try{ bool cancel = false; Business.Time time; if (_testingEff != null){ time = _times.item(_testingEff); if (time != null){ PromptTimerStop(time, ref cancel); } } if (!cancel){ _testingEff = new Effort(this.txtEffortId.Text, true); if (_testingEff.IsNew){ if (_testingEff.IsValid){ _testingEff.Update(); }else{ MessageBox.Show(this, "Can't create local record for effort:\r\n" + _testingEff.BrokenRules); } } UpdateTestingTab(); time = _times.item(_testingEff); if (time == null){ time = new QED.Business.Time(_testingEff); PromptTimerStart(time); }else{ HookUpTimer(time); } } } catch(Exception ex) { this.chkApproved.Enabled = false; txtTestROEffort.Text = ""; this.lvTestNotes.Items.Clear(); this.lvTestDefectNotes.Items.Clear(); this.txtEffDesc.Text = ""; MessageBox.Show(this, "There was a problem loading effort:\r\n" + ex.Message, "QED"); } }