Beispiel #1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        ddlTipoTags.DataTextField  = "descripcion";
        ddlTipoTags.DataValueField = "idTipo";

        if (!Page.IsPostBack)
        {
            if (Context.Items.Contains("Tag"))
            {
                TagEntity entidad = (TagEntity)Context.Items["Tag"];

                tbID.Text          = Convert.ToString(entidad.idTag);
                tbDescripcion.Text = entidad.descripcion;
                //ddlTipoTags.SelectedItem.Value = entidad.idTipo;
                ddlTipoTags.DataSource = boTipoTag.BuscarTipoAsociado(entidad.idTag);

                tbID.Enabled = false;
                ViewState.Add("Nuevo", false);
            }
            else
            {
                // Se agrega en el objeto ViewState una entrada que indica
                // que el empleado es nuevo.
                ViewState.Add("Nuevo", true);
                ddlTipoTags.DataSource = boTipoTag.Buscar("");
            }
        }
        else
        {
            ddlTipoTags.DataSource = boTipoTag.Buscar("");
        }
        ddlTipoTags.DataBind();
    }
        public async Task <BeislEntity> AddTagToBeislAsync(TagEntity tag, long beislId)
        {
            var _beisl = await _jausentestContext
                         .Beisl
                         .Include(b => b.Tags)
                         .FirstOrDefaultAsync(b => b.Id == beislId);

            if (_beisl == null)
            {
                return(null);
            }

            if (!_beisl.Tags.Contains(tag))
            {
                var _tag = await _jausentestContext.Tags.FirstOrDefaultAsync(t => t.Name == tag.Name);

                if (_tag == null)
                {
                    _tag = (await _jausentestContext.AddAsync(tag)).Entity;
                }

                _beisl.Tags.Add(_tag);
                await _jausentestContext.SaveChangesAsync();
            }

            return(_beisl);
        }
Beispiel #3
0
 public void ShowTag(TagEntity tag)
 {
     if (EventTagHandler != null)
     {
         EventTagHandler(tag);
     }
 }
        public void Update(TagEntity entity)
        {
            TagEntity tag = Get(entity.Id);

            tag.Value = entity.Value;
            Context.SaveChanges();
        }
    public async Task <Tag> Handle(CreateTagCommand request, CancellationToken cancellationToken)
    {
        if (!Tag.ValidateName(request.Name))
        {
            return(null);
        }

        var normalizedName = Tag.NormalizeName(request.Name, _tagNormalizationDictionary);

        if (_tagRepo.Any(t => t.NormalizedName == normalizedName))
        {
            return(_tagRepo.SelectFirstOrDefault(new TagSpec(normalizedName), Tag.EntitySelector));
        }

        var newTag = new TagEntity
        {
            DisplayName    = request.Name,
            NormalizedName = normalizedName
        };

        var tag = await _tagRepo.AddAsync(newTag);

        return(new()
        {
            DisplayName = newTag.DisplayName,
            NormalizedName = newTag.NormalizedName
        });
    }
Beispiel #6
0
        public static void TagPage(Guid pageId, string contextName, IEnumerable <string> tags)
        {
            var context      = GetTagContext(contextName);
            var tagContextId = context.TagContextId;

            tags = tags.Distinct();

            RemoveAllTagsForPage(pageId, context);

            foreach (var tagName in tags)
            {
                Tag tag;

                if (context.Tags.TryGetValue(tagName.ToLowerInvariant(), out tag) == false)
                {
                    var tagEntity = new TagEntity {
                        TagContextId = tagContextId,
                        TagName      = tagName
                    };
                    DataManager.Insert(tagEntity);
                    tag = Mapper.Map <TagEntity, Tag>(tagEntity);
                    context.Tags.Add(tag.TagName.ToLowerInvariant(), tag);
                }

                tag.Pages.Add(pageId);
                DataManager.Insert(new PageTagEntity {
                    PageId = pageId, TagId = tag.TagId
                });
            }
        }
