Exemple #1
0
 public List <Order> GetDoneOrders()
 {
     using (SSAspNetContext context = new SSAspNetContext())
     {
         return(context.Orders.Where(p => p.StateOrder == (StateOrder)1).OrderBy(p => p.OrderId).ToList());
     }
 }
Exemple #2
0
 public void AddNewOrder()
 {
     using (SSAspNetContext ordersContext = new SSAspNetContext())
     {
         ordersContext.Orders.Add(this);
         ordersContext.SaveChanges();
     }
 }
Exemple #3
0
 public int GetLastOrderId()
 {
     lock (locker)
     {
         using (SSAspNetContext ordersContext = new SSAspNetContext())
         {
             int id = ordersContext.Orders.Count();
             return(id);
         }
     }
 }
Exemple #4
0
 public Order(int?id)
 {
     using (SSAspNetContext ordersContext = new SSAspNetContext())
     {
         var or = ordersContext.Orders.Find(id);
         if (or != null)
         {
             OrderId        = or.OrderId;
             _dateTimeOrder = or.DateTimeOrder;
             _modelCar      = or.ModelCar;
             _numberCar     = or.NumberCar;
             _stateOrder    = or.StateOrder;
             _costOrder     = or.CostOrder;
             _orderPaid     = or.OrderPaid;
             _conditionCar  = or.ConditionCar;
         }
     }
 }
Exemple #5
0
 public Price(int id)
 {
     using (SSAspNetContext priceContext = new SSAspNetContext())
     {
         Price price = priceContext.Prices.Find(id);
         if (price != null)
         {
             CarBody              = price.CarBody;
             CarWheels            = price.CarWheels;
             CarEngine            = price.CarEngine;
             CarBrakes            = price.CarBrakes;
             CarUndercarriage     = price.CarUndercarriage;
             BusSalon             = price.BusSalon;
             BusHandsrails        = price.BusHandsrails;
             BusUpholstery        = price.BusUpholstery;
             PasCarwheelBalancing = price.PasCarwheelBalancing;
             TruckHydraulics      = price.TruckHydraulics;
         }
     }
 }
Exemple #6
0
 public void EditPrice()
 {
     using (SSAspNetContext priceContext = new SSAspNetContext())
     {
         Price price = priceContext.Prices.Find(1);
         if (price != null)
         {
             price.CarBody              = CarBody;
             price.CarWheels            = CarWheels;
             price.CarEngine            = CarEngine;
             price.CarBrakes            = CarBrakes;
             price.CarUndercarriage     = CarUndercarriage;
             price.BusSalon             = BusSalon;
             price.BusHandsrails        = BusHandsrails;
             price.BusUpholstery        = BusUpholstery;
             price.PasCarwheelBalancing = PasCarwheelBalancing;
             price.TruckHydraulics      = TruckHydraulics;
             priceContext.SaveChanges();
         }
     }
 }
Exemple #7
0
        public void EditOrder()
        {
            lock (locker)
            {
                int?id = OrderId;
                using (SSAspNetContext ordersContext = new SSAspNetContext())
                {
                    Order newOrder = ordersContext.Orders.Find(id);

                    newOrder.OrderId       = OrderId;
                    newOrder.DateTimeOrder = DateTimeOrder;
                    newOrder.ModelCar      = ModelCar;
                    newOrder.NumberCar     = NumberCar;
                    newOrder.StateOrder    = StateOrder;
                    newOrder.CostOrder     = CostOrder;
                    newOrder.OrderPaid     = OrderPaid;
                    newOrder.ConditionCar  = ConditionCar;

                    ordersContext.SaveChanges();
                }
            }
        }