private void btnTestTimer_Click(object sender, System.EventArgs e) { Business.Time time = _times.item(_testingEff); bool cancel = false; if (time == null){ time = new Business.Time(_testingEff); _times.Add(time); time.StartTimer(); HookUpTimer(time); }else{ time.StopTimer(); this.SubmitTime(time, ref cancel); if (!cancel){ _times.Remove(time); UpdateTimerButton(null, btnTestTimer); }else{ time.StartTimer(); } } }
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 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"); } }