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);
        }
Example #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
     });
 }
Example #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);
        }
Example #4
0
        public bool InsertOrder(SharedDataTypes.Order o)
        {
            localDb.Order.Add(converter.ConvertToDBOrder(o));

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