public override DataSet ToDataSet() { //Return a dataset containing values for this object DispatchDS ds = null; try { ds = new DispatchDS(); DispatchDS.TrailerLogTableRow trailerEntry = ds.TrailerLogTable.NewTrailerLogTableRow(); trailerEntry.ID = this._id; trailerEntry.Created = this._created; trailerEntry.CreatedBy = this._createdby; trailerEntry.TrailerNumber = this._trailernumber; trailerEntry.IncomingDate = this._incomingdate; trailerEntry.IncomingCarrier = this._incomingcarrier; trailerEntry.IncomingSeal = this._incomingseal; trailerEntry.IncomingDriverName = this._incomingdrivername; trailerEntry.InitialYardLocation = this._initialyardlocation; trailerEntry.LoadSheetReady = this._loadsheetready; trailerEntry.MoveInProgress = this._moveinprogress; trailerEntry.OutgoingDate = this._outgoingdate; trailerEntry.OutgoingCarrier = this._outgoingcarrier; trailerEntry.OutgoingSeal = this._outgoingseal; trailerEntry.OutgoingDriverName = this._outgoingdrivername; trailerEntry.MovedOut = this._movedout; trailerEntry.Comments = this._comments; ds.TrailerLogTable.AddTrailerLogTableRow(trailerEntry); ds.Merge(this.mTrailerMoves); ds.AcceptChanges(); } catch (Exception) { } return(ds); }
public override bool Update() { //Update this object bool bRet = false; try { DispatchDS ds = new DispatchDS(); ds.Merge(base.mMediator.FillDataset(base.mDataFile, "", null)); DispatchDS.ClientInboundTableRow row = (DispatchDS.ClientInboundTableRow)ds.ClientInboundTable.Select("ID = " + this._id)[0]; row.VendorName = this._vendorname; row.ConsigneeName = this._consigneename; if (this._etatime != DateTime.MinValue) { row.ETATime = this._etatime; } row.DriverName = this._drivername; row.TrailerNumber = this._trailernumber; row.Amount = this._amount; row.AmountType = this._amounttype; row.FreightType = this._freighttype; row.Comments = this._comments; row.In = this._in; ds.ClientInboundTable.AcceptChanges(); bRet = base.mMediator.ExecuteNonQuery(base.mDataFile, new object[] { ds }); bRet = true; base.OnEntryChanged(this, new EventArgs()); } catch (Exception ex) { throw ex; } return(bRet); }
public override bool Create() { //Save this object bool bRet = false; try { DispatchDS ds = new DispatchDS(); ds.Merge(base.mMediator.FillDataset(base.mDataFile, "", null)); if (this._id <= 0) { //For new entries only; some entries are moved between schedules int ID = 0; for (int i = 0; i < ds.LineHaulTable.Rows.Count; i++) { if (ds.LineHaulTable[i].ID > ID) { ID = ds.LineHaulTable[i].ID; } } this._id = ID + 1; } ds.LineHaulTable.AddLineHaulTableRow(this._id, this._created, this._createdby, this._trailernumber, this._terminal, this._scheduledarrival, this._actualarrival, this._comments); ds.LineHaulTable.AcceptChanges(); bRet = base.mMediator.ExecuteNonQuery(base.mDataFile, new object[] { ds }); bRet = true; base.OnEntryChanged(this, new EventArgs()); } catch (Exception ex) { throw ex; } return(bRet); }
public override bool Create() { //Save this object bool bRet = false; try { DispatchDS ds = new DispatchDS(); ds.Merge(base.mMediator.FillDataset(base.mDataFile, "", null)); if (this._id <= 0) { //For new entries only; some entries are moved between schedules int ID = 0; for (int i = 0; i < ds.ScheduledOutboundTable.Rows.Count; i++) { if (ds.ScheduledOutboundTable[i].ID > ID) { ID = ds.ScheduledOutboundTable[i].ID; } } this._id = ID + 1; } DispatchDS.ScheduledOutboundTableRow row = ds.ScheduledOutboundTable.NewScheduledOutboundTableRow(); row.ID = this._id; row.Created = this._created; row.CreatedBy = this._createdby; row.DriverName = this._drivername; row.TrailerNumber = this._trailernumber; row.FromLocation = this._fromlocation; row.ToLocation = this._tolocation; if (this._scheduleddeparture != DateTime.MinValue) { row.ScheduledDeparture = this._scheduleddeparture; } if (this._actualdeparture != DateTime.MinValue) { row.ActualDeparture = this._actualdeparture; } if (this._scheduleddelivery != DateTime.MinValue) { row.ScheduledDelivery = this._scheduleddelivery; } if (this._actualdelivery != DateTime.MinValue) { row.ActualDelivery = this._actualdelivery; } row.Comments = this._comments; row.Confirmed = this._confirmed; ds.ScheduledOutboundTable.AddScheduledOutboundTableRow(row); ds.ScheduledOutboundTable.AcceptChanges(); bRet = base.mMediator.ExecuteNonQuery(base.mDataFile, new object[] { ds }); bRet = true; base.OnEntryChanged(this, new EventArgs()); } catch (Exception ex) { throw ex; } return(bRet); }
public override bool Create() { //Save this object bool bRet = false; try { DispatchDS ds = new DispatchDS(); ds.Merge(base.mMediator.FillDataset(base.mDataFile, "", null)); if (this._id <= 0) { //For new entries only; some entries are moved between schedules int ID = 0; for (int i = 0; i < ds.PickupLogTable.Rows.Count; i++) { if (ds.PickupLogTable[i].ID > ID) { ID = ds.PickupLogTable[i].ID; } } this._id = ID + 1; } DispatchDS.PickupLogTableRow row = ds.PickupLogTable.NewPickupLogTableRow(); row.ID = this._id; row.Created = this._created; row.CreatedBy = this._createdby; row.CallerName = this._callername; row.ClientName = this._clientname; row.ShipperName = this._shippername; row.ShipperAddress = this._shipperaddress; row.DeliveryWindow = this._deliverywindow; row.Terminal = this._terminal; row.DriverName = this._drivername; row.Amount = this._amount; row.AmountType = this._amounttype; row.FreightType = this._freighttype; row.AutoNumber = this._autonumber; row.RequestDate = this._requestdate; if (this._pickupdate != DateTime.MinValue) { row.PickUpDate = this._pickupdate; } row.Comments = this._comments; row.Updated = this._updated; row.MustBeReady = this._mustbeready; row.PickedUp = this._pickedup; ds.PickupLogTable.AddPickupLogTableRow(this._id, this._created, this._createdby, this._callername, this._clientname, this._shippername, this._shipperaddress, this._deliverywindow, this._terminal, this._drivername, this._amount, this._amounttype, this._freighttype, this._autonumber, this._requestdate, this._pickupdate, this._comments, this._updated, this._mustbeready, this._pickedup); ds.PickupLogTable.AcceptChanges(); bRet = base.mMediator.ExecuteNonQuery(base.mDataFile, new object[] { ds }); base.OnEntryChanged(this, new EventArgs()); } catch (Exception ex) { throw ex; } return(bRet); }
public override bool Create() { //Save this object bool bRet = false; try { DispatchDS ds = new DispatchDS(); ds.Merge(base.mMediator.FillDataset(base.mDataFile, "", null)); if (this._id <= 0) { //For new entries only; some entries are moved between schedules int ID = 0; for (int i = 0; i < ds.ClientInboundTable.Rows.Count; i++) { if (ds.ClientInboundTable[i].ID > ID) { ID = ds.ClientInboundTable[i].ID; } } this._id = ID + 1; } DispatchDS.ClientInboundTableRow row = ds.ClientInboundTable.NewClientInboundTableRow(); row.ID = this._id; row.Created = this._created; row.CreatedBy = this._createdby; row.VendorName = this._vendorname; row.ConsigneeName = this._consigneename; if (this._etatime != DateTime.MinValue) { row.ETATime = this._etatime; } row.DriverName = this._drivername; row.TrailerNumber = this._trailernumber; row.Amount = this._amount; row.AmountType = this._amounttype; row.FreightType = this._freighttype; row.Comments = this._comments; row.In = this._in; ds.ClientInboundTable.AddClientInboundTableRow(row); ds.ClientInboundTable.AcceptChanges(); bRet = base.mMediator.ExecuteNonQuery(base.mDataFile, new object[] { ds }); bRet = true; base.OnEntryChanged(this, new EventArgs()); } catch (Exception ex) { throw ex; } return(bRet); }
public override bool Delete() { //Delete this object bool bRet = false; try { DispatchDS ds = new DispatchDS(); ds.Merge(base.mMediator.FillDataset(base.mDataFile, "", null)); DispatchDS.PickupLogTableRow row = (DispatchDS.PickupLogTableRow)ds.PickupLogTable.Select("ID = " + this._id)[0]; row.Delete(); ds.PickupLogTable.AcceptChanges(); bRet = base.mMediator.ExecuteNonQuery(base.mDataFile, new object[] { ds }); base.OnEntryChanged(this, new EventArgs()); } catch (Exception ex) { throw ex; } return(bRet); }
public void CopyToFolder() { //Copy the selected entries to another schedule dlgMoveEntry dlgCopyTo = new dlgMoveEntry(); if (dlgCopyTo.ShowDialog(this) == DialogResult.OK) { //Package data DispatchDS ds = new DispatchDS(); for (int i = 0; i < this.grdSchedule.Selected.Rows.Count; i++) { int ID = Convert.ToInt32(this.grdSchedule.Selected.Rows[i].Cells["ID"].Value); ScheduleEntry entry = this.mSchedule.Item(ID); ds.Merge(entry.ToDataSet()); } //Get destination schedule and copy data DispatchSchedule schedule = dlgCopyTo.Schedule; schedule.AddList(ds); } }
public override bool Update() { //Update this object bool bRet = false; try { DispatchDS ds = new DispatchDS(); ds.Merge(base.mMediator.FillDataset(base.mDataFile, "", null)); DispatchDS.ScheduledOutboundTableRow row = (DispatchDS.ScheduledOutboundTableRow)ds.ScheduledOutboundTable.Select("ID = " + this._id)[0]; row.DriverName = this._drivername; row.TrailerNumber = this._trailernumber; row.FromLocation = this._fromlocation; row.ToLocation = this._tolocation; if (this._scheduleddeparture != DateTime.MinValue) { row.ScheduledDeparture = this._scheduleddeparture; } if (this._actualdeparture != DateTime.MinValue) { row.ActualDeparture = this._actualdeparture; } if (this._scheduleddelivery != DateTime.MinValue) { row.ScheduledDelivery = this._scheduleddelivery; } if (this._actualdelivery != DateTime.MinValue) { row.ActualDelivery = this._actualdelivery; } row.Comments = this._comments; row.Confirmed = this._confirmed; ds.ScheduledOutboundTable.AcceptChanges(); bRet = base.mMediator.ExecuteNonQuery(base.mDataFile, new object[] { ds }); bRet = true; base.OnEntryChanged(this, new EventArgs()); } catch (Exception ex) { throw ex; } return(bRet); }
public override bool Update() { //Update this object bool bRet = false; try { DispatchDS ds = new DispatchDS(); ds.Merge(base.mMediator.FillDataset(base.mDataFile, "", null)); DispatchDS.LineHaulTableRow row = (DispatchDS.LineHaulTableRow)ds.LineHaulTable.Select("ID = " + this._id)[0]; row.TrailerNumber = this._trailernumber; row.Terminal = this._terminal; row.ScheduledArrival = this._scheduledarrival; row.ActualArrival = this._actualarrival; row.Comments = this._comments; ds.LineHaulTable.AcceptChanges(); bRet = base.mMediator.ExecuteNonQuery(base.mDataFile, new object[] { ds }); bRet = true; base.OnEntryChanged(this, new EventArgs()); } catch (Exception ex) { throw ex; } return(bRet); }
public override bool Update() { //Update this object bool bRet = false; try { DispatchDS ds = new DispatchDS(); ds.Merge(base.mMediator.FillDataset(base.mDataFile, "", null)); DispatchDS.PickupLogTableRow row = (DispatchDS.PickupLogTableRow)ds.PickupLogTable.Select("ID = " + this._id)[0]; row.CallerName = this._callername; row.ClientName = this._clientname; row.ShipperName = this._shippername; row.ShipperAddress = this._shipperaddress; row.DeliveryWindow = this._deliverywindow; row.Terminal = this._terminal; row.DriverName = this._drivername; row.Amount = this._amount; row.AmountType = this._amounttype; row.FreightType = this._freighttype; row.AutoNumber = this._autonumber; row.RequestDate = this._requestdate; if (this._pickupdate != DateTime.MinValue) { row.PickUpDate = this._pickupdate; } row.Comments = this._comments; row.Updated = this._updated; row.MustBeReady = this._mustbeready; row.PickedUp = this._pickedup; ds.PickupLogTable.AcceptChanges(); bRet = base.mMediator.ExecuteNonQuery(base.mDataFile, new object[] { ds }); base.OnEntryChanged(this, new EventArgs()); } catch (Exception ex) { throw ex; } return(bRet); }
private void OnDragDropMouseMove(object sender, System.Windows.Forms.MouseEventArgs e) { //Start drag\drop if user is dragging DataObject oData = null; try { switch (e.Button) { case MouseButtons.Left: if (this.mIsDragging) { //Initiate drag drop operation from this schedule DispatchDS ds = new DispatchDS(); for (int i = 0; i < this.grdSchedule.Selected.Rows.Count; i++) { int ID = Convert.ToInt32(this.grdSchedule.Selected.Rows[i].Cells["ID"].Value); ScheduleEntry entry = this.mSchedule.Item(ID); ds.Merge(entry.ToDataSet()); } oData = new DataObject(); oData.SetData(ds); DragDropEffects effect = this.grdSchedule.DoDragDrop(oData, DragDropEffects.All); //After the drop- remove from this schedule on move switch (effect) { case DragDropEffects.Move: this.mSchedule.RemoveList(ds); break; case DragDropEffects.Copy: break; } } break; } } catch (Exception ex) { reportError(ex); } }
public override bool Delete() { //Delete this object and all child objects bool bRet = false; try { DispatchDS ds = new DispatchDS(); ds.Merge(base.mMediator.FillDataset(base.mDataFile, "", null)); DispatchDS.TrailerLogTableRow row = (DispatchDS.TrailerLogTableRow)ds.TrailerLogTable.Select("ID = " + this._id)[0]; row.Delete(); for (int i = 0; i < this.mTrailerMoves.TrailerMoveTable.Rows.Count; i++) { DispatchDS.TrailerMoveTableRow _row = (DispatchDS.TrailerMoveTableRow)ds.TrailerMoveTable.Select("ID = " + this.mTrailerMoves.TrailerMoveTable[i].ID)[0]; _row.Delete(); } ds.TrailerMoveTable.AcceptChanges(); ds.TrailerLogTable.AcceptChanges(); bRet = base.mMediator.ExecuteNonQuery(base.mDataFile, new object[] { ds }); bRet = true; base.OnEntryChanged(this, new EventArgs()); } catch (Exception ex) { throw ex; } return(bRet); }
public override bool Update() { //Update this object and all child objects bool bRet = false; try { DispatchDS ds = new DispatchDS(); ds.Merge(base.mMediator.FillDataset(base.mDataFile, "", null)); DispatchDS.TrailerLogTableRow row = (DispatchDS.TrailerLogTableRow)ds.TrailerLogTable.Select("ID = " + this._id)[0]; row.Created = this._created; row.CreatedBy = this._createdby; row.TrailerNumber = this._trailernumber; row.IncomingDate = this._incomingdate; row.IncomingCarrier = this._incomingcarrier; row.IncomingSeal = this._incomingseal; row.IncomingDriverName = this._incomingdrivername; row.InitialYardLocation = this._initialyardlocation; row.LoadSheetReady = this._loadsheetready; row.MoveInProgress = this._moveinprogress; row.OutgoingDate = this._outgoingdate; row.OutgoingCarrier = this._outgoingcarrier; row.OutgoingSeal = this._outgoingseal; row.OutgoingDriverName = this._outgoingdrivername; row.MovedOut = this._movedout; row.Comments = this._comments; for (int i = 0; i < this.mTrailerMoves.TrailerMoveTable.Rows.Count; i++) { DispatchDS.TrailerMoveTableRow _row = (DispatchDS.TrailerMoveTableRow) this.mTrailerMoves.TrailerMoveTable[i]; if (_row.RowState == DataRowState.Added) { DispatchDS.TrailerMoveTableRow __row = (DispatchDS.TrailerMoveTableRow)ds.TrailerMoveTable.NewTrailerMoveTableRow(); __row.ID = _row.ID; __row.Requested = _row.Requested; __row.RequestedBy = _row.RequestedBy; if (!_row.IsMoveFromNull()) { __row.MoveFrom = _row.MoveFrom; } if (!_row.IsMoveToNull()) { __row.MoveTo = _row.MoveTo; } if (!_row.IsSwitcherNull()) { __row.Switcher = _row.Switcher; } if (!_row.IsLoadedWithNull()) { __row.LoadedWith = _row.LoadedWith; } if (!_row.IsScheduledTimeNull()) { __row.ScheduledTime = _row.ScheduledTime; } if (!_row.IsActualTimeNull()) { __row.ActualTime = _row.ActualTime; } __row.TrailerLogTableRow = row; ds.TrailerMoveTable.AddTrailerMoveTableRow(__row); } else if (_row.RowState == DataRowState.Modified) { DispatchDS.TrailerMoveTableRow __row = (DispatchDS.TrailerMoveTableRow)ds.TrailerMoveTable.Select("ID = " + _row.ID)[0]; if (!_row.IsMoveFromNull()) { __row.MoveFrom = _row.MoveFrom; } if (!_row.IsMoveToNull()) { __row.MoveTo = _row.MoveTo; } if (!_row.IsSwitcherNull()) { __row.Switcher = _row.Switcher; } if (!_row.IsLoadedWithNull()) { __row.LoadedWith = _row.LoadedWith; } if (!_row.IsScheduledTimeNull()) { __row.ScheduledTime = _row.ScheduledTime; } if (!_row.IsActualTimeNull()) { __row.ActualTime = _row.ActualTime; } } else if (_row.RowState == DataRowState.Deleted) { DispatchDS.TrailerMoveTableRow __row = (DispatchDS.TrailerMoveTableRow)ds.TrailerMoveTable.Select("ID = " + _row.ID)[0]; __row.Delete(); } } ds.TrailerMoveTable.AcceptChanges(); ds.TrailerLogTable.AcceptChanges(); bRet = base.mMediator.ExecuteNonQuery(base.mDataFile, new object[] { ds }); bRet = true; base.OnEntryChanged(this, new EventArgs()); } catch (Exception ex) { throw ex; } return(bRet); }
public override bool Create() { //Save this object and all child objects bool bRet = false; try { DispatchDS ds = new DispatchDS(); ds.Merge(base.mMediator.FillDataset(base.mDataFile, "", null)); if (this._id <= 0) { //For new entries only; some entries are moved between schedules int ID = 0; for (int i = 0; i < ds.TrailerLogTable.Rows.Count; i++) { if (ds.TrailerLogTable[i].ID > ID) { ID = ds.TrailerLogTable[i].ID; } } this._id = ID + 1; } DispatchDS.TrailerLogTableRow row = ds.TrailerLogTable.AddTrailerLogTableRow(this._id, this._created, this._createdby, this._trailernumber, this._incomingdate, this._incomingcarrier, this._incomingseal, this._incomingdrivername, this._initialyardlocation, this._loadsheetready, this._moveinprogress, this._outgoingdate, this._outgoingcarrier, this._outgoingseal, this._outgoingdrivername, this._movedout, this._comments); for (int i = 0; i < this.mTrailerMoves.TrailerMoveTable.Rows.Count; i++) { DispatchDS.TrailerMoveTableRow _row = (DispatchDS.TrailerMoveTableRow) this.mTrailerMoves.TrailerMoveTable[i]; DispatchDS.TrailerMoveTableRow __row = (DispatchDS.TrailerMoveTableRow)ds.TrailerMoveTable.NewTrailerMoveTableRow(); __row.ID = _row.ID; __row.Requested = _row.Requested; __row.RequestedBy = _row.RequestedBy; if (!_row.IsMoveFromNull()) { __row.MoveFrom = _row.MoveFrom; } if (!_row.IsMoveToNull()) { __row.MoveTo = _row.MoveTo; } if (!_row.IsSwitcherNull()) { __row.Switcher = _row.Switcher; } if (!_row.IsLoadedWithNull()) { __row.LoadedWith = _row.LoadedWith; } if (!_row.IsScheduledTimeNull()) { __row.ScheduledTime = _row.ScheduledTime; } if (!_row.IsActualTimeNull()) { __row.ActualTime = _row.ActualTime; } __row.TrailerLogTableRow = row; ds.TrailerMoveTable.AddTrailerMoveTableRow(__row); } ds.TrailerMoveTable.AcceptChanges(); ds.TrailerLogTable.AcceptChanges(); bRet = base.mMediator.ExecuteNonQuery(base.mDataFile, new object[] { ds }); bRet = true; base.OnEntryChanged(this, new EventArgs()); } catch (Exception ex) { throw ex; } return(bRet); }