public static Boolean CreateXProfileWnd(XClientVM client) { _client = client; XProfileWindow wnd = new XProfileWindow(); return wnd.ShowDialog().GetValueOrDefault(); }
public XMainWndVM() { try { _dal = new XDAL("SpaceDoctorDB"); IEnumerable<XExam> examEnumerable = Dal.GetEntityCollection<XExam>("ParamsCollection"); IEnumerable<XClient> clientEnumerable = _dal.GetEntityCollection<XClient>("ExamsCollection", "DragPlanCollection", "RegData"); IEnumerable<XExamType> exTypeEnumerable = _dal.GetEntityCollection<XExamType>("ParamsCollection"); IEnumerable<XDragKit> drKitEnumerable = _dal.GetEntityCollection<XDragKit>("DragCollection"); IEnumerable<XParamType> paramType = _dal.GetEntityCollection<XParamType>(); IEnumerable<XDrag> dragEnum = _dal.GetEntityCollection<XDrag>(); //заполнить коллекции с типами обследований: _examTypesObsCollection = new ObservableCollection<XExamTypeVM>(); foreach (var v in exTypeEnumerable) _examTypesObsCollection.Add(new XExamTypeVM(v)); _examTypesCVS = new CollectionViewSource(); _examTypesCVS.Source = _examTypesObsCollection; _examTypesCVS.View.CurrentChanged += View_CurrentChanged; _examTypesObsCollection.CollectionChanged += _examTypesObsCollection_CollectionChanged; //заполнить коллекции с типами параметров: _paramTypesObsCollection = new ObservableCollection<XParamTypeVM>(); foreach (var v in paramType) _paramTypesObsCollection.Add(new XParamTypeVM(v)); _paramTypesCVS = new CollectionViewSource(); _paramTypesCVS.Source = _paramTypesObsCollection; _paramTypesCVS.View.CurrentChanged += ParamTypes_CurrentChanged; _client = new XClientVM(clientEnumerable.First(cl => cl.Id == 2)); //Список препаратов _dragCollection = new ObservableCollection<XDragVM>(); foreach (var v in dragEnum) _dragCollection.Add(new XDragVM(v)); _dragsCVS = new CollectionViewSource(); _dragsCVS.Source = _dragCollection; //список лекарственныхНаборов: _dragKitObsCollection = new ObservableCollection<XDragKitVM>(); foreach (var v in drKitEnumerable) _dragKitObsCollection.Add(new XDragKitVM(v)); _dragKitCVS = new CollectionViewSource(); _dragKitCVS.Source = _dragKitObsCollection; _dragKitCVS.View.CurrentChanged += DragsKitView_CurrentChanged; _dragKitObsCollection.CollectionChanged += _dragKitObsCollection_CollectionChanged; } catch (System.Data.SqlClient.SqlException sqlEx) { MessageBox.Show("Не могу соединиться с сервером"); Environment.FailFast("Не могу соединиться с сервером"); } _hoursCollection = new Collection<Int32>(); for (int i = 0; i < 24; i++) _hoursCollection.Add(i); _minutesCollection = new Collection<Int32>(); for (int i = 0; i < 60; i += 5) _minutesCollection.Add(i); ActualDate = DateTime.Now; CreateNewExamCommand = new XCommand(CreateNewExam); SaveChangesCommand = new XCommand(SaveChanges); AddNewExamToPlanCommand = new XCommand(AddNewExamToPlan); CreateNewExamTypeCommand = new XCommand(CreateNewExamType); SaveNewExamTypeCommand = new XCommand(SaveNewExamType); DeleteExamFromPlanCommand = new XCommand(DeleteExamFromPlan); CreateNewDragKitCommand = new XCommand(CreateNewDragKit); SaveNewDragKitCommand = new XCommand(SaveNewDragKit); AddNewDragPlanCommand = new XCommand(AddNewDragPlan); OpenProfileWndCommand = new XCommand(OpenProfileWnd); // AddWndCommand = new XCommand(AddWnd); }