public static int CreateCarrier(CarrierDS carrier)
        {
            //Create a new carrier
            int result = 0;

            try {
                result = (int)Mediator.ExecuteNonQueryWithReturn("uspEnterpriseCarrierNew", new object[] { carrier });
            }
            catch (Exception ex) { throw ex; }
            return(result);
        }
        public static bool UpdateCarrier(CarrierDS carrier)
        {
            //Update an existing carrier
            bool result = false;

            try {
                result = Mediator.ExecuteNonQuery("uspEnterpriseCarrierUpdate", new object[] { carrier });
            }
            catch (Exception ex) { throw ex; }
            return(result);
        }
        public static CarrierDS GetTrailerOwners()
        {
            //Get a list of trailer types
            CarrierDS owners = new CarrierDS();

            try {
                DataSet ds = Mediator.FillDataset("", "CarrierListTable", null);
                if (ds != null)
                {
                    owners.Merge(ds.Tables["CarrierListTable"].Select("", "CarrierName", DataViewRowState.CurrentRows));
                }
            }
            catch (Exception ex) { throw ex; }
            return(owners);
        }
        public static CarrierDS ViewCarriers()
        {
            //Get a list of carriers
            CarrierDS carriers = new CarrierDS();

            try {
                DataSet ds = Mediator.FillDataset("uspEnterpriseCarrierGetList", "CarrierViewTable", null);
                if (ds != null)
                {
                    carriers.Merge(ds.Tables["CarrierViewTable"].Select("", "CarrierName", DataViewRowState.CurrentRows));
                }
            }
            catch (Exception ex) { throw ex; }
            return(carriers);
        }
        public static CarrierDS GetCarrier(int carrierID)
        {
            //Get a new or existing carrier
            CarrierDS carrier = new CarrierDS();

            try {
                if (carrierID == 0)
                {
                    //New
                    CarrierDS.CarrierDetailTableRow row = carrier.CarrierDetailTable.NewCarrierDetailTableRow();
                    row.CarrierID       = carrierID;
                    row.Number          = "";
                    row.CarrierName     = "";
                    row.Phone           = "";
                    row.Extension       = "";
                    row.AddressLine1    = "";
                    row.AddressLine2    = "";
                    row.City            = "";
                    row.StateOrProvince = "NJ";
                    row.PostalCode      = "";
                    row.CountryID       = 1;
                    row.ContactName     = "";
                    row.Fax             = "";
                    row.Email           = "";
                    row.ControlDrivers  = false;
                    row.ControlTrailers = false;
                    row.SCAC            = "";
                    row.IsActive        = true;
                    row.LastUpdated     = DateTime.Now;
                    row.UserID          = System.Environment.UserName;
                    row.RowVersion      = "";
                    carrier.CarrierDetailTable.AddCarrierDetailTableRow(row);
                }
                else
                {
                    //Existing
                    DataSet ds = Mediator.FillDataset("uspEnterpriseCarrierGet", "CarrierDetailTable", new object[] { carrierID });
                    if (ds != null)
                    {
                        carrier.Merge(ds, true, MissingSchemaAction.Ignore);
                    }
                }
            }
            catch (Exception ex) { throw ex; }
            return(carrier);
        }
Beispiel #6
0
        //Interface
        public dlgCarrierDetail(ref CarrierDS carrier)
        {
            //Constructor
            try {
                //Required designer support
                InitializeComponent();
                this.btnOk.Text     = CMD_OK;
                this.btnCancel.Text = CMD_CANCEL;

                //Set mediator service, data, and titlebar caption
                this.mCarriersDS = carrier;
                if (this.mCarriersDS.CarrierDetailTable.Count > 0)
                {
                    this.mCarrierID = this.mCarriersDS.CarrierDetailTable[0].CarrierID;
                    this.Text       = (this.mCarrierID > 0) ? "Carrier (" + this.mCarrierID + ")" : "Carrier (New)";
                }
                else
                {
                    this.Text = "Carrier (Data Unavailable)";
                }
            }
            catch (Exception ex) { throw ex; }
        }