Ejemplo n.º 1
0
 protected void ODS_TransportationAddress_Inserting(object sender, ObjectDataSourceMethodEventArgs e)
 {
     transportationAddress          = (TransportationAddress)e.InputParameters[0];
     transportationAddress.Country  = transportationAddress.Country.Trim();
     transportationAddress.Province = transportationAddress.Province.Trim();
     transportationAddress.City     = transportationAddress.City.Trim();
     transportationAddress.District = transportationAddress.District.Trim();
     transportationAddress.Address  = transportationAddress.Address.Trim();
 }
 public virtual void DeleteTransportationAddress(TransportationAddress entity)
 {
     Delete(entity);
 }
 public virtual void UpdateTransportationAddress(TransportationAddress entity)
 {
     Update(entity);
 }
 public virtual void CreateTransportationAddress(TransportationAddress entity)
 {
     Create(entity);
 }
        public TransportPriceListDetail GetLastestTransportPriceListDetail(TransportPriceList priceList, Item item, DateTime effectiveDate, Currency currency, Uom uom, string pricingMethod, TransportationAddress shipFrom, TransportationAddress shipTo, string priceListType, string billingMethod, string vehicleType, string transportMethod)
        {
            DetachedCriteria detachedCriteria = DetachedCriteria.For <TransportPriceListDetail>();

            detachedCriteria.Add(Expression.Eq("TransportPriceList.Code", priceList.Code));
            if (item != null)
            {
                detachedCriteria.Add(Expression.Eq("Item.Code", item.Code));
            }
            detachedCriteria.Add(Expression.Eq("Currency.Code", currency.Code));
            if (uom != null)
            {
                detachedCriteria.Add(Expression.Eq("Uom.Code", uom.Code));
            }
            detachedCriteria.Add(Expression.Le("StartDate", effectiveDate));
            detachedCriteria.Add(Expression.Or(Expression.Ge("EndDate", effectiveDate.Date), Expression.IsNull("EndDate")));

            if (pricingMethod != null && pricingMethod != string.Empty)
            {
                detachedCriteria.Add(Expression.Eq("PricingMethod", pricingMethod));
            }
            if (shipFrom != null)
            {
                detachedCriteria.Add(Expression.Eq("ShipFrom.Id", shipFrom.Id));
            }
            if (shipTo != null)
            {
                detachedCriteria.Add(Expression.Eq("ShipTo.Id", shipTo.Id));
            }

            if (billingMethod != null && billingMethod != string.Empty)
            {
                detachedCriteria.Add(Expression.Eq("BillingMethod", billingMethod));
            }

            if (vehicleType != null && vehicleType != string.Empty)
            {
                detachedCriteria.Add(Expression.Eq("VehicleType", vehicleType));
            }
            detachedCriteria.Add(Expression.Eq("Type", priceListType));

            if (transportMethod != null && transportMethod != string.Empty)
            {
                detachedCriteria.Add(Expression.Eq("TransportMethod", transportMethod));
            }

            detachedCriteria.AddOrder(Order.Desc("StartDate")); //按StartDate降序,取最新的价格
            IList <TransportPriceListDetail> priceListDetailList = criteriaMgr.FindAll <TransportPriceListDetail>(detachedCriteria);

            if (priceListDetailList != null && priceListDetailList.Count > 0)
            {
                return(priceListDetailList[0]);
            }
            else
            {
                return(null);
            }
        }
 public TransportPriceListDetail GetLastestTransportPriceListDetail(TransportPriceList priceList, DateTime effectiveDate, Currency currency, string pricingMethod, TransportationAddress shipFrom, TransportationAddress shipTo, string priceListType, string vehicleType, string transportMethod)
 {
     return(GetLastestTransportPriceListDetail(priceList, null, effectiveDate, currency, null, pricingMethod, shipFrom, shipTo, priceListType, null, vehicleType, transportMethod));
 }
        public TransportPriceListDetail GetLastestLadderStereTransportPriceListDetail(TransportPriceList priceList, Item item, DateTime effectiveDate, Currency currency, Uom uom, string pricingMethod, TransportationAddress shipFrom, TransportationAddress shipTo, string priceListType, string billingMethod, string vehicleType, decimal qty)
        {
            TransportPriceListDetail priceListDetail  = null;
            DetachedCriteria         detachedCriteria = DetachedCriteria.For <TransportPriceListDetail>();

            detachedCriteria.Add(Expression.Eq("TransportPriceList.Code", priceList.Code));
            if (item != null)
            {
                detachedCriteria.Add(Expression.Eq("Item.Code", item.Code));
            }
            detachedCriteria.Add(Expression.Eq("Currency.Code", currency.Code));
            if (uom != null)
            {
                detachedCriteria.Add(Expression.Eq("Uom.Code", uom.Code));
            }
            detachedCriteria.Add(Expression.Le("StartDate", effectiveDate));
            detachedCriteria.Add(Expression.Or(Expression.Ge("EndDate", effectiveDate.Date), Expression.IsNull("EndDate")));

            if (pricingMethod != null && pricingMethod != string.Empty)
            {
                detachedCriteria.Add(Expression.Eq("PricingMethod", pricingMethod));
            }
            if (shipFrom != null)
            {
                detachedCriteria.Add(Expression.Eq("ShipFrom.Id", shipFrom.Id));
            }
            if (shipTo != null)
            {
                detachedCriteria.Add(Expression.Eq("ShipTo.Id", shipTo.Id));
            }

            if (billingMethod != null && billingMethod != string.Empty)
            {
                detachedCriteria.Add(Expression.Eq("BillingMethod", billingMethod));
            }

            if (vehicleType != null && vehicleType != string.Empty)
            {
                detachedCriteria.Add(Expression.Eq("VehicleType", vehicleType));
            }
            detachedCriteria.Add(Expression.Eq("Type", priceListType));
            detachedCriteria.Add(Expression.IsNotNull("StartQty"));
            // detachedCriteria.Add(Expression.IsNotNull("EndQty"));

            detachedCriteria.AddOrder(Order.Desc("StartDate")); //按StartDate降序,取最新的价格
            IList <TransportPriceListDetail> priceListDetailList = criteriaMgr.FindAll <TransportPriceListDetail>(detachedCriteria);

            if (priceListDetailList != null && priceListDetailList.Count > 0)
            {
                priceListDetail = priceListDetailList.Where(p => p.StartQty.Value < qty && (p.EndQty == null || p.EndQty.Value >= qty)).FirstOrDefault();

                if (priceListDetail == null)
                {
                    priceListDetail = priceListDetailList.OrderBy(p => p.StartQty.Value).FirstOrDefault();
                }
            }
            return(priceListDetail);
        }