public void SetOrderPartnet(OrderPartner _OrderPartner) { List <OrderPartner> _returnval = this._OrderPartners.OfType <OrderPartner>().Where(o => o.Type == _OrderPartner.Type).ToList(); if (_returnval.Count > 0) { this._OrderPartners.Remove(_returnval[0]); } _OrderPartners.Add(_OrderPartner); }
public static Order CartDetail2Order(List <cart_DETAIL_V2> _CartItems, String _ERPID, String _ORGID, String _Currency) { Order order = new Order(); order.OrderType = SAPOrderType.ZOR; // Set order partner OrderPartner partner = new OrderPartner(); partner.Type = OrderPartnerType.SoldTo; partner.ErpID = _ERPID; // Set Order basic settings order.OrgID = _ORGID; order.SetOrderPartnet(partner); order.Currency = _Currency; order.DistChannel = "10"; order.Division = "00"; // Convert items from cart detail table to order foreach (cart_DETAIL_V2 c in _CartItems) { Product _part = new Product(); _part.PartNumber = c.Part_No; _part.LineNumber = (int)c.Line_No; _part.Quantity = (int)c.Qty; _part.PlantID = c.Delivery_Plant; _part.UnitPrice = (decimal)c.Unit_Price; _part.ListPrice = (decimal)c.List_Price; switch ((int)c.otype) { // case -1 means BTOS parent case -1: _part.LineItemType = LineItemType.BTOSParent; _part.ParentLineNumber = 0; break; // case 0 means Loose item case 0: _part.LineItemType = LineItemType.LooseItem; _part.ParentLineNumber = 0; break; // case 1 means BTOS child case 1: _part.LineItemType = LineItemType.BTOSChild; _part.ParentLineNumber = (int)c.higherLevel; break; } order.LineItems.Add(_part); } return(order); }
public static Order QuoteDetail2Order(List <QuotationDetail> _QuoteDetails, String _ERPID, String _ORGID, String _Currency) { Order order = new Order(); order.OrderType = SAPOrderType.ZOR; // Set order partner OrderPartner partner = new OrderPartner(); partner.Type = OrderPartnerType.SoldTo; partner.ErpID = _ERPID; // Set Order basic settings order.OrgID = _ORGID; order.SetOrderPartnet(partner); order.Currency = _Currency; order.DistChannel = "10"; order.Division = "00"; // Convert items from cart detail table to order foreach (QuotationDetail q in _QuoteDetails) { Product _part = new Product(); _part.PartNumber = q.partNo; _part.LineNumber = (int)q.line_No; _part.Quantity = (int)q.qty; _part.PlantID = q.deliveryPlant; _part.UnitPrice = (decimal)q.newUnitPrice; _part.ListPrice = (decimal)q.listPrice; switch ((int)q.ItemType) { // case -1 means BTOS parent case -1: _part.LineItemType = LineItemType.BTOSParent; _part.ParentLineNumber = 0; break; // case 0 means Loose item case 0: _part.LineItemType = LineItemType.LooseItem; _part.ParentLineNumber = 0; break; // case 1 means BTOS child case 1: _part.LineItemType = LineItemType.BTOSChild; _part.ParentLineNumber = (int)q.HigherLevel; break; } order.LineItems.Add(_part); } return(order); }