Beispiel #7
0
 public void NewTag()
 {
     text = inputfield.GetComponentInChildren <Text>().text;
     Debug.Log(text.Length);
     if (text.Length == 0)
     {
         gameObject.GetComponentInChildren <Text>().text = "You must enter a name";
     }
     else if (Homepage.TagList.ContainsKey(text))
     {
         gameObject.GetComponentInChildren <Text>().text = "name cannot be a duplicate";
     }
     else
     {
         text = inputfield.GetComponentInChildren <Text>().text;
         TagEntity newTag = new TagEntity(text);
         Homepage.TagList.Add(text, newTag);
         Homepage.BoolRedraw = true;
         Destroy(gameObject);
     }
     UnityEngine.SceneManagement.Scene currentScene = SceneManager.GetActiveScene();
     if (currentScene.name.Equals("FolderPage"))
     {
         FolderPage.BoolRedraw = true;
     }
     if (currentScene.name.Equals("TagPage"))
     {
         TagPage.BoolRedraw = true;
     }
 }
        /// <summary>
        /// Transforms EDRM fields to list of EV Document field Business entities
        /// </summary>
        /// <param name="rvwDocumentBEO"> call by reference - Document object for which fields to be updated. </param>
        /// <param name="edrmDocument"> EDRM document object </param>
        /// <param name="mappedFields"> fields mapped while scheduling import. </param>
        protected virtual void TransformEDRMFieldsToDocumentFields(ref RVWDocumentBEO rvwDocumentBEO, DocumentEntity edrmDocument, List <FieldMapBEO> mappedFields)
        {
            #region Add all mapped fields
            foreach (FieldMapBEO mappedField in mappedFields)
            {
                //Create a Tag Entity for each mapped field
                TagEntity tag = new TagEntity();

                // Get tag/field from EDRM file for give mapped field
                IEnumerable <TagEntity> tagEnumerator = edrmDocument.Tags.Where(p => p.TagName.Equals(mappedField.SourceFieldName, StringComparison.CurrentCultureIgnoreCase));
                if (tagEnumerator.Count <TagEntity>() > 0)
                {
                    tag = tagEnumerator.First <TagEntity>();
                }

                // Adding Field map information only if Tag Value is available.

                // Create a Field business Entity for each mapped field
                RVWDocumentFieldBEO fieldBEO = new RVWDocumentFieldBEO()
                {
                    // set required properties / field data
                    FieldId    = mappedField.DatasetFieldID,
                    FieldName  = mappedField.DatasetFieldName,
                    FieldValue = tag.TagValue ?? string.Empty,
                    FieldType  = new FieldDataTypeBusinessEntity()
                    {
                        DataTypeId = mappedField.DatasetFieldTypeID
                    }
                };

                // Add tag to the document
                rvwDocumentBEO.FieldList.Add(fieldBEO);
            } // End of loop through fields in a document.
            #endregion
        }
Beispiel #9
0
    protected void btnRegistro_Click(object sender, EventArgs e)
    {
        try
        {
            TagEntity Tag = new TagEntity();

            Tag.idTipo      = ddlTipoTags.SelectedItem.Value;
            Tag.descripcion = tbDescripcion.Text;

            if (Convert.ToBoolean(ViewState["Nuevo"]))
            {
                boTag.Registrar(Tag);
            }
            else
            {
                boTag.Actualizar(Tag);
            }

            //Context.Items.Add("ID", Tag.idTag);
            Server.Transfer("Tags.aspx");
        }
        catch (ValidacionExcepcionAbstract ex)
        {
            WebHelper.MostrarMensaje(Page, ex.Message);
        }
    }
