Exemple #1
0
        public object DeleteType(string id, string SHOP_ID)
        {
            using (var db = new OrderDB())
            {
                db.BeginTransaction();
                try
                {
                    var curType = (from p in db.FoodTypes where p.ID == id select p).FirstOrDefault();
                    if (curType is null)
                    {
                        throw new Exception("当前类别不存在!");
                    }

                    db.FoodTypes
                    .Where(c => c.SEQ > curType.SEQ && c.ShopId == SHOP_ID && c.STATE == 'A')
                    .Set(c => c.SEQ, c => c.SEQ - 1)
                    .Update();

                    db.Delete(curType);
                    db.CommitTransaction();
                }
                catch (Exception ex)
                {
                    db.RollbackTransaction();
                    throw ex;
                }

                return(true);
            }
        }
Exemple #2
0
        public bool UpdateOrder(Order ord, Collection <OrderItem> items)
        {
            bool success = false;

            // Delete the order
            ordDb.Delete(ord);

            // Remove reservations
            foreach (OrderItem item in ord.ItemList)
            {
                prodDb.DeReserveProduct(item.ItemProduct.Name, item.Quantity);
            }

            // Retain the orderid
            string orderId = ord.OrderID;

            // Create a new order with the same orderid
            CreateAnOrder inserted = new CreateAnOrder();

            ord.ItemList.Clear();

            foreach (OrderItem item in items)
            {
                ord.ItemList.Add(item);
            }

            // Insert
            success = inserted.InsertIntoOrderDB(ord);

            return(success);
        }
 // Deletes order from database
 public Order DeleteOrder(Order o)
 {
     foreach (OrderLine ol in o.Orderlines)
     {
         Product p = productLogic.GetProduct("productID", ol.Product.ID.ToString());
         ol.Product = p;
         orderLineDB.DeleteInDesktop(ol);
     }
     return(orderDB.Delete(o));
 }
Exemple #4
0
        public void  DeleteOrder()
        {
            Customer c = customerDB.Get("email", "*****@*****.**");
            Order    o = new Order(c);

            o.Orderlines.Add(new OrderLine(2, 200, productDB.Get("productID", 1.ToString())));

            o = orderDB.Create(o);

            Order order = orderDB.Delete(o, true, true);

            Assert.AreEqual(order.ErrorMessage, "");
        }
Exemple #5
0
        protected void butDelete_Click(object sender, EventArgs e)
        {
            int orderid = ConvertUtility.ToInt32(Request.QueryString["orderid"]);

            try
            {
                OrderDB.Delete(orderid);
                Response.Redirect(AppEnv.ADMIN_CMD + "orderlist");
            }
            catch
            {
                lblUpdateStatus.Text = MiscUtility.UPDATE_ERROR;
            }
        }
Exemple #6
0
 protected void butDeleteChecked_Click(object sender, EventArgs e)
 {
     try
     {
         foreach (DataGridItem item in dtgOrder.Items)
         {
             CheckBox chkSelect = (CheckBox)item.FindControl("chkSelect");
             if (chkSelect.Checked)
             {
                 int id = ConvertUtility.ToInt32(item.Cells[0].Text);
                 OrderDB.Delete(id);
             }
         }
         lblUpdateStatus.Text = MiscUtility.UPDATE_SUCCESS;
     }
     catch
     {
         lblUpdateStatus.Text = MiscUtility.UPDATE_ERROR; //ex.ToString();
     }
 }
Exemple #7
0
        protected void dtgProduct_ItemCommand(object source, DataGridCommandEventArgs e)
        {
            if (e.CommandName == "delete")
            {
                int id = ConvertUtility.ToInt32(e.Item.Cells[0].Text);
                try
                {
                    OrderDB.Delete(id);
                    lblUpdateStatus.Text = MiscUtility.UPDATE_SUCCESS;
                }
                catch
                {
                    lblUpdateStatus.Text = MiscUtility.UPDATE_ERROR;
                }
            }
            if (e.CommandName == "updaterow")
            {
                try
                {
                    int       id   = ConvertUtility.ToInt32(e.Item.Cells[0].Text);
                    OrderInfo info = OrderDB.GetInfo(id);

                    var dropStatus = (DropDownList)e.Item.FindControl("dropStatus");

                    info.Order_Status = ConvertUtility.ToInt32(dropStatus.SelectedValue);

                    OrderDB.Update(info);

                    lblUpdateStatus.Text = MiscUtility.UPDATE_SUCCESS;
                }
                catch
                {
                    lblUpdateStatus.Text = MiscUtility.UPDATE_ERROR; //ex.ToString();
                }
            }
        }
 public static bool Order_Delete(int[] orderIDs)
 {
     return(OrderDB.Delete(orderIDs));
 }
 public static int DeleteOrders(int[] orderIDs)
 {
     return(OrderDB.Delete(orderIDs));
 }