Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
        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);
        }