예제 #1
0
        public bool UpdateOrder(SharedDataTypes.Order o)
        {
            var temp = mainDb.Order.Where(p => p.ID_Order.Equals(o.OrderId)).Select(p => p).First();

            temp.DateOfOrder    = o.DateOfOrder;
            temp.DateOfDelivery = o.DateOfDelivery;
            temp.Status_ID      = o.Status.OrderStatusId;
            temp.Customer_ID    = o.Customer.CustomerId;
            temp.Note           = o.Note;
            temp.ModifyDate     = DateTime.Now;

            return(mainDb.SaveChanges() == 1);
        }
예제 #2
0
 internal DataBases.Order ConvertToDBOrder(SharedDataTypes.Order o)
 {
     return(new DataBases.Order
     {
         ID_Order = o.OrderId,
         Customer_ID = o.Customer.CustomerId,
         Status_ID = o.Status.OrderStatusId,
         DateOfOrder = o.DateOfOrder,
         DateOfDelivery = o.DateOfDelivery,
         Note = o.Note,
         ModifyDate = DateTime.Now
     });
 }
예제 #3
0
        public bool UpdateOrder(SharedDataTypes.Order o)
        {
            var temp = localDb.Order.Where(p => p.ID_Order.Equals(o.OrderId)).Select(p => p).First();

            temp.DateOfOrder    = o.DateOfOrder;
            temp.DateOfDelivery = o.DateOfDelivery;
            temp.Status_ID      = o.Status.OrderStatusId;
            temp.Customer_ID    = o.Customer.CustomerId;
            temp.Note           = o.Note;
            temp.ModifyDate     = DateTime.Now;
            //test
            localDb.SaveChanges();

            //foreach (SharedDataTypes.OrderContent item in o.Content)
            //{
            //    var a = localDb.OrderContent.Where(p => p.ID_OrderContent.Equals(item.OrderContentId)).First();
            //    a.ID_OrderContent = item.OrderContentId;
            //    a.Order_ID = o.OrderId;
            //    //test
            //    localDb.SaveChanges();
            //}
            return(localDb.SaveChanges() == 1);
        }
예제 #4
0
        public bool InsertOrder(SharedDataTypes.Order o)
        {
            localDb.Order.Add(converter.ConvertToDBOrder(o));

            return(localDb.SaveChanges() == 1);
        }
예제 #5
0
 private void GaranteeDataConsistency(SharedDataTypes.Order o)
 {
 }
예제 #6
0
 public bool InsertOrder(SharedDataTypes.Order o)
 {
     o.Customer = GaranteeCustomerExists(o.Customer);
     mainDb.Order.Add(converter.ConvertToDBOrder(o));
     return(mainDb.SaveChanges() > 0);
 }
예제 #7
0
 public bool UpdateOrder(SharedDataTypes.Order o) => mainDh.UpdateOrder(o) && wpDh.UpdateOrder(o) > 0;