private void SaveDesignData() { StorageMan <MetaTableInfo> sm = new StorageMan <MetaTableInfo>(this.MethodTypeName, SaveFolderPath); sm.Save(this.QueryFormViewModel.DataModel); sm.ModelName = ModelType.ShortName; sm.Save(this.ResultListViewModel.DataModel); }
// Setting Columns : display name, allow null private bool?ShowColumnSetting() { var modelType = _codeGeneratorViewModel.ModelType.CodeType; string savefolderPath = Path.Combine(path1: Context.ActiveProject.GetFullPath(), path2: "CodeGen"); StorageMan <MetaTableInfo> sm = new StorageMan <MetaTableInfo>(modelTypeName: modelType.Name, savefolderPath: savefolderPath); MetaTableInfo data = sm.Read(); if (data.Columns.Any()) { _ModelMetadataVM = new ModelMetadataViewModel(dataModel: data); } else { //string dbContextTypeName = _codeGeneratorViewModel.DbContextModelType.TypeName; //ICodeTypeService codeTypeService = GetService<ICodeTypeService>(); //CodeType dbContext = codeTypeService.GetCodeType(project: Context.ActiveProject, fullName: dbContextTypeName); //IEntityFrameworkService efService = Context.ServiceProvider.GetService<IEntityFrameworkService>(); //ModelMetadata efMetadata = efService.AddRequiredEntity(context: Context, contextTypeFullName: dbContextTypeName, entityTypeFullName: modelType.FullName); var fullName = modelType.FullName; var efMetadata = GetEfMetadata(fullName); _ModelMetadataVM = new ModelMetadataViewModel(efMetadata: efMetadata); } ModelMetadataDialog dialog = new ModelMetadataDialog(viewModel: _ModelMetadataVM); bool?isOk = dialog.ShowModal(); if (isOk == true) { sm.Save(data: _ModelMetadataVM.DataModel); } return(isOk); }
// Setting Columns : display name, allow null private bool?ShowColumnSetting() { var modelType = _codeGeneratorViewModel.ModelType.CodeType; string savefolderPath = Path.Combine(Context.ActiveProject.GetFullPath(), "CodeGen"); StorageMan <MetaTableInfo> sm = new StorageMan <MetaTableInfo>(modelType.Name, savefolderPath); MetaTableInfo data = sm.Read(); if (data.Columns.Any()) { _ModelMetadataVM = new ModelMetadataViewModel(data); } else { string dbContextTypeName = _codeGeneratorViewModel.DbContextModelType.TypeName; ICodeTypeService codeTypeService = GetService <ICodeTypeService>(); CodeType dbContext = codeTypeService.GetCodeType(Context.ActiveProject, dbContextTypeName); IEntityFrameworkService efService = Context.ServiceProvider.GetService <IEntityFrameworkService>(); ModelMetadata efMetadata = efService.AddRequiredEntity(Context, dbContextTypeName, modelType.FullName); _ModelMetadataVM = new ModelMetadataViewModel(efMetadata); } ModelMetadataDialog dialog = new ModelMetadataDialog(_ModelMetadataVM); bool?isOk = dialog.ShowModal(); if (isOk == true) { sm.Save(_ModelMetadataVM.DataModel); } return(isOk); }
public void SentMessageComplete(Guid id) { PostMessageInfo data = this.GetData(); MessageInfo item = data.Items.FirstOrDefault(r => r.Id == id); item.SentTime = System.DateTime.Now; StorageMan<PostMessageInfo> sm = new StorageMan<PostMessageInfo>(); sm.Save(data); }
public bool DeleteItem(Guid id) { PostMessageInfo data = this.GetData(); MessageInfo item = data.Items.FirstOrDefault(r => r.Id == id); data.Items.Remove(item); StorageMan<PostMessageInfo> sm = new StorageMan<PostMessageInfo>(); sm.Save(data); return true; }
public bool AddNew(DateTime? schedule, string subject, string context) { PostMessageInfo data = this.GetData(); data.Items.Add(new MessageInfo() { Schedule = schedule , Subject = subject , Context = context }); StorageMan<PostMessageInfo> sm = new StorageMan<PostMessageInfo>(); sm.Save(data); return true; }
private void SaveChangeToSotrage() { StorageMan<CustomerDB> sm = new StorageMan<CustomerDB>(); sm.Save(this.DB); }
public bool UpdateItem(Guid id,DateTime? schedule, string subject, string context) { PostMessageInfo data = this.GetData(); MessageInfo item = data.Items.FirstOrDefault(r => r.Id == id); item.Schedule = schedule; item.Subject = subject; item.Context = context; StorageMan<PostMessageInfo> sm = new StorageMan<PostMessageInfo>(); sm.Save(data); return true; }