예제 #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);
        }
예제 #2
0
        public static bool UpdateTrailer(TrailerDS trailer)
        {
            //Update an existing trailer
            bool result = false;

            try {
                result = Mediator.ExecuteNonQuery("", new object[] { trailer });
            }
            catch (Exception ex) { throw ex; }
            return(result);
        }
예제 #3
0
        public static int CreateTrailer(TrailerDS trailer)
        {
            //Create a new trailer
            int result = 0;

            try {
                result = (int)Mediator.ExecuteNonQueryWithReturn("", new object[] { trailer });
            }
            catch (Exception ex) { throw ex; }
            return(result);
        }
예제 #4
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);
        }
예제 #5
0
        //Interface
        public dlgTrailerDetail(ref TrailerDS trailer)
        {
            //Constructor
            try {
                //Required designer support
                InitializeComponent();
                this.btnOk.Text     = CMD_OK;
                this.btnCancel.Text = CMD_CANCEL;

                //Set mediator service, data, and titlebar caption
                this.mTrailerDS = trailer;
                if (this.mTrailerDS.TrailerDetailTable.Count > 0)
                {
                    this.mTrailerID = this.mTrailerDS.TrailerDetailTable[0].TrailerID;
                    this.Text       = (this.mTrailerID > 0) ? "Trailer (" + this.mTrailerID + ")" : "Trailer (New)";
                }
                else
                {
                    this.Text = "Trailer (Data Unavailable)";
                }
            }
            catch (Exception ex) { throw ex; }
        }