コード例 #1
0
        private void DisplayCard(MaintenanceCardDataModel card)
        {
            var    f = (card.Finished) ? "Finished" : "Not Finished";
            string d = $"Date of arrival: {card.DateOfArrival.ToShortDateString()} - Maintenance Status: {f}";

            this.Invoke(new Action(() => lb_MH.Items.Add(d)));
        }
コード例 #2
0
 public Card(AutomobileController automobileController, MiscController miscController,
             MaintenanceCardDataModel card)
 {
     InitializeComponent();
     this.AutomobileController = automobileController;
     this.MiscController       = miscController;
     this.CardModel            = card;
 }
コード例 #3
0
        public void SaveAutomobile(AutomobileSaveToken token)
        {
            var model = MakeModelFromToken(token);
            var mc    = new MaintenanceCardDataModel();

            model.MaintenanceCards.Add(mc);
            mc.Automobile   = model;
            mc.AutomobileId = model.Id;

            context.Automobiles.Add(model);
            context.Maintenances.Add(mc);
            context.SaveChanges();
        }
コード例 #4
0
        public void AddMaintenanceCard(int automobileId)
        {
            var auto = context.Automobiles.FirstOrDefault(a => a.Id == automobileId);

            if (auto != null)
            {
                var mc = new MaintenanceCardDataModel();

                auto.MaintenanceCards.Add(mc);
                mc.Automobile   = auto;
                mc.AutomobileId = auto.Id;


                context.Maintenances.Add(mc);
                context.SaveChanges();
            }
        }
コード例 #5
0
 public void SaveMaintenanceCard(MaintenanceCardDataModel Model)
 {
     EditEntity <MaintenanceCardDataModel>(Model);
 }