public override ScheduleEntry Item(int ID) { //Return an existing entry object from the entry schedule OutboundFreight entry = null; try { //Merge from collection (dataset) if (ID > 0) { DataRow[] rows = this.mSchedule.ScheduledOutboundTable.Select("ID=" + ID); if (rows.Length == 0) { throw new ApplicationException("Entry " + ID + " does not exist in this schedule!\n"); } DispatchDS.ScheduledOutboundTableRow row = (DispatchDS.ScheduledOutboundTableRow)rows[0]; entry = new OutboundFreight(row, this.mMediator); entry.DataFile = base.mDataFile; entry.EntryChanged += new EventHandler(OnEntryChanged); } else { entry = (OutboundFreight)Item(); } } catch (Exception ex) { throw ex; } return(entry); }
//Interface public dlgOutboundFreight(OutboundFreight entry, Mediator mediator) : base(entry, mediator) { //Constructor try { //Required for Windows Form Designer support InitializeComponent(); } catch (Exception ex) { throw ex; } }
public override void AddList(DispatchDS list) { // try { for (int i = 0; i < list.ScheduledOutboundTable.Rows.Count; i++) { DispatchDS.ScheduledOutboundTableRow row = list.ScheduledOutboundTable[i]; OutboundFreight entry = (OutboundFreight)Item(); entry.ID = row.ID; entry.Created = row.Created; entry.CreatedBy = row.CreatedBy; if (!row.IsDriverNameNull()) { entry.DriverName = row.DriverName; } if (!row.IsTrailerNumberNull()) { entry.TrailerNumber = row.TrailerNumber; } if (!row.IsFromLocationNull()) { entry.FromLocation = row.FromLocation; } if (!row.IsToLocationNull()) { entry.ToLocation = row.ToLocation; } if (!row.IsScheduledDepartureNull()) { entry.ScheduledDeparture = row.ScheduledDeparture; } if (!row.IsActualDepartureNull()) { entry.ActualDeparture = row.ActualDeparture; } if (!row.IsScheduledDeliveryNull()) { entry.ScheduledDelivery = row.ScheduledDelivery; } if (!row.IsActualDeliveryNull()) { entry.ActualDelivery = row.ActualDelivery; } if (!row.IsCommentsNull()) { entry.Comments = row.Comments; } if (!row.IsConfirmedNull()) { entry.Confirmed = row.Confirmed; } Add(entry); } } catch (Exception ex) { throw ex; } }
private void OnFormLoad(object sender, System.EventArgs e) { //Event handler for form load event this.Cursor = Cursors.WaitCursor; try { //Load selection lists try { base.LoadSelections(base.mEntry.EntryType, this.cboFreightFrom); base.LoadSelections(base.mEntry.EntryType, this.cboFreightTo); } catch (Exception) { } //Load controls this.Text = base.mEntry.EntryType + "(" + base.mEntry.EntryID.ToString() + ")"; OutboundFreight freight = (OutboundFreight)base.mEntry; this.txtCreatedBy.Enabled = this.dtpCreatedDate.Enabled = false; this.txtCreatedBy.Text = freight.CreatedBy; this.dtpCreatedDate.Value = freight.Created; this.txtTrailerNumber.Text = freight.TrailerNumber; this.txtDriver.Text = freight.DriverName; this.dtpScheduledDeparture.MinDate = new DateTime(2000, 01, 01); this.dtpScheduledDeparture.MaxDate = DateTime.Today.AddDays(7); if (freight.ScheduledDeparture.CompareTo(DateTime.MinValue) > 0) { this.dtpScheduledDeparture.Value = freight.ScheduledDeparture; } this.cboFreightFrom.Text = freight.FromLocation; this.dtpScheduledDelivery.MinDate = new DateTime(2000, 01, 01); this.dtpScheduledDelivery.MaxDate = DateTime.Today.AddDays(7); if (freight.ScheduledDelivery.CompareTo(DateTime.MinValue) > 0) { this.dtpScheduledDelivery.Value = freight.ScheduledDelivery; } this.dtpActualDeparture.MinDate = new DateTime(2000, 01, 01); this.dtpActualDeparture.MaxDate = DateTime.Today.AddDays(7); if (freight.ActualDeparture.CompareTo(DateTime.MinValue) > 0) { this.dtpActualDeparture.Value = freight.ActualDeparture; } this.cboFreightTo.Text = freight.ToLocation; this.dtpActualDelivery.MinDate = new DateTime(2000, 01, 01); this.dtpActualDelivery.MaxDate = DateTime.Today.AddDays(7); if (freight.ActualDelivery.CompareTo(DateTime.MinValue) > 0) { this.dtpActualDelivery.Value = freight.ActualDelivery; } this.txtComments.Text = freight.Comments; } catch (Exception ex) { base.reportError(ex); } finally { OnValidateForm(null, null); base.btnOK.Enabled = false; this.Cursor = Cursors.Default; } }
public override ScheduleEntry Item() { //Return a new blank entry object OutboundFreight entry = null; try { entry = new OutboundFreight(this.mMediator); entry.DataFile = base.mDataFile; entry.EntryChanged += new EventHandler(OnEntryChanged); } catch (Exception ex) { throw ex; } return(entry); }
public override void RemoveList(DispatchDS list) { //Remove a list of entries from this schedule try { for (int i = 0; i < list.ScheduledOutboundTable.Rows.Count; i++) { DispatchDS.ScheduledOutboundTableRow row = list.ScheduledOutboundTable[i]; OutboundFreight entry = (OutboundFreight)Item(row.ID); entry.Delete(); } } catch (Exception ex) { throw ex; } }
protected override void UpdateEntry() { //Update this entry try { // OutboundFreight freight = (OutboundFreight)base.mEntry; freight.CreatedBy = this.txtCreatedBy.Text; freight.Created = this.dtpCreatedDate.Value; freight.TrailerNumber = this.txtTrailerNumber.Text; freight.DriverName = this.txtDriver.Text; freight.ScheduledDeparture = (this.dtpScheduledDeparture.Checked) ? this.dtpScheduledDeparture.Value : DateTime.MinValue; freight.FromLocation = this.cboFreightFrom.Text; freight.ScheduledDelivery = (this.dtpScheduledDelivery.Checked) ? this.dtpScheduledDelivery.Value : DateTime.MinValue; freight.ActualDeparture = (this.dtpActualDeparture.Checked) ? this.dtpActualDeparture.Value : DateTime.MinValue; freight.ToLocation = this.cboFreightTo.Text; freight.ActualDelivery = (this.dtpActualDelivery.Checked) ? this.dtpActualDelivery.Value : DateTime.MinValue; freight.Comments = this.txtComments.Text; } catch (Exception ex) { base.reportError(ex); } }