Exemplo n.º 1
0
        public EngineersEditorViewModel()
        {
            db = new MGDBModelContainer();
            db.EngineerSet.Load();
            EngineersList = db.EngineerSet.Local;

            AddEngineerCommand  = new Command(OnAddEngineerCommandExecute);
            EditEngineerCommand = new Command(OnEditEngineerCommandExecute);
            ClearTextCommand    = new Command(OnClearTextCommandExecute);
        }
        public RegistrationJournalViewModel()
        {
            db            = new MGDBModelContainer();
            CustomersList = db.CustomerSet.Select(x => x.Name).ToList();
            db.ResearchSet.Load();
            JournalData = db.ResearchSet.Local;
            //JournalData = (ObservableCollection < Research > )db.ResearchSet.Select(x=> new { x.Number, x.Date, x.Customer, x.MVZ, x.Description, x.NumberOfSamples});
            //using (MGDBModelContainer db = new MGDBModelContainer())
            //{
            //JournalData = new ObservableCollection<MainJournal>();
            //foreach (var item in db.MainJournalSet.ToList())
            //{
            //    JournalData.Add(item);
            //}
            //Engineer engineer = new Engineer();
            //engineer.Name = "Ефременко А.В.";
            //engineer.Password = "******";
            //db.EngineerSet.Add(engineer);
            //Customer customer = new Customer();
            //customer.Name = "ТЛЦ";
            //customer.MVZList.Add(new MVZ { Text = "000-0091" });
            //customer.MVZList.Add(new MVZ { Text = "000-9091" });
            //customer.MVZList.Add(new MVZ { Text = "009-9091" });
            //db.CustomerSet.Add(customer);
            //TypeOfResearch typeOfRes = new TypeOfResearch();
            //typeOfRes.Type = "Поломки";
            //db.TypeOfResearchSet.Add(typeOfRes);
            //TypeOfResearch typeOfRes2 = new TypeOfResearch();
            //typeOfRes2.Type = "Дефекты металлопродукции";
            //db.TypeOfResearchSet.Add(typeOfRes2);
            //db.SaveChanges();

            //Research rec = new Research();
            //rec.Date = DateTime.Now;
            //rec.Number = "18-001";
            //rec.Customer = db.CustomerSet.FirstOrDefault(x => x.Name == "ТЛЦ");
            //rec.Engineer = db.EngineerSet.FirstOrDefault(x => x.Name == "Ефременко А.В.");
            //rec.MVZ = db.MVZSet.FirstOrDefault(x => x.Text == "009-9091");
            //rec.Type = db.TypeOfResearchSet.FirstOrDefault(x => x.Type == "Дефекты металлопродукции");
            //rec.Description = "Металлографическое исследование пробы от листа";
            //rec.Notation = "Проба от листа";
            //rec.Status = StatusEnum.IsInWork;
            //rec.FinishDate = DateTime.Now;
            //ResearchData dataJ = new ResearchData();
            //rec.ResearchData = dataJ;
            //db.ResearchSet.Add(rec);
            //db.SaveChanges();
            //MainJournal rec1 = new MainJournal();
            //rec1.
            //JournalData = db.ResearchSet.Local;
            //}
        }
Exemplo n.º 3
0
        public CustomersEditorViewModel()
        {
            db = new MGDBModelContainer();
            db.CustomerSet.Load();
            db.MVZSet.Load();
            CustomersList = db.CustomerSet.Local;
            MVZList       = new ObservableCollection <MVZ>();

            AddMVZCommand       = new Command(OnAddMVZCommandExecute);
            EditMVZCommand      = new Command(OnEditMVZCommandExecute);
            AddCustomerCommand  = new Command(OnAddCustomerCommandExecute);
            EditCustomerCommand = new Command(OnEditCustomerCommandExecute);
        }