示例#1
0
        public VendorDataset GetVendors(string clientNumber, string clientTerminal)
        {
            //Get a list of vendors
            VendorDataset vendors = null;

            try {
                vendors = new VendorDataset();
                DataSet ds = new DataService().FillDataset(SQL_CONNID, USP_VENDORS, TBL_VENDORS, new object[] { clientNumber, clientTerminal });
                if (ds.Tables[TBL_VENDORS] != null && ds.Tables[TBL_VENDORS].Rows.Count > 0)
                {
                    VendorDataset _vendors = new VendorDataset();
                    _vendors.Merge(ds);
                    for (int i = 0; i < _vendors.VendorTable.Rows.Count; i++)
                    {
                        _vendors.VendorTable.Rows[i]["VendorSummary"] = (!_vendors.VendorTable.Rows[i].IsNull("VendorNumber") ? _vendors.VendorTable.Rows[i]["VendorNumber"].ToString() : "     ") + " - " +
                                                                        (!_vendors.VendorTable.Rows[i].IsNull("VendorName") ? _vendors.VendorTable.Rows[i]["VendorName"].ToString().Trim() : "");
                    }
                    vendors.Merge(_vendors.VendorTable.Select("", "VendorNumber ASC"));
                    vendors.AcceptChanges();
                }
            }
            catch (ApplicationException ex) { throw ex; }
            catch (Exception ex) { throw new ApplicationException(ex.Message, ex); }
            return(vendors);
        }
示例#2
0
        public ShipperDataset GetShippers(FreightType freightType, string clientNumber, string clientTerminal)
        {
            //Get a list of shippers
            ShipperDataset shippers = null;

            try {
                shippers = new ShipperDataset();
                if (freightType == FreightType.Regular)
                {
                    VendorDataset vendors = GetVendors(clientNumber, clientTerminal);
                    shippers = new ShipperDataset();
                    for (int i = 0; i < vendors.VendorTable.Rows.Count; i++)
                    {
                        shippers.ShipperTable.AddShipperTableRow(vendors.VendorTable[i].VendorNumber, vendors.VendorTable[i].VendorName, vendors.VendorTable[i].VendorParentNumber, vendors.VendorTable[i].VendorSummary);
                    }
                    shippers.AcceptChanges();
                }
                else if (freightType == FreightType.Returns)
                {
                    AgentDataset   agents    = GetAgents(false);
                    ShipperDataset _shippers = new ShipperDataset();
                    for (int i = 0; i < agents.AgentTable.Rows.Count; i++)
                    {
                        _shippers.ShipperTable.AddShipperTableRow(agents.AgentTable[i].AgentNumber, agents.AgentTable[i].AgentName, agents.AgentTable[i].AgentParentNumber, agents.AgentTable[i].AgentSummary);
                    }
                    shippers.Merge(_shippers.ShipperTable.Select("", "ShipperNumber ASC"));
                    shippers.AcceptChanges();
                }
            }
            catch (ApplicationException ex) { throw ex; }
            catch (Exception ex) { throw new ApplicationException("Unexpected exception creating shipper list.", ex); }
            return(shippers);
        }
示例#3
0
        public VendorDataset GetVendorLocations(string clientNumber, string clientTerminal, string vendorNumber)
        {
            //Get a list of vendor locations (child vendors) for the specified client-vendor
            System.Diagnostics.Debug.WriteLine("GetVendorLocations");
            VendorDataset locs = null;

            try {
                locs = new VendorDataset();
                VendorDataset ds = GetVendors(clientNumber, clientTerminal);
                if (clientNumber != null && vendorNumber != null && ds.VendorTable.Rows.Count > 0)
                {
                    locs.Merge(ds.VendorTable.Select("VendorParentNumber = '" + vendorNumber + "'"));
                }
            }
            catch (ApplicationException ex) { throw ex; }
            catch (Exception ex) { throw new ApplicationException("Unexpected exception creating vendor list.", ex); }
            return(locs);
        }
示例#4
0
        public VendorDataset GetParentVendors(string clientNumber, string clientTerminal)
        {
            //Get a list of parent vendors
            System.Diagnostics.Debug.WriteLine("GetParentVendors");
            VendorDataset vendors = null;

            try {
                vendors = new VendorDataset();
                VendorDataset ds = GetVendors(clientNumber, clientTerminal);
                if (clientNumber != null && ds.VendorTable.Rows.Count > 0)
                {
                    vendors.Merge(ds.VendorTable.Select("VendorParentNumber = ''"));
                    vendors.AcceptChanges();
                }
            }
            catch (ApplicationException ex) { throw ex; }
            catch (Exception ex) { throw new ApplicationException("Unexpected exception creating vendor list.", ex); }
            return(vendors);
        }
示例#5
0
        public VendorDataset GetVendorsList(string clientNumber, string clientTerminal)
        {
            //Get a list of vendors
            VendorDataset vendors = null;

            try {
                vendors = new VendorDataset();
                DataSet ds = FillDataset(USP_VENDORS, TBL_VENDORS, new object[] { clientNumber, clientTerminal });
                if (ds.Tables[TBL_VENDORS] != null && ds.Tables[TBL_VENDORS].Rows.Count > 0)
                {
                    VendorDataset _vendors = new VendorDataset();
                    _vendors.Merge(ds);
                    vendors.Merge(_vendors.VendorTable.Select("", "VendorName ASC"));
                    vendors.AcceptChanges();
                }
            }
            catch (ApplicationException ex) { throw ex; }
            catch (Exception ex) { throw new ApplicationException("Unexpected exception creating vendor list.", ex); }
            return(vendors);
        }