Example #1
0
        public override ScheduleEntry Item(int ID)
        {
            //Return an existing entry object from the entry schedule
            InboundFreight entry = null;

            try {
                //Merge from collection (dataset)
                if (ID > 0)
                {
                    DataRow[] rows = this.mSchedule.ScheduledInboundTable.Select("ID=" + ID);
                    if (rows.Length == 0)
                    {
                        throw new ApplicationException("Entry  " + ID + " does not exist in this schedule!\n");
                    }
                    DispatchDS.ScheduledInboundTableRow row = (DispatchDS.ScheduledInboundTableRow)rows[0];
                    entry               = new InboundFreight(row, this.mMediator);
                    entry.DataFile      = base.mDataFile;
                    entry.EntryChanged += new EventHandler(OnEntryChanged);
                }
                else
                {
                    entry = (InboundFreight)Item();
                }
            }
            catch (Exception ex) { throw ex; }
            return(entry);
        }
Example #2
0
 public dlgInboundFreight(InboundFreight entry, Mediator mediator) : base(entry, mediator)
 {
     //Constructor
     try {
         //Required for Windows Form Designer support
         InitializeComponent();
     }
     catch (Exception ex) { throw ex; }
 }
Example #3
0
 public override void AddList(DispatchDS list)
 {
     //
     try {
         for (int i = 0; i < list.ScheduledInboundTable.Rows.Count; i++)
         {
             DispatchDS.ScheduledInboundTableRow row = list.ScheduledInboundTable[i];
             InboundFreight entry = (InboundFreight)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; }
 }
Example #4
0
        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() + ")";
                InboundFreight freight = (InboundFreight)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;
            }
        }
Example #5
0
        public override ScheduleEntry Item()
        {
            //Return a new blank entry object
            InboundFreight entry = null;

            try {
                entry               = new InboundFreight(this.mMediator);
                entry.DataFile      = base.mDataFile;
                entry.EntryChanged += new EventHandler(OnEntryChanged);
            }
            catch (Exception ex) { throw ex; }
            return(entry);
        }
Example #6
0
 public override void RemoveList(DispatchDS list)
 {
     //Remove a list of entries from this schedule
     try {
         for (int i = 0; i < list.ScheduledInboundTable.Rows.Count; i++)
         {
             DispatchDS.ScheduledInboundTableRow row = list.ScheduledInboundTable[i];
             InboundFreight entry = (InboundFreight)Item(row.ID);
             entry.Delete();
         }
     }
     catch (Exception ex) { throw ex; }
 }
Example #7
0
 protected override void UpdateEntry()
 {
     //Update this entry
     try {
         //
         InboundFreight freight = (InboundFreight)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); }
 }