public override ScheduleEntry Item(int ID)
        {
            //Return an existing entry object from the entry schedule
            ClientInboundFreight entry = null;

            try {
                //Merge from collection (dataset)
                if (ID > 0)
                {
                    DataRow[] rows = this.mSchedule.ClientInboundTable.Select("ID=" + ID);
                    if (rows.Length == 0)
                    {
                        throw new ApplicationException("Entry  " + ID + " does not exist in this schedule!\n");
                    }
                    DispatchDS.ClientInboundTableRow row = (DispatchDS.ClientInboundTableRow)rows[0];
                    entry               = new ClientInboundFreight(row, this.mMediator);
                    entry.DataFile      = base.mDataFile;
                    entry.EntryChanged += new EventHandler(OnEntryChanged);
                }
                else
                {
                    entry = (ClientInboundFreight)Item();
                }
            }
            catch (Exception ex) { throw ex; }
            return(entry);
        }
 public dlgClientInboundFreight(ClientInboundFreight 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.ClientInboundTable.Rows.Count; i++)
         {
             DispatchDS.ClientInboundTableRow row   = list.ClientInboundTable[i];
             ClientInboundFreight             entry = (ClientInboundFreight)Item();
             entry.ID        = row.ID;
             entry.Created   = row.Created;
             entry.CreatedBy = row.CreatedBy;
             if (!row.IsVendorNameNull())
             {
                 entry.VendorName = row.VendorName;
             }
             if (!row.IsConsigneeNameNull())
             {
                 entry.ConsigneeName = row.ConsigneeName;
             }
             if (!row.IsETATimeNull())
             {
                 entry.ETATime = row.ETATime;
             }
             if (!row.IsDriverNameNull())
             {
                 entry.DriverName = row.DriverName;
             }
             if (!row.IsTrailerNumberNull())
             {
                 entry.TrailerNumber = row.TrailerNumber;
             }
             if (!row.IsAmountNull())
             {
                 entry.Amount = row.Amount;
             }
             if (!row.IsAmountTypeNull())
             {
                 entry.AmountType = row.AmountType;
             }
             if (!row.IsFreightTypeNull())
             {
                 entry.FreightType = row.FreightType;
             }
             if (!row.IsCommentsNull())
             {
                 entry.Comments = row.Comments;
             }
             if (!row.IsInNull())
             {
                 entry.In = row.In;
             }
             Add(entry);
         }
     }
     catch (Exception ex) { throw ex; }
 }
        public override ScheduleEntry Item()
        {
            //Return a new blank entry object
            ClientInboundFreight entry = null;

            try {
                entry               = new ClientInboundFreight(base.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.ClientInboundTable.Rows.Count; i++)
         {
             DispatchDS.ClientInboundTableRow row   = list.ClientInboundTable[i];
             ClientInboundFreight             entry = (ClientInboundFreight)Item(row.ID);
             entry.Delete();
         }
     }
     catch (Exception ex) { throw ex; }
 }
 protected override void UpdateEntry()
 {
     //Update this entry
     try {
         //
         ClientInboundFreight freight = (ClientInboundFreight)base.mEntry;
         freight.CreatedBy     = this.txtCreatedBy.Text;
         freight.Created       = this.dtpCreatedDate.Value;
         freight.VendorName    = this.txtVendor.Text;
         freight.DriverName    = this.txtDriver.Text;
         freight.ConsigneeName = this.txtConsignee.Text;
         freight.ETATime       = (this.dtpETA.Checked) ? this.dtpETA.Value : DateTime.MinValue;
         freight.TrailerNumber = this.txtTrailerNumber.Text;
         freight.Amount        = Convert.ToInt32(this.txtAmount.Text);
         freight.AmountType    = this.cboAmountType.Text;
         freight.FreightType   = this.cboFreightType.Text;
         freight.Comments      = this.txtComments.Text;
         freight.In            = this.chkIn.Checked;
     }
     catch (Exception ex)  { base.reportError(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.cboAmountType);
                    base.LoadSelections(base.mEntry.EntryType, this.cboFreightType);
                } catch (Exception) { }

                //Load controls
                this.Text = base.mEntry.EntryType + "(" + base.mEntry.EntryID.ToString() + ")";
                ClientInboundFreight freight = (ClientInboundFreight)base.mEntry;
                this.txtCreatedBy.Enabled = this.dtpCreatedDate.Enabled = false;
                this.txtCreatedBy.Text    = freight.CreatedBy;
                this.dtpCreatedDate.Value = freight.Created;
                this.txtVendor.Text       = freight.VendorName;
                this.txtDriver.Text       = freight.DriverName;
                this.txtConsignee.Text    = freight.ConsigneeName;
                this.dtpETA.MinDate       = new DateTime(2000, 01, 01);
                this.dtpETA.MaxDate       = DateTime.Today.AddDays(3);
                if (freight.ETATime.CompareTo(DateTime.MinValue) > 0)
                {
                    this.dtpETA.Value = freight.ETATime;
                }
                this.txtTrailerNumber.Text = freight.TrailerNumber;
                this.txtAmount.Text        = freight.Amount.ToString();
                this.cboAmountType.Text    = freight.AmountType;
                this.cboFreightType.Text   = freight.FreightType;
                this.txtComments.Text      = freight.Comments;
                this.chkIn.Checked         = freight.In;
            }
            catch (Exception ex) { base.reportError(ex); }
            finally {
                OnValidateForm(null, null);
                base.btnOK.Enabled = false;
                this.Cursor        = Cursors.Default;
            }
        }