Beispiel #10
0
        public async Task <Tag> Create(string name)
        {
            if (!ValidateTagName(name))
            {
                return(null);
            }

            var normalizedName = NormalizeTagName(name, _tagNormalization.Value);

            if (_tagRepo.Any(t => t.NormalizedName == normalizedName))
            {
                return(Get(normalizedName));
            }

            var newTag = new TagEntity
            {
                DisplayName    = name,
                NormalizedName = normalizedName
            };

            var tag = await _tagRepo.AddAsync(newTag);

            await _audit.AddAuditEntry(EventType.Content, AuditEventId.TagCreated,
                                       $"Tag '{tag.NormalizedName}' created.");

            return(new()
            {
                DisplayName = newTag.DisplayName,
                NormalizedName = newTag.NormalizedName
            });
        }
Beispiel #11
0
        private async Task <List <ImageTagEntity> > SaveTagsAsync(string tagsString)
        {
            var savedTags = new List <ImageTagEntity>();

            if (string.IsNullOrEmpty(tagsString))
            {
                return(savedTags);
            }

            var tags = tagsString.Split(' ', StringSplitOptions.RemoveEmptyEntries);

            foreach (var tag in tags)
            {
                var tagEntity = new TagEntity
                {
                    Name = tag
                };

                TagEntity savedTag = await tagRepository.AddAsync(tagEntity);

                savedTags.Add(new ImageTagEntity
                {
                    TagId = savedTag.Id
                });
            }

            return(savedTags);
        }
Beispiel #12
0
        private void itemGridView_ItemClick(object sender, ItemClickEventArgs e)
        {
            object item = e.ClickedItem;

            if (item.GetType() == typeof(TagEntity))
            {
                _selectedTag = (TagEntity)e.ClickedItem;
                var imgSource = new BitmapImage();
                imgSource.UriSource = new Uri(_selectedTag.ImageUrl, UriKind.Absolute);
                TagImage.Source     = imgSource;
            }

            if (item.GetType() == typeof(SmileEntity))
            {
                var smile = (SmileEntity)e.ClickedItem;
                ReplyText.Text = ReplyText.Text.Insert(ReplyText.SelectionStart, smile.Title);
            }

            if (item.GetType() == typeof(BBCodeEntity))
            {
                var bbcode = (BBCodeEntity)e.ClickedItem;
                if (!string.IsNullOrEmpty(ReplyText.SelectedText))
                {
                    string selectedText = "[{0}]" + ReplyText.SelectedText + "[/{0}]";
                    ReplyText.SelectedText = string.Format(selectedText, bbcode.Code);
                }
                else
                {
                    string text      = string.Format("[{0}][/{0}]", bbcode.Code);
                    string replyText = string.IsNullOrEmpty(ReplyText.Text) ? string.Empty : ReplyText.Text;
                    ReplyText.Text = replyText.Insert(ReplyText.SelectionStart, text);
                }
            }
        }
        public ArtistEntity FromBusinessEntity(Artist businessEntity, ArtistConvertOptions options)
        {
            if (businessEntity == null)
            {
                return(null);
            }

            ArtistEntity dataEntity = new ArtistEntity()
            {
                ID           = businessEntity.ID,
                Name         = businessEntity.Name,
                PrivateMarks = businessEntity.PrivateMarks,
                Biography    = businessEntity.Biography,
                IsWaste      = businessEntity.IsWaste
            };

            if (options == ArtistConvertOptions.Full)
            {
                foreach (Tag tagBusinessEntity in businessEntity.Tags)
                {
                    TagEntity tagDataEntity = FromBusinessEntity(tagBusinessEntity);
                    dataEntity.Tags.Add(tagDataEntity);
                }

                foreach (Album albumBusinessEntity in businessEntity.Albums)
                {
                    AlbumEntity albumDataEntity = FromBusinessEntity(albumBusinessEntity);
                    dataEntity.Albums.Add(albumDataEntity);
                }
            }

            return(dataEntity);
        }
