本文整理汇总了C#中OrderDetail.Rewind方法的典型用法代码示例。如果您正苦于以下问题:C# OrderDetail.Rewind方法的具体用法?C# OrderDetail.Rewind怎么用?C# OrderDetail.Rewind使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OrderDetail
的用法示例。
在下文中一共展示了OrderDetail.Rewind方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SaveBackOrderToDatabase
//~ This Method is Obsoleted ~//
public static bool SaveBackOrderToDatabase(BLL.Order _order)
{
var _orderDetail = new OrderDetail();
_orderDetail.LoadAllByOrderID(_order.ID);
MyGeneration.dOOdads.TransactionMgr mgr = MyGeneration.dOOdads.TransactionMgr.ThreadTransactionMgr();
try
{
mgr.BeginTransaction();
var or = new BLL.Order();
or.AddNew();
or.RefNo = Order.GetNextOrderReference();
or.SetColumn("OrderTypeID", _order.GetColumn("OrderTypeID"));
or.SetColumn("HCTSReferenceID", _order.GetColumn("HCTSReferenceID"));
or.OrderStatusID = OrderStatus.Constant.DRAFT_WISHLIST;
or.RequisitionTypeID = RequisitionType.CONSTANTS.DEMAND;
or.Remark = _order.ID.ToString(); //Store the Original ID here for the backorder. We need to have a standard way of marking backorders.
or.EurDate = or.Date = DateTimeHelper.ServerDateTime; //Both fields are assigned dates.
or.RequestedBy = _order.RequestedBy;
or.FilledBy = _order.FilledBy;
or.LetterNo = _order.LetterNo;
or.PaymentTypeID = _order.PaymentTypeID;
or.ContactPerson = _order.ContactPerson;
or.FromStore = _order.FromStore;
or.FiscalYearID = FiscalYear.Current.ID;
or.OrderTypeID = _order.OrderTypeID == OrderType.CONSTANTS.PLITS
? _order.OrderTypeID
: OrderType.CONSTANTS.BACK_ORDER;
or.Save();
or.LogRequisitionStatus(or.ID,null,OrderStatus.Constant.DRAFT_WISHLIST,CurrentContext.UserId);
_orderDetail.Rewind();
var orderDetail = new OrderDetail();
while (!_orderDetail.EOF)
{
if (_orderDetail.ApprovedQuantity >= _orderDetail.Quantity)
{
_orderDetail.MoveNext();
continue; //Backorder is only for those with approved quantity less than the requested quantity.
}
orderDetail.AddNew();
orderDetail.ItemID = _orderDetail.ItemID;
orderDetail.OrderID = or.ID;
orderDetail.Pack = (_orderDetail.Quantity - _orderDetail.ApprovedQuantity) /
_orderDetail.QtyPerPack;
orderDetail.QtyPerPack = _orderDetail.QtyPerPack;
orderDetail.Quantity = orderDetail.Pack * orderDetail.QtyPerPack;
orderDetail.SetColumn("HACTOrderDetailID", _orderDetail.GetColumn("HACTOrderDetailID"));
orderDetail.UnitID = _orderDetail.UnitID;
_orderDetail.MoveNext();
}
orderDetail.Save();
mgr.CommitTransaction();
return true;
}
catch (Exception exp)
{
mgr.RollbackTransaction();
return false;
}
}