예제 #1
0
        public Model.SalesOrderItem GetScaleSOItem(int soId, Model.ScaleDetails scaleDetails)
        {
            if (scaleDetails == null || scaleDetails.Apply_To_Item == null)
            {
                return(new Model.SalesOrderItem());
            }

            Model.SalesOrderItem item = (from soItem in _repository.GetQuery <Model.SalesOrderItem>()
                                         where soItem.SalesOrder.ID == soId &&
                                         soItem.Item.ID == scaleDetails.Apply_To_Item.ID
                                         select soItem).FirstOrDefault();
            return(item);
        }
예제 #2
0
        public Model.PurchaseOrderItem GetScalePOItem(int poId, Model.ScaleDetails scaleDetails)
        {
            if (scaleDetails == null || scaleDetails.Apply_To_Item == null)
            {
                return(null);
            }

            Model.PurchaseOrderItem item = (from poItem in _repository.GetQuery <Model.PurchaseOrderItem>()
                                            where poItem.PurchaseOrder.ID == poId &&
                                            poItem.Item.ID == scaleDetails.Item_Received.ID
                                            select poItem).FirstOrDefault();
            return(item);
        }
예제 #3
0
        private decimal GetSOItemUOMWeight(Model.ScaleDetails scaleDetail, string uom)
        {
            if (scaleDetail == null || scaleDetail.Scale == null)
            {
                return(0);
            }

            decimal soItemUOMWeight = scaleDetail.Scale.Net_Weight;

            if (uom != null && uom.ToLower() != "lbs")
            {
                UOMConversionLibrary uomConvLib = new UOMConversionLibrary(_dbContextConnectionString);
                VModel.UOMConversion uomConv    = uomConvLib.GetByUOM(uom, "LBS");
                if (uomConv != null)
                {
                    soItemUOMWeight = soItemUOMWeight / (decimal)uomConv.Factor;
                }
            }
            soItemUOMWeight = decimal.Round(soItemUOMWeight, 3, MidpointRounding.AwayFromZero);
            return(soItemUOMWeight);
        }