public RolloutComplete(Rollout rollout) { InitializeComponent(); ListViewItem item; _rollout = rollout; CatLists cls = new CatLists(Connections.Inst.item("QED_DB").MySqlConnection); CatList system = cls.item("System"); _defaultUserDomain = system.Entry("/Defaults/UserDomain").Value; string deptName = ""; this.rdoUnrolled.Checked = (!_rollout.RolledBack && !_rollout.Rolled); this.rdoRolledBack.Checked = _rollout.RolledBack; _suppressRollCompletionProcess = true; this.rdoRolled.Checked = _rollout.Rolled; _suppressRollCompletionProcess = false; this.txtScheduledRollDate.Text = rollout.ScheduledDate.ToLongDateString(); this.txtFinalComments.Text = rollout.FinalComments; this.txtRolledBy.Text = (_rollout.RolledBy == "") ? _defaultUserDomain : _rollout.RolledBy; if (rollout.RolledDate != DateTime.MinValue) this.dtpRolledDate.Value = rollout.RolledDate; EffortRollout er; foreach(Effort eff in rollout.Efforts){ er = rollout.GetEffortRollout(eff); //er = eff.GetEffortRollout(rollout); if (er.DepartmentResponsibleForError != null){ deptName = er.DepartmentResponsibleForError.Name; } item = new ListViewItem(new string[]{eff.ConventionalId, er.FinalComments, er.ReasonForRollBack, er.ReasonForCodeFix, er.CodeFixedYesNo, deptName}); item.Tag = er; lvwEfforts.Items.Add(item); } }
public Time(Rollout roll) { InitializeComponent(); _roll = roll; this.lblTimeFor.Text = "Time data for rollout: " + _roll.Id.ToString() + " Client: " + _roll.Client.Name + " Scheduled Date: " + _roll.ScheduledDate.ToShortDateString(); _times = roll.Times; this.UpdateLv(); }
public Efforts(Rollout rollout) { Effort obj; _rollout= rollout; using(MySqlConnection conn = Connections.Inst.item("QED_DB").MySqlConnection){ conn.Open(); using(MySqlDataReader dr = MySqlDBLayer.LoadWhereColumnIs(conn, _table, "rolloutId", rollout.Id)){ while(dr.Read()) { obj = new Effort(dr, true); obj.BusinessCollection = this; List.Add(obj); } } } }
public EffortRollout GetEffortRollout(Rollout rollout) { foreach(EffortRollout er in this.EffortRollouts){ if (er.RolloutId == rollout.Id){ return er; } } return null; }
public bool Contains(Rollout obj) { foreach(Rollout child in List) { if (obj.Equals(child)){ return true; } } return false; }
public Rollout Add(Rollout obj) { obj.BusinessCollection = this; List.Add(obj); return obj; }
public static Rollouts GetAllUnrolled(string ORDER_BY) { Rollouts rollouts = new Rollouts(); Rollout rollout; using (MySqlConnection conn = Connections.Inst.item("QED_DB").MySqlConnection){ conn.Open(); using(MySqlCommand cmd = conn.CreateCommand()){ cmd.CommandText = "SELECT * FROM " + _table + " WHERE rolled = 0" + ((ORDER_BY.Trim().Length == 0) ? "" : " ORDER BY " + ORDER_BY); using(MySqlDataReader dr = cmd.ExecuteReader()){ while(dr.Read()){ rollout = new Rollout(dr); rollouts.Add(rollout); } } } } return rollouts; }
public static Rollouts Get(DateTime from, DateTime to, bool rolled, string orderBy) { Rollouts rollouts = new Rollouts(); Rollout rollout; using (MySqlConnection conn = Connections.Inst.item("QED_DB").MySqlConnection){ conn.Open(); using(MySqlCommand cmd = conn.CreateCommand()){ cmd.CommandText = "SELECT * FROM " + _table + " WHERE scheduledDate BETWEEN @FROM AND @TO AND rolled = @ROLLED ORDER BY " + orderBy; cmd.Parameters.Add("@FROM", from); cmd.Parameters.Add("@TO", to); cmd.Parameters.Add("@ROLLED", rolled); using(MySqlDataReader dr = cmd.ExecuteReader()){ while(dr.Read()){ rollout = new Rollout(dr); rollouts.Add(rollout); } } } } return rollouts; }
public Rollouts(Client client, DateTime date, SearchBy searchBy) { MySqlCommand cmd; Rollout roll; string dateField = (searchBy == SearchBy.RollDate) ? "rolledDate" : "scheduledDate"; date = date.Date; // Store date part, time part not needed. using(MySqlConnection conn = (MySqlConnection)this.Conn){ conn.Open(); cmd = conn.CreateCommand(); cmd.CommandText = "SELECT * FROM " + _table + " WHERE clientId = @clientId AND " + dateField + " = @" + dateField; cmd.Parameters.Add("@clientId", client.Id); cmd.Parameters.Add("@" + dateField, date); using(MySqlDataReader dr = cmd.ExecuteReader()){ if(!dr.HasRows && dateField == "scheduledDate"){ roll = new Rollout(); roll.Client = client; roll.ScheduledDate = date; roll.BusinessCollection = this; List.Add(roll); }else{ while (dr.Read()){ roll = new Rollout(dr); roll.BusinessCollection = this; List.Add(roll); } } } } }
public EffortRollouts(Rollout parent) { EffortRollout obj; this.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 EffortRollout(dr); obj.BusinessCollection = this; List.Add(obj); } } } }
public Time(Rollout roll) { Setup(); this.Rollout = roll; base.MarkNew(); }
public Time item(Rollout rollout) { foreach(Time obj in List) { if (obj.ForRollout){ if (rollout.Id == obj.Rollout.Id){ return obj; } } } return null; }
public QAPostRollReportCard(Rollout rollout, string ranBy) : base(ranBy) { _rollout = rollout; }
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"); } }
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"); } }