Ejemplo n.º 1
0
 public bool OrderRenew(OrderDetails p2, string a, string b, string c, string d)
 {
     using (var db = new Orderdb())
     {
         try
         {
             p2.ordernum     = a;
             p2.goodname     = b;
             p2.customername = c;
             p2.ordervalue   = d;
             db.Entry <OrderDetails>(p2).State = System.Data.Entity.EntityState.Modified;
             db.SaveChanges();
             return(true);
         }
         catch { return(false); }
     }
 }
Ejemplo n.º 2
0
        public bool Orderdelete(List <OrderService> order, string a)
        {
            using (var db = new Orderdb())
            {
                try
                {
                    var n = from OrderDetails god in order
                            where god.ordernum == a
                            select god;

                    foreach (var m in n)
                    {
                        db.Entry <OrderDetails>(m).State = System.Data.Entity.EntityState.Deleted;
                        db.SaveChanges();
                    }
                    return(true);
                }
                catch { return(false); }
            }
        }
Ejemplo n.º 3
0
        public bool OrderFoundation(List <OrderService> order, string a, string b, string c, string d)
        {
            using (var db = new Orderdb())
            {
                try
                {
                    OrderDetails p1 = new OrderDetails("1", "饺子", "张三", "10000");
                    OrderDetails p2 = new OrderDetails("2", "包子", "李四", "20000");
                    OrderDetails p3 = new OrderDetails("3", "馒头", "王五", "1000");
                    order.Add(p1);
                    order.Add(p2);
                    order.Add(p3);
                    OrderDetails pnew = new OrderDetails(a, b, c, d);
                    order.Add(pnew);
                    db.Order.Add(order);
                    db.SaveChanges();
                    return(true);
                }

                catch { return(false); }
            }
        }