Example #1
0
        public static TrailerDS GetTrailer(int trailerID)
        {
            //Get a new or existing trailer
            TrailerDS trailer = new TrailerDS();

            try {
                if (trailerID == 0)
                {
                    //New
                    Transportation.TrailerDS.TrailerDetailTableRow row = trailer.TrailerDetailTable.NewTrailerDetailTableRow();
                    row.TrailerID = trailerID;
                    row.Number    = "";
                    //row.DefinitionID = 0;
                    row.LicPlateNumber = "";
                    //row.CarrierID = 0;
                    row.IsStorage   = false;
                    row.IsActive    = true;
                    row.LastUpdated = DateTime.Now;
                    row.UserID      = System.Environment.UserName;
                    row.RowVersion  = "";
                    trailer.TrailerDetailTable.AddTrailerDetailTableRow(row);
                }
                else
                {
                    //Existing
                    DataSet ds = Mediator.FillDataset("", "TrailerDetailTable", new object[] { trailerID });
                    if (ds != null)
                    {
                        trailer.Merge(ds);
                    }
                }
            }
            catch (Exception ex) { throw ex; }
            return(trailer);
        }
Example #2
0
        public static TrailerDS ViewTrailers()
        {
            //Get a list of trailers
            TrailerDS trailers = new TrailerDS();

            try {
                DataSet ds = Mediator.FillDataset("", "TrailerListTable", null);
                if (ds != null)
                {
                    trailers.Merge(ds.Tables["TrailerListTable"].Select("", "Number", DataViewRowState.CurrentRows));
                }
            }
            catch (Exception ex) { throw ex; }
            return(trailers);
        }