public SupplyOrderItem SetOrderItem(Product product, decimal quantity) { if (this.IsNew) { this.Save(); } var orderItem = this.Items.Contains(product) ? this.Items.Find(product) : new SupplyOrderItem(this); orderItem.Product = product; orderItem.Quantity += quantity; orderItem.Save(); this.Reset(); return orderItem; }
private object GetProductModel(Product o, bool includeEquivalents = true) { return new { id = o.Id, category = o.ProductTerm.Category, subcategory = o.ProductTerm.Subcategory, productTerm = o.ProductTerm, manufacturer = o.Manufacturer, brand = o.Brand, partNumber = o.ProductCode, name = o.Name, searchTags = o.SearchTags, description = o.Description, notes = o.Notes, presentationUnit = o.PresentationUnit, contentQty = o.ContentQty, contentUnit = o.ContentUnit, startDate = o.StartDate, lastUpdated = o.LastUpdated, manager = o.ProductManager, baseProductId = o.BaseProduct.Id }; }
protected override void OnLoadObjectData(DataRow row) { supplyPoint = Contact.Parse((int) row["SupplyPointId"]); kind = StorageUnitKind.Parse((int) row["StorageUnitKindId"]); storageUnitClass = (StorageUnitClass) Convert.ToChar(row["StorageUnitClass"]); code = (string) row["StorageUnitCode"]; fullCode = (string) row["StorageUnitDescription"]; description = (string) row["StorageUnitDescription"]; areaId = (int) row["AreaId"]; rowId = (int) row["RowId"]; aisleId = (int) row["AisleId"]; binId = (int) row["BinId"]; binSideId = (int) row["BinSideId"]; binLevelId = (int) row["BinLevelId"]; binColumnId = (int) row["BinColumnId"]; cubeId = (int) row["CubeId"]; product = Product.Parse((int) row["ProductId"]); monthlyCost = (decimal) row["MonthlyCost"]; length = (decimal) row["StorageLength"]; height = (decimal) row["StorageHeight"]; width = (decimal) row["StorageWidth"]; sizeUnit = Unit.Parse((int) row["StorageSizeUnitId"]); weight = (decimal) row["StorageWeight"]; weightUnit = Unit.Parse((int) row["StorageWeightUnitId"]); //keywords = (string) row[""]; parentId = (int) row["ParentStorageUnitId"]; postedBy = Contact.Parse((int) row["PostedById"]); postingTime = (DateTime) row["PostingTime"]; status = (GeneralObjectStatus) Convert.ToChar(row["StorageUnitStatus"]); }
protected override void OnLoadObjectData(DataRow row) { this.order = SupplyOrder.Parse((int) row["SupplyOrderId"]); this.orderItemTypeId = (int) row["SupplyOrderItemTypeId"]; this.supplyPoint = Contact.Parse((int) row["ItemSupplyPointId"]); this.concept = (string) row["SupplyOrderItemConcept"]; this.applicationItemTypeId = (int) row["ApplicationItemTypeId"]; this.applicationItemId = (int) row["ApplicationItemId"]; this.commissioner = Person.Parse((int) row["CommissionerId"]); this.requestedDate = (DateTime) row["RequestedDate"]; this.promisedDate = (DateTime) row["PromisedDate"]; this.deliveryTime = (DateTime) row["DeliveryTime"]; if (this.order.Status == OrderStatus.Opened) { this.product = BaseObject.ParseFull<Product>((int) row["ProductId"]); } else { this.product = Product.Parse((int) row["ProductId"]); } this.quantity = (decimal) row["Quantity"]; this.presentationUnit = PresentationUnit.Parse((int) row["PresentationId"]); this.identificationTag = (string) row["IdentificationTag"]; this.dutyEntryTag = (string) row["DutyEntryTag"]; this.expirationDate = (DateTime) row["ExpirationDate"]; this.priceRuleId = (int) row["PriceRuleId"]; this.priceType = (PriceType) Convert.ToChar(row["PriceType"]); this.discountRuleId = (int) row["DiscountRuleId"]; this.discountType = (PriceType) Convert.ToChar(row["DiscountType"]); this.unitRepositionValue = (decimal) row["RepositionValue"]; this.productUnitPrice = (decimal) row["ProductUnitPrice"]; this.currency = Currency.Parse((int) row["BaseCurrencyId"]); this.productSubTotalInBaseCurrency = (decimal) row["ProductSubtotalBaseCurrency"]; this.productSubTotal = (decimal) row["ProductSubtotal"]; this.productDiscount = (decimal) row["ProductDiscount"]; this.productTaxes = (decimal) row["ProductTaxes"]; this.productTotal = (decimal) row["ProductTotal"]; this.shippingSubTotal = (decimal) row["ShippingSubtotal"]; this.shippingDiscount = (decimal) row["ShippingDiscount"]; this.shippingTaxes = (decimal) row["ShippingTaxes"]; this.shippingTotal = (decimal) row["ShippingTotal"]; this.priceAuthorizationId = (int) row["PriceAuthorizationId"]; this.keywords = (string) row["SupplyOrderItemKeywords"]; this.parentItemId = (int) row["ParentSupplyOrderItemId"]; this.postedBy = Contact.Parse((int) row["PostedById"]); this.postingTime = (DateTime) row["PostingTime"]; this.status = (OrderStatus) Convert.ToChar(row["SupplyOrderItemStatus"]); }
protected override void OnLoadObjectData(DataRow row) { this.order = WarehouseOrder.Parse((int) row["WarehouseOrderId"]); this.orderItemTypeId = (int) row["WarehouseOrderItemTypeId"]; this.concept = (string) row["WarehouseOrderItemConcept"]; this.applicationItemTypeId = (int) row["ApplicationItemTypeId"]; this.applicationItemId = (int) row["ApplicationItemId"]; this.requestedDate = (DateTime) row["RequestedDate"]; this.promisedDate = (DateTime) row["PromisedDate"]; this.deliveryTime = (DateTime) row["DeliveryTime"]; this.product = Product.Parse((int) row["ProductId"]); this.quantity = (decimal) row["Quantity"]; this.expectedQuantity = (decimal) row["ExpectedQuantity"]; this.inputQuantity = (decimal) row["InputQuantity"]; this.outputQuantity = (decimal) row["OutputQuantity"]; this.errorsCount = (int) row["ErrorsCount"]; this.presentationUnit = PresentationUnit.Parse((int) row["PresentationId"]); this.contentsQty = (decimal) row["ContentsQty"]; this.contentsUnit = PresentationUnit.Parse((int) row["ContentsUnitId"]); this.identificationTag = (string) row["IdentificationTag"]; this.dutyEntryTag = (string) row["DutyEntryTag"]; this.expirationDate = (DateTime) row["ExpirationDate"]; this.repositionValue = (decimal) row["RepositionValue"]; this.binCube = (string) row["BinCube"]; this.responsible = Contact.Parse((int) row["ResponsibleId"]); this.authorizationId = (int) row["AuthorizationId"]; this.keywords = (string) row["WarehouseOrderItemKeywords"]; this.parentWarehouseOrderItemId = (int) row["ParentWarehouseOrderItemId"]; this.supplyOrderItemId = (int) row["SupplyOrderItemId"]; this.postedBy = Contact.Parse((int) row["PostedById"]); this.postingTime = (DateTime) row["PostingTime"]; this.status = (GeneralObjectStatus) Convert.ToChar(row["WarehouseOrderItemStatus"]); }