public ServiceStoreEditViewModel(ServiceStoreEditWindow serviceStoreEditWindow, ServiceStore selectedServiceStore, Student contextStudent) { this.ContextStudent = contextStudent; this.SelectedServiceStore = selectedServiceStore; this.SourceWindow = serviceStoreEditWindow; this.SaveCommand = new RelayCommand(SaveServiceStore, CanExecute); this.InputFieldCreateCommand = new RelayCommand(AddInputParam); this.InputFieldDeleteCommand = new RelayCommand(DeleteSelectedInputField, CanEditOrDeleteSelectedItem); this.OutputFieldCreateCommand = new RelayCommand(AddOutputParam); this.OutputFieldDeleteCommand = new RelayCommand(DeleteSelectedOutputField, CanEditOrDeleteSelectedItem); this.ServiceStoreServiceAddCommand = new RelayCommand(AddServiceParam); this.ServiceStoreServiceDeleteCommand = new RelayCommand(DeleteServiceParam, CanEditOrDeleteSelectedItem); this._contextDal = new ServiceStoreDAL(); this.TeamDal = new TeamDAL(); this.SessionGroupDal = new SessionGroupDAL(); this.StudentDal = new StudentDAL(); this.ServiceStoreParamsDal = new ServiceStoreParamsDAL(); this.ServiceStoreUserTeamsDal = new ServiceStoreUserTeamsDAL(); this.ServiceStoreServiceParamsDal = new ServiceStoreServiceParamsDAL(); int SessionGroupID = TeamDal.FindAll().FirstOrDefault(x => x.ID == SelectedServiceStore.ProviderTeamID).SessionGroupID; this.RequesterTeamList = LoadTeamList(); this.TeamList = new ObservableCollection <Team>(TeamDal.FindAll(x => x.SessionGroupID == SessionGroupID)); this.ServiceStoreServiceParamsList = ReloadServiceParams(); this.InputFieldList = ReloadInputFieldList(); this.OutputFieldList = ReloadOutputFieldList(); }
private void EditServiceStore(object param) { ServiceStoreEditWindow target = new ServiceStoreEditWindow((ServiceStore)((DataGrid)param).SelectedItem, null) { Owner = this.SourceWindow }; SwitchWindows(target, true); this.ServiceStoreList = ReloadServiceStoreList(); }
private void CreateServiceStore() { ServiceStore serviceStore = new ServiceStore() { ProviderTeamID = ContextStudent.TeamID, CreatorID = ContextStudent.ID }; ServiceStoreEditWindow target = new ServiceStoreEditWindow(serviceStore, ContextStudent) { Owner = this.SourceWindow }; SwitchWindows(target, true); this.ServiceStoreList = ReloadServiceStoreList(); this.AllServices = ReloadAllServices(); }