Example #1
0
        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);
        }
Example #2
0
        public override bool Delete()
        {
            //Delete 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.Delete();
                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);
        }