static public long saveOrder(ref string promo, string user_name, string name, string phone, string add, string text, long orderType, DataTable dtOrder) { TOrderBiz order = new TOrderBiz(); order.Name = name; order.UserName = user_name; order.Address = add; order.Phone = phone; order.AddText = text; order.OrderTypeID = orderType; if (dtOrder != null) { for (int i = 0; i < dtOrder.Rows.Count; i++) { TOrderItemBiz item = new TOrderItemBiz(); item.DishId = (long)dtOrder.Rows[i][0]; item.DishName = (string)dtOrder.Rows[i][1]; item.Amount = Convert.ToDecimal(stripDL(dtOrder.Rows[i][2].ToString())); item.SubPrice = Convert.ToDecimal(stripDL(dtOrder.Rows[i][3].ToString())); item.Price = Convert.ToDecimal(stripDL(dtOrder.Rows[i][4].ToString())); item.Text = ""; order.Items.Add(item); } } promo = order.ChipIn1For5(); return(saveOrder(order)); }
public void Copy(TOrderItemBiz item) { DishId = item.DishId; Id = item.Id; DishName = item.DishName; Price = item.Price; Amount = item.Amount; SubPrice = item.SubPrice; Text = item.Text; Order = item.Order; }
static public void insertOrderItem(int sessionid, TOrderItemBiz item) { if (ItemListDict.ContainsKey(sessionid)) { List <TOrderItemBiz> list = ItemListDict[sessionid]; if (list == null) { list = new List <TOrderItemBiz>(); ItemListDict[sessionid] = list; } if (list != null) { list.Add(item); } } }
public static void insertOrderItem(int sessionid, TOrderItemBiz item) { if (ItemListDict.ContainsKey(sessionid)) { List<TOrderItemBiz> list = ItemListDict[sessionid]; if (list == null) { list = new List<TOrderItemBiz>(); ItemListDict[sessionid] = list; } if (list != null) { list.Add(item); } } }
public static void updateDataItem(TOrderItemBiz item) { int sessionid = 10; if (ItemListDict.ContainsKey(sessionid)) { List<TOrderItemBiz> list = ItemListDict[sessionid]; if (list != null) { foreach (TOrderItemBiz oneitem in list) { if (item.DishId == oneitem.DishId) { oneitem.Copy(item); } } } } }
static public void updateDataItem(TOrderItemBiz item) { int sessionid = 10; if (ItemListDict.ContainsKey(sessionid)) { List <TOrderItemBiz> list = ItemListDict[sessionid]; if (list != null) { foreach (TOrderItemBiz oneitem in list) { if (item.DishId == oneitem.DishId) { oneitem.Copy(item); } } } } }
public string ChipIn1For5() { string result = ""; int count = Items.Count; for (int i = 0; i < count; i++) { int chipIn = ((int)Items[i].Amount) / 5; if (chipIn > 0) { TOrderItemBiz chipInItem = new TOrderItemBiz(); chipInItem.Copy(Items[i]); chipInItem.Amount = chipIn; chipInItem.Price = 0; chipInItem.SubPrice = 0; Items.Add(chipInItem); result = result + chipInItem.Amount.ToString() + " free " + chipInItem.DishName + ";"; } } return(result); }
public static long saveOrder(ref string promo, string user_name, string name, string phone, string add, string text, long orderType, DataTable dtOrder) { TOrderBiz order = new TOrderBiz(); order.Name = name; order.UserName = user_name; order.Address = add; order.Phone = phone; order.AddText = text; order.OrderTypeID = orderType; if (dtOrder != null) { for (int i = 0; i < dtOrder.Rows.Count; i++) { TOrderItemBiz item = new TOrderItemBiz(); item.DishId = (long)dtOrder.Rows[i][0]; item.DishName = (string)dtOrder.Rows[i][1]; item.Amount = Convert.ToDecimal(stripDL(dtOrder.Rows[i][2].ToString())); item.SubPrice = Convert.ToDecimal(stripDL(dtOrder.Rows[i][3].ToString())); item.Price = Convert.ToDecimal(stripDL(dtOrder.Rows[i][4].ToString())); item.Text = ""; order.Items.Add(item); } } promo = order.ChipIn1For5(); return saveOrder(order); }
public static void deleteOrderItem(TOrderItemBiz item) { ; }
public string ChipIn1For5() { string result = ""; int count = Items.Count; for (int i = 0; i < count; i++) { int chipIn = ((int)Items[i].Amount) / 5; if (chipIn > 0) { TOrderItemBiz chipInItem = new TOrderItemBiz(); chipInItem.Copy(Items[i]); chipInItem.Amount = chipIn; chipInItem.Price = 0; chipInItem.SubPrice = 0; Items.Add(chipInItem); result = result + chipInItem.Amount.ToString() + " free " + chipInItem.DishName + ";"; } } return result; }
static public void deleteOrderItem(TOrderItemBiz item) { ; }