本文整理汇总了C#中OrderDetail.Save方法的典型用法代码示例。如果您正苦于以下问题:C# OrderDetail.Save方法的具体用法?C# OrderDetail.Save怎么用?C# OrderDetail.Save使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OrderDetail
的用法示例。
在下文中一共展示了OrderDetail.Save方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GenerateOrderDetail
public static OrderDetail GenerateOrderDetail(int unitId, int activityId, decimal pack, int orderId,
int qtyPerPack, int itemId)
{
var ord = new OrderDetail();
ord.LoadByItemUnit(orderId,itemId,unitId,activityId);
if (ord.RowCount == 0)
{
ord.AddNew();
ord.OrderID = orderId;
ord.ItemID = itemId;
ord.UnitID = unitId;
ord.StoreID = activityId;
ord.Pack = pack;
ord.QtyPerPack = qtyPerPack;
ord.Quantity = pack*qtyPerPack;
ord.ApprovedQuantity = pack*qtyPerPack;
}
else
{
ord.Pack += pack;
ord.Quantity += pack;
ord.ApprovedQuantity += pack*qtyPerPack;
}
ord.Save();
return ord;
}
示例2: Update
public void Update(int OrderID,int ProductID,decimal UnitPrice,short Quantity,float Discount)
{
OrderDetail item = new OrderDetail();
item.MarkOld();
item.IsLoaded = true;
item.OrderID = OrderID;
item.ProductID = ProductID;
item.UnitPrice = UnitPrice;
item.Quantity = Quantity;
item.Discount = Discount;
item.Save(UserName);
}
示例3: Insert
public void Insert(int OrderID,int ProductID,decimal UnitPrice,short Quantity,float Discount)
{
OrderDetail item = new OrderDetail();
item.OrderID = OrderID;
item.ProductID = ProductID;
item.UnitPrice = UnitPrice;
item.Quantity = Quantity;
item.Discount = Discount;
item.Save(UserName);
}
示例4: ComputeStockCalculationsForAnOrderDetail
/// <summary>
/// Computes the stock calculations for an order detail.
/// </summary>
/// <param name="currentMonth">The current month.</param>
/// <param name="currentYear">The current year.</param>
/// <param name="userID">The user ID.</param>
/// <param name="orderDetail">The order detail.</param>
/// <returns></returns>
public DataRow ComputeStockCalculationsForAnOrderDetail(int currentMonth, int currentYear, int userID, OrderDetail orderDetail)
{
if (!IsOrderDetailTableReady(orderDetail))
{
PrepareOrderDetailTable(orderDetail);
}
int? preferredManufacturer;
int? preferredPhysicalStoreID;
decimal usableStock;
decimal approved;
decimal availableQuantity;
Balance bal = new Balance();
ItemManufacturer imf = new ItemManufacturer();
int? unitid = null;
PriceSettings priceSettings = BLL.Settings.HandleDeliveryNotes ? PriceSettings.BOTH : PriceSettings.PRICED_ONLY;
BLL.Order parentOrder = new Order();
parentOrder.LoadByPrimaryKey(orderDetail.OrderID);
unitid = orderDetail.UnitID;
preferredManufacturer = orderDetail.IsColumnNull("PreferredManufacturerID") ? null : new int?(orderDetail.PreferredManufacturerID);
preferredPhysicalStoreID = orderDetail.IsColumnNull("PreferredPhysicalStoreID") ? null : new int?(orderDetail.PreferredPhysicalStoreID);
if (orderDetail.IsColumnNull("StoreID"))
{
orderDetail.StoreID = BLL.Activity.GetActivityUsingFEFO(this.FromStore, orderDetail.ItemID, orderDetail.UnitID);
orderDetail.Save();
}
Activity storeObject = new Activity();
availableQuantity = storeObject.LoadOptionsForOrderDetail(userID, orderDetail.ID, priceSettings, bal, false, out usableStock, out approved);
orderDetail.SetColumn("AvailableStores", storeObject.DefaultView);
if (storeObject.RowCount == 1)
{
orderDetail.StoreID = storeObject.ID;
// Avoid error if the column IsDeliveryNote doesn't exsit at all.
orderDetail.DeliveryNote = storeObject.DefaultView.Table.Columns.IndexOf("IsDeliveryNote") >= 0 &&
!storeObject.IsColumnNull("IsDeliveryNote") &&
Convert.ToBoolean(storeObject.GetColumn("IsDeliveryNote"));
availableQuantity = Convert.ToDecimal(storeObject.GetColumn("AvailableSKU"));
}
else if (storeObject.RowCount > 1)
{
//TOCLEAN: Lord have mercy.
//
// check if the default activity is selected
// if it has been selected, then do a good job and select it.
storeObject.Rewind();
while (
!storeObject.EOF
&&
(
(
storeObject.ID == orderDetail.StoreID
&& !orderDetail.IsColumnNull("DeliveryNote")
&& orderDetail.DeliveryNote
&& !Convert.ToBoolean(storeObject.GetColumn("IsDeliveryNote"))
)
||
storeObject.ID != orderDetail.StoreID
)
)
{
storeObject.MoveNext();
}
// the selected store is found, don't worry.
if (!storeObject.EOF)
{
availableQuantity = Convert.ToDecimal(storeObject.GetColumn("AvailableSKU"));
}
else
{
// the selected store is not found, please do select the first store.
storeObject.Rewind();
orderDetail.StoreID = storeObject.ID;
orderDetail.DeliveryNote = (storeObject.DefaultView.Table.Columns.IndexOf("IsDeliveryNote") >= 0 &&
!storeObject.IsColumnNull("IsDeliveryNote") &&
Convert.ToBoolean(storeObject.GetColumn("IsDeliveryNote")));
availableQuantity = Convert.ToDecimal(storeObject.GetColumn("AvailableSKU"));
}
}
orderDetail.SetColumn("HasStores", (storeObject.RowCount > 1) ? "*" : "");
// Precaution ... to hide -ve available quantity.
if (availableQuantity < 0)
{
availableQuantity = 0;
//.........这里部分代码省略.........
示例5: SaveOrderToDB
public static Order SaveOrderToDB(int Status, int userID, int? orderID, int facilityID, int paymentType,
int modeID, string remarks, string letterNumber, string contactPerson,
DataView _dvOrderTable)
{
MyGeneration.dOOdads.TransactionMgr mgr = MyGeneration.dOOdads.TransactionMgr.ThreadTransactionMgr();
try
{
mgr.BeginTransaction();
BLL.Order or = new BLL.Order();
if (orderID == null)
{
or.AddNew();
or.RefNo = Order.GetNextOrderReference();
or.OrderTypeID = OrderType.CONSTANTS.STANDARD_ORDER;
or.FiscalYearID = FiscalYear.Current.ID;
}
else
{
or.LoadByPrimaryKey(orderID.Value);
}
var oldOrderStatus = or.IsColumnNull("OrderStatusID") ? (int?)null : or.OrderStatusID;
or.OrderStatusID = Status;
or.RequisitionTypeID = RequisitionType.CONSTANTS.DEMAND;
or.Remark = remarks;
or.EurDate = or.Date = DateTimeHelper.ServerDateTime; //Both fields are assigned dates.
or.RequestedBy = facilityID;
or.FilledBy = userID;
or.LetterNo = letterNumber;
or.PaymentTypeID = paymentType;
or.ContactPerson = contactPerson;
or.FromStore = modeID;
or.Save();
or.LogRequisitionStatus(or.ID, oldOrderStatus, Status, CurrentContext.UserId); //Log OrderStatus Change
// this is a kind of initializing the data table.
OrderDetail ord = new OrderDetail();
foreach (DataRowView r in _dvOrderTable)
{
int itemID = Convert.ToInt32(r["ItemID"]);
int unitID = Convert.ToInt32(r["UnitID"]);
ord.LoadByItemUnit(or.ID, itemID, unitID);
if (ord.RowCount == 0)
{
ord.AddNew();
}
ord.OrderID = or.ID;
ord.ItemID = itemID;
if (r["Pack"] != DBNull.Value)
{
ord.Pack = Convert.ToDecimal(r["Pack"]);
}
if (r["QtyPerPack"] != DBNull.Value)
{
ord.QtyPerPack = Convert.ToInt32(r["QtyPerPack"]);
}
if (r["StockOnHand"] != DBNull.Value)
{
ord.StockOnHand = Convert.ToDecimal(r["StockOnHand"]);
}
//if (r["ExpiredStock"] != DBNull.Value)
//{
// ord.ExpiredStock = Convert.ToDecimal(r["ExpiredStock"]);
//}
//if (r["DamagedStock"] != DBNull.Value)
//{
// ord.DamagedStock = Convert.ToDecimal(r["DamagedStock"]);
//}
ord.Quantity = Convert.ToDecimal(r["Quantity"]);
ord.UnitID = unitID;
//ord.StoreID = or.FromStore;
ord.Save();
}
//this.LogActivity("Save-Requisition", ord.ID);
mgr.CommitTransaction();
return or;
}
catch (Exception exp)
{
mgr.RollbackTransaction();
throw;
}
//ResetOrder();
}
示例6: 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;
}
}
示例7: Split
public int Split()
{
OrderDetail ordDetail = new OrderDetail();
ordDetail.AddNew();
foreach (DataRow dr in this.DataTable.Rows)
{
foreach (DataColumn col in ordDetail.DataTable.Columns)
{
if (col.ColumnName != "ID" && col.ColumnName != "JTransactionGroupID" && col.ColumnName != "cMin" && col.ColumnName != "cAMC" && col.ColumnName != "cDaysOutofStock" && col.ColumnName != "cDamagedStock" && col.ColumnName != "cMin" && col.ColumnName != "cExpiredStock" && col.ColumnName != "cStockOnHand" && col.ColumnName != "cMOS" && col.ColumnName != "cMax" && col.ColumnName != "rowguid")
ordDetail.SetColumn(col.ColumnName, this.GetColumn(col.ColumnName));
}
}
ordDetail.Save();
return ordDetail.ID;
}