Beispiel #14
0
        public async Task <Unit> Handle(DeleteTagCommand request, CancellationToken cancellationToken)
        {
            // 1. Delete Post-Tag Association
            var postTags = await _context.PostTag
                           .Where(pt => pt.TagId == request.Id &&
                                  !pt.Post.PostPublish.IsDeleted &&
                                  pt.Post.PostPublish.IsPublished)
                           .AsNoTracking()
                           .ToListAsync(cancellationToken);

            if (postTags == null)
            {
                throw new NotFoundException(nameof(PostTagEntity), request.Id);
            }

            _context.PostTag.RemoveRange(postTags);

            // 2. Delete Tag itself
            TagEntity tag = await _context.Tag.FindAsync(request.Id);

            if (tag == null)
            {
                throw new NotFoundException(nameof(TagEntity), request.Id);
            }

            _context.Tag.Remove(tag);

            await _context.SaveChangesAsync(cancellationToken);

            return(Unit.Value);
        }
Beispiel #15
0
        public void CreateItem(int buyOut, int userId, int expire, string[] tags, string title, string description, string[] images)
        {
            List <ImageEntity> newImages = new List <ImageEntity>();

            for (int i = 0; i < images.Length; i++)
            {
                ImageEntity item = new ImageEntity();
                item.ImageOfItem = images[i];
                newImages[i]     = item;
            }
            List <TagEntity> newTags = new List <TagEntity>();

            for (int i = 0; i < tags.Length; i++)
            {
                TagEntity tag = new TagEntity();
                tag.Type   = tags[i];
                newTags[i] = tag;
            }
            ItemEntity itemEntity = new ItemEntity()
            {
                BuyOutPrice       = buyOut,
                DateCreated       = DateTime.Now,
                ExpirationDate    = DateTime.Now.AddDays(expire),
                Title             = title,
                Images            = newImages,
                Tags              = newTags,
                DescriptionOfItem = description,
                UserIdSeller      = userId,
            };

            GenerateTags(itemEntity.Title, itemEntity.ItemId);
            db.Add(itemEntity);
            db.SaveChanges();
        }
