RequestEditViewModel SettingToRequestEditVM(EditViewModelSetting setting) { RequestEntitySetting requestSetting = new RequestEntitySetting(); LoadSetting <RequestEntitySetting>(setting.RequestName, requestSetting); RequestEntity request = SettingToRequest(requestSetting); RequestEditViewModel viewModel = _mainController.CreateRequestEditViewModel(request, setting.ReadOnly, setting.IsProcess, setting.IsCommit); viewModel.DialogSetting = new Core.SDK.Composite.UI.DialogSetting(setting.Position, setting.Size); return(viewModel); }
EditViewModelSetting RequstEditVMToSetting(RequestEditViewModel viewModel) { EditViewModelSetting setting = new EditViewModelSetting(); setting.Size = viewModel.DialogSetting.Size; setting.Position = viewModel.DialogSetting.Position; setting.IsCommit = viewModel.IsCommit; setting.IsProcess = viewModel.IsProcess; setting.ReadOnly = viewModel.ReadOnly; setting.RequestName = viewModel.Request.InternalName; RequestEntitySetting reqSetting = RequestToSetting(viewModel.Request); SaveSetting(setting.RequestName, reqSetting); return(setting); }
public void Save() { using (DbTransaction transaction = new DbTransaction(_dbMgr)) { Clear(); RootSetting rootSetting = new RootSetting(); if (_filterEntityList != null) { foreach (RequestListFilterEntity filter in _filterEntityList) { FilterEntitySetting filterSetting = FilterToSetting(filter); SaveSetting(filter.InternalName, filterSetting); rootSetting.FilterList.Add(filter.InternalName); } } if (_requestEditVMList != null) { foreach (RequestEditViewModel viewModel in _requestEditVMList) { EditViewModelSetting viewModelSetting = RequstEditVMToSetting(viewModel); SaveSetting(viewModel.Name, viewModelSetting); rootSetting.EditViewModelList.Add(viewModel.Name); } } if (_requestListVMList != null) { foreach (RequestListViewModel viewModel in _requestListVMList) { ListViewModelSetting viewModelSetting = RequestListVMToSetting(viewModel); SaveSetting(viewModel.Name, viewModelSetting); rootSetting.ListViewModelList.Add(viewModel.Name); } } SaveSetting(RootSettingName, rootSetting); transaction.Success = true; } }
public void Load() { Init(); RootSetting rootSetting = new RootSetting(); LoadSetting <RootSetting>(RootSettingName, rootSetting); if (rootSetting.FilterList != null) { foreach (string filterName in rootSetting.FilterList) { FilterEntitySetting filterSetting = new FilterEntitySetting(); LoadSetting <FilterEntitySetting>(filterName, filterSetting); _filterEntityList.Add(SettingToFilter(filterSetting)); } } if (rootSetting.EditViewModelList != null) { foreach (string editVMName in rootSetting.EditViewModelList) { EditViewModelSetting editVMSetting = new EditViewModelSetting(); LoadSetting <EditViewModelSetting>(editVMName, editVMSetting); _requestEditVMList.Add(SettingToRequestEditVM(editVMSetting)); } } if (rootSetting.ListViewModelList != null) { foreach (string ListVMName in rootSetting.ListViewModelList) { ListViewModelSetting listVMSetting = new ListViewModelSetting(); LoadSetting <ListViewModelSetting>(ListVMName, listVMSetting); RequestListViewModel viewModel = SettingToRequestListVM(listVMSetting); viewModel.Name = ListVMName; _requestListVMList.Add(viewModel); } } }