상속: BaseEntity
예제 #1
0
파일: OrderBiz.cs 프로젝트: stone0090/dian
 public void ClearCart(int orderId)
 {
     var dt = GetUnConfirmOrderData(orderId);
     if (dt != null && dt.Rows.Count > 0)
     {
         using (TransactionScope ts = new TransactionScope())
         {
             foreach (DataRow dr in dt.Rows)
             {
                 var condition = new OrderListEntity();
                 condition.LIST_ID = int.Parse(dr["LIST_ID"].ToString());
                 DeleteOrderListEntity(condition);
             }
             ts.Complete();
         }
     }
 }
예제 #2
0
        private void OperateOrder()
        {
            try
            {
                if (!string.IsNullOrEmpty(this.hOperation.Value))
                {
                    IOrder orderBiz = new OrderBiz();
                    if (this.hOperation.Value.IndexOf('|') > -1)
                    {
                        var op = this.hOperation.Value.Split('|')[0];
                        var listId = base.ParseInt(this.hOperation.Value.Split('|')[1]);
                        if (listId == 0)
                        {
                            this.lMsg.InnerText = "处理失败,参数 LIST_ID 不正确!";
                            return;
                        }
                        if (op == "cancel")
                        {
                            var condition = new OrderListEntity();
                            condition.LIST_ID = listId;
                            condition.CANCEL_TIME = DateTime.Now.ToString("yyyy-MM-dd HH:mm:sss");
                            orderBiz.UpdateOrderListEntity(condition);
                        }
                        if (op == "confirm")
                        {
                            var condition = new OrderListEntity();
                            condition.LIST_ID = listId;
                            condition.CONFIRM_TIME = DateTime.Now.ToString("yyyy-MM-dd HH:mm:sss");
                            orderBiz.UpdateOrderListEntity(condition);
                        }
                        else if (op == "finish")
                        {
                            //假如存在已完成同样的菜单,更新原有的数量
                            var curOrderListEntity = orderBiz.GetOrderListEntity(listId);
                            var condition = new OrderListEntity();
                            condition.FOOD_ID = curOrderListEntity.FOOD_ID;
                            condition.ORDER_ID = OrderId;
                            var list = orderBiz.GetOrderListEntityList(condition);

                            condition = null;
                            if (list != null && list.Count > 0)
                            {
                                foreach (OrderListEntity e in list)
                                {
                                    if (!string.IsNullOrEmpty(e.FINISH_TIME) && string.IsNullOrEmpty(e.CANCEL_TIME))
                                    {
                                        condition = new OrderListEntity();
                                        condition.LIST_ID = e.LIST_ID;
                                        condition.COUNT = e.COUNT;
                                    }
                                }
                            }

                            if (condition != null)
                            {
                                condition.COUNT += curOrderListEntity.COUNT;
                                orderBiz.UpdateOrderListEntity(condition);
                                orderBiz.DeleteOrderListEntity(new OrderListEntity() { LIST_ID = curOrderListEntity.LIST_ID });
                            }
                            else
                            {
                                condition = new OrderListEntity();
                                condition.LIST_ID = listId;
                                condition.FINISH_TIME = DateTime.Now.ToString("yyyy-MM-dd HH:mm:sss");
                                orderBiz.UpdateOrderListEntity(condition);
                            }
                        }
                        else if (op == "cancelfinish")
                        {
                            //假如存在已完成同样的菜单,更新原有的数量
                            var curOrderListEntity = orderBiz.GetOrderListEntity(listId);
                            var condition = new OrderListEntity();
                            condition.FOOD_ID = curOrderListEntity.FOOD_ID;
                            condition.ORDER_ID = OrderId;
                            var list = orderBiz.GetOrderListEntityList(condition);

                            condition = null;
                            if (list != null && list.Count > 0)
                            {
                                foreach (OrderListEntity e in list)
                                {
                                    if (!string.IsNullOrEmpty(e.CONFIRM_TIME) && string.IsNullOrEmpty(e.FINISH_TIME) && string.IsNullOrEmpty(e.CANCEL_TIME))
                                    {
                                        condition = new OrderListEntity();
                                        condition.LIST_ID = e.LIST_ID;
                                        condition.COUNT = e.COUNT;
                                    }
                                }
                            }

                            if (condition != null)
                            {
                                condition.COUNT += curOrderListEntity.COUNT;
                                orderBiz.UpdateOrderListEntity(condition);
                                orderBiz.DeleteOrderListEntity(new OrderListEntity() { LIST_ID = curOrderListEntity.LIST_ID });
                            }
                            else
                            {
                                condition = new OrderListEntity();
                                condition.LIST_ID = listId;
                                condition.FINISH_TIME = string.Empty;
                                orderBiz.UpdateOrderListEntity(condition);
                            }
                        }
                    }
                    else
                    {
                        if (this.hOperation.Value == "confirmall" || this.hOperation.Value == "finishall")
                        {
                            orderBiz.BatchProcessOrder(OrderId, this.hOperation.Value);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                this.lMsg.InnerText = "处理失败,原因:" + ex.ToString();
            }
        }
예제 #3
0
파일: OrderBiz.cs 프로젝트: stone0090/dian
 public void DeleteOrderListEntity(OrderListEntity condition_entity)
 {
     condition_entity.Delete();
 }
예제 #4
0
파일: OrderBiz.cs 프로젝트: stone0090/dian
 public void UpdateOrderListEntity(OrderListEntity condition_entity)
 {
     condition_entity.Update();
 }
예제 #5
0
파일: OrderBiz.cs 프로젝트: stone0090/dian
        public void UpdateOrder(int orderId, decimal price, string foodOp, OrderListEntity entity)
        {
            using (TransactionScope ts = new TransactionScope())
            {
                //更新主表价格
                var orderMainEntity = new OrderMainEntity();
                orderMainEntity.ORDER_ID = orderId;
                orderMainEntity.PRICE = price;
                UpdateOrderMainEntity(orderMainEntity);

                //更新子表明细
                var dt = GetUnConfirmOrderData(orderId, entity.FOOD_ID);
                if (foodOp == "add")
                {
                    if (dt != null && dt.Rows.Count > 0)
                    {
                        var condition = new OrderListEntity();
                        condition.LIST_ID = int.Parse(dt.Rows[0]["LIST_ID"].ToString());
                        condition.COUNT = int.Parse(dt.Rows[0]["COUNT"].ToString()) + 1;
                        UpdateOrderListEntity(condition);
                    }
                    else
                    {
                        entity.ORDER_ID = orderId;
                        entity.COUNT = 1;
                        entity.ORDER_FLAG = "1";
                        entity.ORDER_TIME = DateTime.Now.ToString("yyyy-MM-dd HH:mm:sss");
                        InsertOrderListEntity(entity);
                    }
                }
                else if (foodOp == "cut")
                {
                    if (dt != null && dt.Rows.Count > 0)
                    {
                        var count = int.Parse(dt.Rows[0]["COUNT"].ToString());
                        if (count <= 1)
                        {
                            var condition = new OrderListEntity();
                            condition.LIST_ID = int.Parse(dt.Rows[0]["LIST_ID"].ToString());
                            DeleteOrderListEntity(condition);
                        }
                        else
                        {
                            var condition = new OrderListEntity();
                            condition.LIST_ID = int.Parse(dt.Rows[0]["LIST_ID"].ToString());
                            condition.COUNT = count - 1;
                            UpdateOrderListEntity(condition);
                        }
                    }
                }
                else if (foodOp == "remark")
                {
                    if (dt != null && dt.Rows.Count > 0)
                    {
                        var condition = new OrderListEntity();
                        condition.LIST_ID = int.Parse(dt.Rows[0]["LIST_ID"].ToString());
                        condition.TASTE = entity.TASTE;
                        condition.REMARK = entity.REMARK;
                        UpdateOrderListEntity(condition);
                    }
                }

                ts.Complete();
            }
        }
예제 #6
0
파일: OrderBiz.cs 프로젝트: stone0090/dian
 public void InsertOrderListEntity(OrderListEntity condition_entity)
 {
     condition_entity.Insert();
 }
예제 #7
0
파일: OrderBiz.cs 프로젝트: stone0090/dian
 public List<OrderListEntity> GetOrderListEntityList(OrderListEntity condition_entity)
 {
     GenericWhereEntity<OrderListEntity> where_entity = new GenericWhereEntity<OrderListEntity>();
     if (condition_entity.LIST_ID != null)
         where_entity.Where(n => (n.LIST_ID == condition_entity.LIST_ID));
     if (condition_entity.ORDER_ID != null)
         where_entity.Where(n => (n.ORDER_ID == condition_entity.ORDER_ID));
     if (condition_entity.FOOD_ID != null)
         where_entity.Where(n => (n.FOOD_ID == condition_entity.FOOD_ID));
     return EntityExecution.SelectAll(where_entity);
 }