Beispiel #16
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Name")] TagEntity tagEntity)
        {
            if (id != tagEntity.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(tagEntity);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!TagEntityExists(tagEntity.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(tagEntity));
        }
Beispiel #17
0
        public async Task <bool> CanUserMaintainTagAsync(TagEntity tag, ulong userId)
        {
            if (tag is null)
            {
                throw new ArgumentNullException(nameof(tag));
            }

            var currentUser = await _userService.GetGuildUserAsync(tag.GuildId, userId);

            if (!await CanTriviallyMaintainTagAsync(currentUser))
            {
                if (tag.OwnerUser is null)
                {
                    if (!await CanUserMaintainTagOwnedByRoleAsync(currentUser, tag.OwnerRole))
                    {
                        return(false);
                    }
                }
                else if (userId != tag.OwnerUser.UserId)
                {
                    return(false);
                }
            }

            return(true);
        }
Beispiel #18
0
        public Tag GetTag(int tagID)
        {
            Tag result = null;

            ISession session = SessionFactory.GetSession();

            try
            {
                TagEntity dataEntity = session.QueryOver <TagEntity>().
                                       Where(t => t.ID == tagID).SingleOrDefault();

                EntityConverter entityConverter = new EntityConverter();

                result = entityConverter.FromDataEntity(dataEntity);
            }
            catch (Exception ex)
            {
                Logger.Write(ex);
            }
            finally
            {
                session.Close();
            }

            return(result);
        }
Beispiel #19
0
        public bool SaveTag(Tag tag)
        {
            bool result = false;

            ISession session = SessionFactory.GetSession();

            ITransaction tx = session.BeginTransaction();

            try
            {
                EntityConverter converter = new EntityConverter();

                TagEntity dataEntity = converter.FromBusinessEntity(tag);

                session.SaveOrUpdate(dataEntity);

                tx.Commit();

                tag.ID = dataEntity.ID;

                result = true;
            }
            catch (Exception ex)
            {
                Logger.Write(ex);
                tx.Rollback();
            }
            finally
            {
                session.Close();
                tx.Dispose();
            }

            return(result);
        }
Beispiel #20
0
        /// <summary>
        /// 检查 entity 为 null的情况
        /// </summary>
        /// <param name="source"></param>
        /// <returns></returns>
        private TagEntity TagEntityCheck(TagEntity source)
        {
            source.Description = source.Description ?? String.Empty;
            source.Name        = source.Name ?? String.Empty;

            return(source);
        }
Beispiel #21
0
        private string InsertTag(string newTag, string currentTag)
        {
            currentTag = currentTag?.Trim() ?? "";

            bool newTagAdded = false;

            int  nextID     = -1;
            bool nextIDUsed = true;

            if (!string.IsNullOrEmpty(newTag?.Trim()) && newTag.Trim() != "|")
            {
                string[] nt = newTag.Split(new char[] { '|' }, StringSplitOptions.RemoveEmptyEntries);

                foreach (string text in nt)
                {
                    if (!string.IsNullOrEmpty(text?.Trim()))
                    {
                        TagEntity tag = CacheHelper.GetTagList().FirstOrDefault(te => te.RowKey.Trim().ToLower() == text.Trim().ToLower());

                        if (tag == null)
                        {
                            if (nextIDUsed)
                            {
                                nextID = int.Parse(SequenceHelper.GetNextSequence("ID", Constants.TABLE_TAG, null));
                            }
                            tag = new POCO.TagEntity("Tag", text.Trim())
                            {
                                ID = nextID
                            };

                            try
                            {
                                TableStorageHelper.InsertAsync(Constants.TABLE_TAG, tag).Wait();
                                nextIDUsed  = true;
                                newTagAdded = true;
                            }
                            catch (Exception ex)
                            {
                                nextIDUsed = false;
                                CacheHelper.ClearTagListCache();
                                tag = CacheHelper.GetTagList().FirstOrDefault(te => te.RowKey.Trim().ToLower() == text.Trim().ToLower());
                            }
                        }

                        if (tag != null)
                        {
                            currentTag = currentTag + (currentTag.Trim().Length == 0 ? "|" : "") + tag.ID + "|";
                        }
                    }
                }

                if (newTagAdded)
                {
                    CacheHelper.ClearTagListCache();
                }
            }


            return(currentTag);
        }
Beispiel #22
0
        private static async Task UploadTagToBlob(TagEntity tag, ICloudBlob blob, string content, string contentType)
        {
            blob.Properties.ContentType = contentType;
            blob.Metadata.Add("id", tag.TagId);
            blob.Metadata.Add("uid", tag.Uid);
            blob.Metadata.Add("version", tag.Version);
            blob.Metadata.Add("revision", tag.Revision);

            // TODO: it would be nice if we could pre-gzip our tags in storage but that requires the client to accept
            //       gzip which not enough people seem to do.
            //blob.Properties.ContentEncoding = "gzip";
            //using (var stream = new MemoryStream(bytes.Length))
            //{
            //    using (var gzip = new GZipStream(stream, CompressionLevel.Optimal, true))
            //    {
            //        gzip.Write(bytes, 0, bytes.Length);
            //    }

            //    stream.Seek(0, SeekOrigin.Begin);
            //    blob.UploadFromStream(stream);
            //}

            var bytes = Encoding.UTF8.GetBytes(content);

            await blob.UploadFromByteArrayAsync(bytes, 0, bytes.Length);
        }
Beispiel #23
0
        public static async Task <int> Count(ApplicationDbContext context, TagEntity entity)
        {
            if (!entity.iscache ||
                Configs.GeneralSettings.cache_duration == 0 ||
                entity.pagenumber > Configs.GeneralSettings.max_cache_pages)
            {
                return(await CountRecords(context, entity));
            }
            else
            {
                string key     = GenerateKey("cnt_tag", entity);
                int    records = 0;
                if (!SiteConfig.Cache.TryGetValue(key, out records))
                {
                    records = await CountRecords(context, entity);

                    var cacheEntryOptions = new MemoryCacheEntryOptions()
                                            // Keep in cache for this time, reset time if accessed.
                                            .SetSlidingExpiration(TimeSpan.FromSeconds(3600));

                    // Save data in cache.
                    SiteConfig.Cache.Set(key, records, cacheEntryOptions);
                }
                else
                {
                    records = (int)SiteConfig.Cache.Get(key);
                }
                return(records);
            }
        }
        public void GetResult_ShouldReturnTag_WithSameProductAssociations_AsTagEntity_WhenUsedAfter_BuildProducts()
        {
            /* ARRANGE */
            TagEntity basicProps = new TagEntity {
                Id = 111, Name = "Name"
            };

            int[] expectedProductIds = { 111, 222, 333 };
            SetBasicPropertiesInMockTagEntity(basicProps);
            SetProductTagsInMockTagEntity(expectedProductIds);
            SetupMockDomainFactoryToReturnTag();
            SetupMockRepositoryFactoryToReturnProducts();

            /* ACT */
            TagConverter builder = CreateTagBuilderWithMocks();
            //builder.BuildProducts();
            ITag tag = builder.Convert(mockTagEntity.Object, (a, b) => { });

            /* ASSERT */
            for (int i = 0; i < expectedProductIds.Length; i++)
            {
                int actual = tag.Products[i].Id;
                Assert.AreEqual(expectedProductIds[i], actual);
            }
        }
Beispiel #25
0
 public ProductTagEntity(int productId, int tagId, IDAOFactory daoFactory)
 {
     this.ProductId     = productId;
     this.ProductEntity = daoFactory.ProductEntityDAO.Get(productId);
     this.TagId         = tagId;
     this.TagEntity     = daoFactory.TagEntityDAO.Get(tagId);
 }
Beispiel #26
0
        public void Actualizar(TagEntity Tag)
        {
            try
            {
                using (SqlConnection conexion = ConexionDA.ObtenerConexion())
                {
                    using (SqlCommand comando = new SqlCommand("ActualizarTag", conexion))
                    {
                        comando.CommandType = CommandType.StoredProcedure;
                        SqlCommandBuilder.DeriveParameters(comando);

                        comando.Parameters["@TagID"].Value          = Tag.idTag;
                        comando.Parameters["@TagIdtipo"].Value      = Tag.idTipo;
                        comando.Parameters["@TagDescripcion"].Value = Tag.descripcion.Trim();
                        comando.Parameters["@TagFechaAlta"].Value   = Tag.fecha_alta;
                        comando.Parameters["@TagFechaBaja"].Value   = Tag.fecha_baja;
                        comando.ExecuteNonQuery();
                    }
                    conexion.Close();
                }
            }
            catch (Exception ex)
            {
                throw new ExcepcionDA("Se produjo un error al actualizar el Tag.", ex);
            }
        }
Beispiel #27
0
 public static DalTag ToDalTag(this TagEntity tag)
 {
     return(new DalTag()
     {
         Id = tag.Id,
         Name = tag.Name
     });
 }
Beispiel #28
0
        public async Task <IActionResult> OnGetAsync(Guid tagId)
        {
            NewsEntities = await newsService.GetNewsByTagAsync(tagId);

            SelectedTag = await tagsService.GetTagAsync(tagId);

            return(Page());
        }
 public static DalTag GetDalEntity(this TagEntity bllEntity)
 {
     return(new DalTag()
     {
         Id = bllEntity.Id,
         Name = bllEntity.Name,
     });
 }
Beispiel #30
0
 public static Tag ToDataTransferTag(this TagEntity tagEntity)
 {
     return(new Tag()
     {
         Id = tagEntity.Id,
         Name = tagEntity.Name
     });
 }
        public void Then_No_Exception_Should_Be_Thrown()
        {
            TagEntity entity = new TagEntity();

             IDataImportService<TagEntity> dataImportService =
            new DataImportService<TagEntity>(databaseRepository.Object, fileRepository.Object, entity);

             dataImportService.ImportData();
        }
        public void ImportTagsFromGoodXmlFile()
        {
            TagEntity entity = new TagEntity();

             IDataImportService<TagEntity> dataImportService =
            new DataImportService<TagEntity>(databaseRepository.Object, fileRepository.Object, entity);

             dataImportService.ImportData();
        }
Beispiel #33
0
        public static void TagPage(Guid pageId, string contextName, IEnumerable<string> tags) {
            var context = GetTagContext(contextName);
            var tagContextId = context.TagContextId;
            tags = tags.Distinct();

            RemoveAllTagsForPage(pageId, context);

            foreach (var tagName in tags) {
                Tag tag;

                if (context.Tags.TryGetValue(tagName.ToLowerInvariant(), out tag) == false) { 
                    var tagEntity = new TagEntity {
                        TagContextId = tagContextId,
                        TagName = tagName
                    };
                    DataManager.Insert(tagEntity);
                    tag = Mapper.Map<TagEntity, Tag>(tagEntity);
                    context.Tags.Add(tag.TagName.ToLowerInvariant(), tag);
                }

                tag.Pages.Add(pageId);
                DataManager.Insert(new PageTagEntity { PageId = pageId, TagId = tag.TagId });
            }
        }
 public static TagEntity CreateTagEntity(int tagId, string name, string type, int color)
 {
     TagEntity tagEntity = new TagEntity();
     tagEntity.TagId = tagId;
     tagEntity.Name = name;
     tagEntity.Type = type;
     tagEntity.Color = color;
     return tagEntity;
 }
Beispiel #35
0
 public bool IsAllowedTags(uint tags)
 {
     if (this.forwardStrategies != null)
     {
         if (this.availTagEntity == null)
             this.availTagEntity = CalculateTagEntity(this.forwardStrategies);
         return (this.availTagEntity.allowTags | tags) == this.availTagEntity.allowTags;
     }
     else
         return false;
 }
        /// <summary>
        /// Transforms EDRM fields to list of EV Document field Business entities
        /// </summary>
        /// <param name="rvwDocumentBEO"> call by reference - Document object for which fields to be updated. </param>
        /// <param name="edrmDocument"> EDRM document object </param>
        /// <param name="mappedFields"> fields mapped while scheduling import. </param>
        protected virtual void TransformEDRMFieldsToDocumentFields(ref RVWDocumentBEO rvwDocumentBEO, DocumentEntity edrmDocument, List<FieldMapBEO> mappedFields)
        {
            #region Add all mapped fields
            foreach (FieldMapBEO mappedField in mappedFields)
            {
                //Create a Tag Entity for each mapped field
                TagEntity tag = new TagEntity();

                // Get tag/field from EDRM file for give mapped field
                IEnumerable<TagEntity> tagEnumerator = edrmDocument.Tags.Where(p => p.TagName.Equals(mappedField.SourceFieldName, StringComparison.CurrentCultureIgnoreCase));
                if (tagEnumerator.Count<TagEntity>() > 0) { tag = tagEnumerator.First<TagEntity>(); }

                // Adding Field map information only if Tag Value is available.

                // Create a Field business Entity for each mapped field
                RVWDocumentFieldBEO fieldBEO = new RVWDocumentFieldBEO()
                {
                    // set required properties / field data
                    FieldId = mappedField.DatasetFieldID,
                    FieldName = mappedField.DatasetFieldName,
                    FieldValue = tag.TagValue ?? string.Empty,
                    FieldType = new FieldDataTypeBusinessEntity() { DataTypeId = mappedField.DatasetFieldTypeID }
                };

                // Add tag to the document
                rvwDocumentBEO.FieldList.Add(fieldBEO);

            } // End of loop through fields in a document.           
            #endregion
        }
 public void AddToTagEntitySet(TagEntity tagEntity)
 {
     base.AddObject("TagEntitySet", tagEntity);
 }