public DsmModel(string processStep, Assembly executingAssembly) { _metaDataModel = new MetaDataModel(processStep, executingAssembly); _elementsDataModel = new DsmElementModel(); _relationsDataModel = new DsmRelationModel(_elementsDataModel); _actionsDataModel = new DsmActionModel(); }
public TemplateService(string latexContent, StatisticModel statisticModel, MetaDataModel metaDataModel, string templateName) { _latexContent = latexContent; _statisticModel = statisticModel; _metaDataModel = metaDataModel; _templateName = templateName; }
private MetaDataModel MapToModel(MetaData entity, string requestId = "") { // Perform mapping var model = new MetaDataModel(); model.Id = entity.Id ?? String.Empty; model.DisplayName = entity.DisplayName ?? String.Empty; model.Screen = entity.Screen ?? String.Empty; model.FieldType = entity.FieldType ?? FieldType.None; model.Required = entity.Required; model.UniqueId = entity.UniqueId; if (model.FieldType == FieldType.DropDown) { model.Values = new List <DropDownMetaDataValue>(); foreach (DropDownMetaDataValue metaValue in entity.Values) { model.Values.Add(metaValue); } } else { model.Values = entity.Values ?? String.Empty; } return(model); }
public void Given_MetaDataIsPresent_When_ModelIsCleared_Then_OnlyDefaultGroupAndItemsArePresent() { string defaultGroupName = "DefaultGroupName"; MetaDataModel model = new MetaDataModel(defaultGroupName, Assembly.GetExecutingAssembly()); string groupName = "ImportedGroupName"; string name1 = "SomeItemName1"; string value1 = "SomeItemValue2"; model.AddMetaDataItem(groupName, name1, value1); string name2 = "SomeItemName"; string value2 = "SomeItemValue1"; model.AddMetaDataItem(groupName, name2, value2); List <string> groupsBefore = model.GetExportedMetaDataGroups().ToList(); Assert.AreEqual(2, groupsBefore.Count); model.Clear(); List <string> groupsAfter = model.GetExportedMetaDataGroups().ToList(); Assert.AreEqual(1, groupsAfter.Count); List <IMetaDataItem> items = model.GetExportedMetaDataGroupItems(defaultGroupName).ToList(); Assert.AreEqual(1, items.Count); Assert.IsTrue(items[0].Name == "Executable"); Assert.IsTrue(items[0].Value.Contains("DsmSuite.Common.Model.Test")); }
public void GivenItemNameUsedBeforeWhenAddMetaDataItemToDefaultGroupIsCalledThenItemIsUpdated() { string defaultGroupName = "DefaultGroupName"; MetaDataModel model = new MetaDataModel(defaultGroupName, Assembly.GetExecutingAssembly()); List <IMetaDataItem> itemsBefore = model.GetExportedMetaDataGroupItems(defaultGroupName).ToList(); Assert.AreEqual(1, itemsBefore.Count); string name = "SomeItemName"; string value1 = "SomeItemValue1"; model.AddMetaDataItemToDefaultGroup(name, value1); string value2 = "SomeItemValue2"; model.AddMetaDataItemToDefaultGroup(name, value2); List <IMetaDataItem> itemsAfter = model.GetExportedMetaDataGroupItems(defaultGroupName).ToList(); Assert.AreEqual(2, itemsAfter.Count); Assert.AreEqual(itemsBefore[0].Name, itemsAfter[0].Name); Assert.AreEqual(itemsBefore[0].Value, itemsAfter[0].Value); Assert.AreEqual(name, itemsAfter[1].Name); Assert.AreEqual(value2, itemsAfter[1].Value); }
public NewMetaHeader(String MHDFPath, OPType opType) { InitializeComponent(); tcMetaInfo.TabPages.Remove(tpMISummary); this.MHDFPath = MHDFPath; if (opType == OPType.Modify) { //Deserialize XML file if (CoreData.CommonData.mdm != null) { mdm = CoreData.CommonData.mdm; } else { MetaXMLReader mxReader = new MetaXMLReader(); mdm = mxReader.readMetaHeaderFile(MHDFPath); } } else if (opType == OPType.New) { mdm = new MetaDataModel(); } }
private MetaData MapToEntity(MetaDataModel model, string requestId = "") { // Perform mapping var entity = MetaData.Empty; entity.Id = model.Id ?? String.Empty; entity.DisplayName = model.DisplayName ?? String.Empty; entity.Screen = model.Screen ?? String.Empty; entity.FieldType = model.FieldType ?? FieldType.None; entity.Required = model.Required; entity.UniqueId = model.UniqueId; if (entity.FieldType.Name == FieldType.DropDown.Name) { JArray jsonArray = JArray.Parse(model.Values.ToString()); entity.Values = new List <DropDownMetaDataValue>(); foreach (var metaValue in jsonArray) { if (!string.IsNullOrEmpty(metaValue["name"].ToString())) { entity.Values.Add(new DropDownMetaDataValue { Id = metaValue["id"].ToString(), Name = metaValue["name"].ToString() }); } } } else { entity.Values = model.Values ?? String.Empty; } return(entity); }
public KafkaMessage() { MetaData = new MetaDataModel() { MessageType = MessageTypeEnum.UndefinedMessage, MessageCreated = DateTime.Now }; }
private void btnSave_Click(object sender, EventArgs e) { MetaXMLWriter xmlWriter = new MetaXMLWriter(MHDFPath); MetaDataModel mdm = new MetaDataModel(); mdm.title = tbTitle.Text; mdm.releaseDate = tbReleaseDate.Text; mdm.director = tbDirector.Text; mdm.writer = tbWriter.Text; mdm.cast = tbCast.Text; mdm.description = tbDescription.Text; mdm.longDescription = tbLongDescription.Text; mdm.posterPath = pbPoster.ImageLocation; mdm.mediaType = cbMediaType.Text; mdm.contentRate = cbContentRating.Text; mdm.hd = cbHD.Text; mdm.chaptersFilePath = tbChaptersFile.Text; foreach (ListViewItem item in lvSubtitles.Items) { mdm.subtitles.Add(new KeyValuePair <String, String>(item.SubItems[0].Text, item.SubItems[1].Text)); } if (tvsc != null) { mdm.tvShow = tvsc.tvShow; mdm.tvNetwork = tvsc.tvNetwork; mdm.seasonNum = tvsc.seasonNum; mdm.episodeNum = tvsc.episodeNum; if (cbMediaType.Text == "电视剧") { mdm.genre = tvsc.genre; mdm.rating = tvsc.rating; } } if (msc != null) { if (cbMediaType.Text == "电影") { mdm.genre = msc.genre; mdm.rating = msc.rating; } } xmlWriter.SaveFile(mdm); CommonData.mdm = mdm; this.Close(); }
public CategoryModel( string name, string title, string imageRelativeUrl, string bannerImageRelativeUrl, bool comingSoon, IEnumerable <ProductModel> products, IEnumerable <ContentSectionModel> contentSections, MetaDataModel metaData ) { Name = name; Title = title; ImageRelativeUrl = imageRelativeUrl; ComingSoon = comingSoon; Products = products; ContentSections = contentSections; BannerImageRelativeUrl = bannerImageRelativeUrl; MetaData = metaData; }
public async Task <MetaDataModel> AddMetaData(MetaDataModel metadata) { if (metadata == null) { throw new ArgumentNullException("metadata"); } var newId = _database.MetaData.Select(x => x.Id).OrderBy(x => x).LastOrDefault() + 1; metadata.Id = newId; _database.MetaData.Add(metadata); return(metadata); }
public void When_ModelIsConstructed_Then_OnlyDefaultGroupAndItemsArePresen() { string defaultGroupName = "SomeGroupName"; MetaDataModel model = new MetaDataModel(defaultGroupName, Assembly.GetExecutingAssembly()); List <string> groups = model.GetExportedMetaDataGroups().ToList(); Assert.AreEqual(1, groups.Count); Assert.AreEqual(defaultGroupName, groups[0]); List <IMetaDataItem> items = model.GetExportedMetaDataGroupItems(defaultGroupName).ToList(); Assert.AreEqual(1, items.Count); Assert.IsTrue(items[0].Name == "Executable"); Assert.IsTrue(items[0].Value.Contains("DsmSuite.Common.Model.Test")); }
public ProductModel( string name, string title, string imageRelativeUrl, string bannerImageRelativeUrl, IEnumerable <ContentSectionModel> contentSections, IEnumerable <ImageModel> galleryImages, IEnumerable <string> overviewParagraphs, IEnumerable <string> features, MetaDataModel metaData ) { Name = name; Title = title; ImageRelativeUrl = imageRelativeUrl; ContentSections = contentSections; GalleryImages = galleryImages; OverviewParagraphs = overviewParagraphs; Features = features; BannerImageRelativeUrl = bannerImageRelativeUrl; MetaData = metaData; }
public void WhenAddMetaDataItemIsCalledThenItemIsAdded() { string defaultGroupName = "DefaultGroupName"; MetaDataModel model = new MetaDataModel(defaultGroupName, Assembly.GetExecutingAssembly()); string groupName = "ImportedGroupName"; string name = "SomeItemName"; string value = "SomeItemValue1"; model.AddMetaDataItem(groupName, name, value); List <IMetaDataItem> itemsAfter = model.GetExportedMetaDataGroupItems(groupName).ToList(); Assert.AreEqual(1, itemsAfter.Count); Assert.AreEqual(name, itemsAfter[0].Name); Assert.AreEqual(value, itemsAfter[0].Value); }
public async Task <JObject> CreateItemAsync(MetaDataModel modelObject, string requestId = "") { _logger.LogInformation($"RequestId: {requestId} - MetaData_CreateItemAsync called."); Guard.Against.Null(modelObject, nameof(modelObject), requestId); try { var entityObject = MapToEntity(modelObject, requestId); return(await _metaDataRepository.CreateItemAsync(entityObject, requestId)); } catch (Exception ex) { _logger.LogError($"RequestId: {requestId} - MetaData_CreateItemAsync Service Exception: {ex}"); throw new ResponseException($"RequestId: {requestId} - MetaData_CreateItemAsync Service Exception: {ex}"); } }
public void WhenAddMetaDataItemIsCalledThenGroupIsAdded() { string defaultGroupName = "DefaultGroupName"; MetaDataModel model = new MetaDataModel(defaultGroupName, Assembly.GetExecutingAssembly()); List <string> groupsBefore = model.GetExportedMetaDataGroups().ToList(); Assert.AreEqual(1, groupsBefore.Count); string groupName = "ImportedGroupName"; string name = "SomeItemName"; string value = "SomeItemValue1"; model.AddMetaDataItem(groupName, name, value); List <string> groupsAfter = model.GetExportedMetaDataGroups().ToList(); Assert.AreEqual(2, groupsAfter.Count); Assert.AreEqual(groupsBefore[0], groupsAfter[0]); Assert.AreEqual(groupName, groupsAfter[1]); }
public ActionResult MetaData(MetaDataModel model) { SessionModelCollector sessionModel = this.GetFromSession <SessionModelCollector>("ProjectInfo"); if (sessionModel == null) //if the sessionmodel is not exists { sessionModel = new SessionModelCollector { MetaData = model, SessionId = this.SessionId() }; } else //if exists just update (so the user edited the metadata) { sessionModel.MetaData = model; } this.AddToSession("ProjectInfo", sessionModel); //add metadata to the session return(RedirectToAction("AuthorList")); }
public void WhenAddMetaDataItemIsCalledTwiceThenTwoItemIAreAddedAndOrderIsMaintained() { string defaultGroupName = "DefaultGroupName"; MetaDataModel model = new MetaDataModel(defaultGroupName, Assembly.GetExecutingAssembly()); string groupName = "ImportedGroupName"; string name1 = "SomeItemName1"; string value1 = "SomeItemValue2"; model.AddMetaDataItem(groupName, name1, value1); string name2 = "SomeItemName"; string value2 = "SomeItemValue1"; model.AddMetaDataItem(groupName, name2, value2); List <IMetaDataItem> itemsAfter = model.GetExportedMetaDataGroupItems(groupName).ToList(); Assert.AreEqual(2, itemsAfter.Count); Assert.AreEqual(name1, itemsAfter[0].Name); Assert.AreEqual(value1, itemsAfter[0].Value); Assert.AreEqual(name2, itemsAfter[1].Name); Assert.AreEqual(value2, itemsAfter[1].Value); }
public async Task <StatusCodes> UpdateItemAsync(MetaDataModel modelObject, string requestId = "") { _logger.LogInformation($"RequestId: {requestId} - MetaData_UpdateItemAsync called."); Guard.Against.Null(modelObject, nameof(modelObject), requestId); Guard.Against.NullOrEmpty(modelObject.Id, nameof(modelObject.Id), requestId); try { var entityObject = MapToEntity(modelObject, requestId); var result = await _metaDataRepository.UpdateItemAsync(entityObject, requestId); Guard.Against.NotStatus200OK(result, "MetaData_UpdateItemAsync", requestId); return(result); } catch (Exception ex) { _logger.LogError($"RequestId: {requestId} - MetaData_UpdateItemAsync Service Exception: {ex}"); throw new ResponseException($"RequestId: {requestId} - MetaDatapdateItemAsync Service Exception: {ex}"); } }
public PageModel(string mainHeading, MetaDataModel metaData) { MainHeading = mainHeading; MetaData = metaData; }
public HomePageModel( string mainHeading, IEnumerable <HomeBannerModel> banners, IEnumerable <CategoryTileModel> categoryTiles, MetaDataModel metaData ) : base(mainHeading, metaData) { Banners = banners; CategoryTiles = categoryTiles; }
public FexVersionService(MetaDataModel metaDataModel, string folder, string filenamePrefix) { _metaDataModel = metaDataModel; _folder = folder; _filenamePrefix = filenamePrefix; }
public async Task <IActionResult> Post(MetaDataModel metadata) { var newMovie = await _movieService.AddMetaData(metadata); return(CreatedAtRoute("GetMovieMetadata", new { movieId = newMovie.MovieId.Value }, newMovie)); }
public GenerationService(StatisticModel statisticModel, MetaDataModel metaDataModel, List <Section> content) { _statisticModel = statisticModel; _metaDataModel = metaDataModel; _content = content; }