コード例 #1
0
        /// <summary>
        /// Initialize a dictionary item (KeyValuePair) TagInfo.
        /// </summary>
        /// <param name="keyType"></param>
        /// <param name="valueType"></param>
        public TagInfo(TagInfo parent, XElement keyElement, Type keyType, XElement valueElement, Type valueType)
        {
            if (keyElement.Name.ToString() != "key" || keyElement.HasElements)
            {
                throw new ArgumentException("Invalid element.", "keyElement");
            }

            if (valueElement.Name.ToString() != "value" || valueElement.HasElements)
            {
                throw new ArgumentException("Invalid element.", "valueElement");
            }

            this.parent               = parent;
            this.tagCategory          = TagCategory.DictItem;
            this.tagName              = "li";
            this.className            = null;
            this.tagType              = null;
            this.typeName             = null;
            this.availableValues      = null;
            this.defaultValueAsString = null;
            this.description          = null;
            this.alias = null;

            this.allTags = new Dictionary <string, TagInfo>();

            allTags.Add("key", new TagInfo(this, keyElement, keyType));
            allTags.Add("value", new TagInfo(this, valueElement, valueType));
        }
コード例 #2
0
 /// <summary>
 /// Initialize a Reference Item TagInfo
 /// </summary>
 /// <param name="tagName"></param>
 private TagInfo(TagInfo parent, FieldInfo fieldInfo)
 {
     this.parent      = parent;
     this.tagCategory = TagCategory.ListRefItem;
     this.tagName     = fieldInfo.Name;
     this.tagType     = fieldInfo.FieldType;
     this.typeName    = Helper.GetTypeName(this.tagType);
 }
コード例 #3
0
        public async Task <TagCategory> UpdateTagCategory(TagCategory tagCategory)
        {
            var updatedTagCategory = await tagCategoryRepository.UpdateTagCategory(tagCategory);

            await tagCategoryRepository.SaveChangesAsync();

            return(updatedTagCategory);
        }
コード例 #4
0
 public void Create(TagCategory tagCategory)
 {
     using (var session = DocumentStoreLocator.ResolveOrRoot(CommonConfiguration.CoreDatabaseRoute))
     {
         session.Store(tagCategory);
         session.SaveChanges();
     }
 }
コード例 #5
0
ファイル: TagRecordEditor.cs プロジェクト: ischoolinc/JHCore
 internal TagRecordEditor(TagCategory category)
 {
     Tag      = null;
     Remove   = false;
     ID       = Prefix = Name = string.Empty;
     Category = category.ToString();
     Color    = System.Drawing.Color.White;
 }
コード例 #6
0
 public bool IsUnique(TagCategory tagCategory)
 {
     using (var session = DocumentStoreLocator.ResolveOrRoot(CommonConfiguration.CoreDatabaseRoute))
     {
         return
             (session.Query <TagCategory>().ToArray().FirstOrDefault(
                  x => x.Name.Equals(tagCategory.Name, StringComparison.InvariantCultureIgnoreCase)) == null);
     }
 }
コード例 #7
0
ファイル: Selector.cs プロジェクト: thabet-fix/ndoctor
        /// <summary>
        /// Gets the tag for patient that contain the specified name.
        /// </summary>
        /// <param name="name">The name.</param>
        /// <returns></returns>
        public IList <TagDto> GetTags(string name, TagCategory type)
        {
            var tags = (from tag in this.Session.Query <Tag>()
                        where tag.Category == type &&
                        tag.Name.Contains(name)
                        select tag).ToList();

            return(Mapper.Map <IList <Tag>, IList <TagDto> >(tags));
        }
コード例 #8
0
        public void Create(string categoryName, KnownColor knownColor)
        {
            var tagCategory = new TagCategory
            {
                Color = knownColor,
                Name  = categoryName
            };

            _tagCategoryManager.Create(tagCategory);
        }
コード例 #9
0
        public bool IsUnique(string categoryName, KnownColor knownColor)
        {
            var tagCategory = new TagCategory
            {
                Color = knownColor,
                Name  = categoryName,
            };

            return(_tagCategoryManager.IsUnique(tagCategory));
        }
コード例 #10
0
        internal static Entities.TagCategory ToEntity(TagCategory tagCategory, MintPlayerContext mintplayer_context)
        {
            if (tagCategory == null)
            {
                return(null);
            }
            var entity_tag_category = new Entities.TagCategory
            {
                Id          = tagCategory.Id,
                Color       = tagCategory.Color,
                Description = tagCategory.Description
            };

            return(entity_tag_category);
        }
コード例 #11
0
ファイル: Selector.cs プロジェクト: thabet-fix/ndoctor
        /// <summary>
        /// Gets all the tags with the specified catagory.
        /// </summary>
        /// <returns></returns>
        public IList <TagDto> GetTags(TagCategory category)
        {
            var tags = (from tag in this.Session.Query <Tag>()
                        where tag.Category == category
                        select tag).ToList();

            if (category == TagCategory.Appointment)
            {
                tags = (from tag in tags
                        where tag.Name != Default.GoogleCalendarTagName
                        select tag).ToList();
            }

            return(Mapper.Map <IEnumerable <Tag>, IList <TagDto> >(tags));
        }
コード例 #12
0
        public void AddTagCategory(TagCategory newCategory)
        {
            using (var session = DocumentStoreLocator.ResolveOrRoot(CommonConfiguration.CoreDatabaseRoute))
            {
                var tagCategoryName = newCategory.Name;

                //As far as I know, RavenDB uses a custom LowerCaseKeywordAnalyzer, so by default queries are case-insensitive.
                var tc = session.Load <TagCategory>(tagCategoryName);
                if (tc != null)
                {
                    return;
                }
                session.Store(newCategory);
                session.SaveChanges();
            }
        }
コード例 #13
0
        public ActionResult Edit(Guid?id)
        {
            TagCategory block;

            if (id == null)
            {
                block = new TagCategory();
            }
            else
            {
                block = DbSession.Get <TagCategory>(id.Value);
            }
            if (block == null)
            {
                return(HttpNotFound());
            }
            return(View(block));
        }
コード例 #14
0
        /// <summary>
        /// Initialize a flag item TagInfo from enum type.
        /// </summary>
        /// <param name="flagEnumType"></param>
        private TagInfo(TagInfo parent, Type flagEnumType)
        {
            if (!flagEnumType.IsEnum)
            {
                throw new ArgumentException("Invalid type, must use enum type.", "flagEnumType");
            }

            this.parent               = parent;
            this.tagCategory          = TagCategory.FlagItem;
            this.tagName              = "li";
            this.className            = null;
            this.tagType              = flagEnumType;
            this.typeName             = null;
            this.availableValues      = null;
            this.defaultValueAsString = null;
            this.description          = null;
            this.alias = null;
        }
コード例 #15
0
    VarRef.Tag RandTag(TagCategory category)
    {
        int min = 0;
        int max = 0;

        switch (category)
        {
        case TagCategory.Gender:
            min = 0; max = 2;
            break;

        case TagCategory.Age:
            min = 2; max = 5;
            break;

        case TagCategory.Location:
            min = 5; max = 7;
            break;

        case TagCategory.Occupation:
            min = 7; max = 10;
            break;

        case TagCategory.Family:
            min = 10; max = 13;
            break;

        case TagCategory.Financial:
            min = 13; max = 16;
            break;

        case TagCategory.Searched:
            min = 16; max = 24;
            break;

        default:
            break;
        }
        int rand = Random.Range(min, max);

        VarRef.Tag ret = (VarRef.Tag)rand;

        return(ret);
    }
コード例 #16
0
        public async Task <TagCategory> UpdateTagCategory(TagCategory tagCategory)
        {
            // Find existing tag category
            var entity_tag_category = await mintplayer_context.TagCategories.FindAsync(tagCategory.Id);

            // Set new properties
            entity_tag_category.Color       = tagCategory.Color;
            entity_tag_category.Description = tagCategory.Description;

            // Set UserUpdate
            var user = await user_manager.GetUserAsync(http_context.HttpContext.User);

            entity_tag_category.UserUpdate = user;
            entity_tag_category.DateUpdate = DateTime.Now;

            // Update
            mintplayer_context.Update(entity_tag_category);
            return(ToDto(entity_tag_category));
        }
コード例 #17
0
        public when_importing_one_category_into_another()
        {
            b1 = new Mock <ITagBuilderPolicy>().Object;
            b2 = new Mock <ITagBuilderPolicy>().Object;
            b3 = new Mock <ITagBuilderPolicy>().Object;
            b4 = new Mock <ITagBuilderPolicy>().Object;
            b5 = new Mock <ITagBuilderPolicy>().Object;
            b6 = new Mock <ITagBuilderPolicy>().Object;
            b7 = new Mock <ITagBuilderPolicy>().Object;
            b8 = new Mock <ITagBuilderPolicy>().Object;

            m1 = new Mock <ITagModifier>().Object;
            m2 = new Mock <ITagModifier>().Object;
            m3 = new Mock <ITagModifier>().Object;
            m4 = new Mock <ITagModifier>().Object;
            m5 = new Mock <ITagModifier>().Object;

            category1 = new TagCategory();
            category1.Add(b1);
            category1.Add(b2);
            category1.Add(m1);
            category1.Add(m2);

            category1.ForProfile("A").Add(b3);
            category1.ForProfile("A").Add(m3);

            category1.ForProfile("B").Add(b4);

            category1.ForProfile("D").Add(b8);


            var category2 = new TagCategory();

            category2.Add(b5);
            category2.Add(m4);
            category2.ForProfile("A").Add(b6);
            category2.ForProfile("C").Add(b7);
            category2.ForProfile("B").Add(m5);


            category1.Import(category2);
        }
コード例 #18
0
        public void SetUp()
        {
            b1 = MockRepository.GenerateMock <ITagBuilder <FakeSubject> >();
            b2 = MockRepository.GenerateMock <ITagBuilder <FakeSubject> >();
            b3 = MockRepository.GenerateMock <ITagBuilder <FakeSubject> >();
            b4 = MockRepository.GenerateMock <ITagBuilder <FakeSubject> >();
            b5 = MockRepository.GenerateMock <ITagBuilder <FakeSubject> >();
            b6 = MockRepository.GenerateMock <ITagBuilder <FakeSubject> >();
            b7 = MockRepository.GenerateMock <ITagBuilder <FakeSubject> >();
            b8 = MockRepository.GenerateMock <ITagBuilder <FakeSubject> >();

            m1 = MockRepository.GenerateMock <ITagModifier <FakeSubject> >();
            m2 = MockRepository.GenerateMock <ITagModifier <FakeSubject> >();
            m3 = MockRepository.GenerateMock <ITagModifier <FakeSubject> >();
            m4 = MockRepository.GenerateMock <ITagModifier <FakeSubject> >();
            m5 = MockRepository.GenerateMock <ITagModifier <FakeSubject> >();

            category1 = new TagCategory <FakeSubject>();
            category1.Add(b1);
            category1.Add(b2);
            category1.Add(m1);
            category1.Add(m2);

            category1.ForProfile("A").Add(b3);
            category1.ForProfile("A").Add(m3);

            category1.ForProfile("B").Add(b4);

            category1.ForProfile("D").Add(b8);


            var category2 = new TagCategory <FakeSubject>();

            category2.Add(b5);
            category2.Add(m4);
            category2.ForProfile("A").Add(b6);
            category2.ForProfile("C").Add(b7);
            category2.ForProfile("B").Add(m5);


            category1.Import(category2);
        }
コード例 #19
0
        public async Task <TagCategory> InsertTagCategory(TagCategory tagCategory)
        {
            // Get current user
            var user = await user_manager.GetUserAsync(http_context.HttpContext.User);

            // Convert to entity
            var entity_tag_category = ToEntity(tagCategory, mintplayer_context);

            entity_tag_category.UserInsert = user;
            entity_tag_category.DateInsert = DateTime.Now;

            // Add to database
            await mintplayer_context.TagCategories.AddAsync(entity_tag_category);

            await mintplayer_context.SaveChangesAsync();

            var new_tag_category = ToDto(entity_tag_category);

            return(new_tag_category);
        }
コード例 #20
0
ファイル: ModelSetup.cs プロジェクト: rgtodd/quiltsystem
        private static void CreateTagCategory(QuiltContext ctx, string tagCategoryCode, string name)
        {
            Console.WriteLine("CreateTagCategory {0}", tagCategoryCode);

            var dbTagCategory = ctx.TagCategories.Where(r => r.TagCategoryCode == tagCategoryCode).SingleOrDefault();

            if (dbTagCategory == null)
            {
                dbTagCategory = new TagCategory()
                {
                    TagCategoryCode = tagCategoryCode,
                    Name            = name
                };
                _ = ctx.TagCategories.Add(dbTagCategory);
            }
            else
            {
                dbTagCategory.Name = name;
            }
        }
コード例 #21
0
        public ActionResult EditPost(Guid id)
        {
            TagCategory block;

            if (Guid.Empty.Equals(id))
            {
                block = new TagCategory();
            }
            else
            {
                block = DbSession.Get <TagCategory>(id);
            }
            if (TryUpdateModel(block))
            {
                DbSession.SaveOrUpdate(block);
                DbSession.Flush();
                NHibernateHelper.ClearCache("tags");
                return(RedirectToAction("Edit", new { id = block.ID }));
            }

            return(View(block));
        }
コード例 #22
0
ファイル: TranslateEnum.cs プロジェクト: seniorOtaka/ndoctor
        public static string Translate(this TagCategory tagtype)
        {
            switch (tagtype)
            {
            case TagCategory.Appointment:
                return(Messages.TagType_Appointment);

            case TagCategory.Doctor:
                return(Messages.TagType_Doctor);

            case TagCategory.Picture:
                return(Messages.TagType_Picture);

            case TagCategory.MedicalRecord:
                return(Messages.TagType_MedicalRecord);

            case TagCategory.Patient:
                return(Messages.TagType_Patient);

            case TagCategory.Drug:
                return(Messages.TagType_Drug);

            case TagCategory.Prescription:
                return(Messages.TagType_Prescription);

            case TagCategory.PrescriptionDocument:
                return(Messages.TagType_PrescriptionDocument);

            case TagCategory.Pathology:
                return(Messages.TagType_Pathology);

            default:
                Assert.FailOnEnumeration(tagtype);
                return(null);
            }
        }
コード例 #23
0
 public TagCategoryTester()
 {
     theCategory = new TagCategory();
 }
コード例 #24
0
 /// <summary>
 /// Gets all the tags with the specified catagory.
 /// </summary>
 /// <returns></returns>
 public IList<TagDto> GetTags(TagCategory category)
 {
     return new Selector(this.Session).GetTags(category);
 }
コード例 #25
0
 /// <summary>
 /// Initializes a new instance of the <see cref="TagDto"/> class.
 /// </summary>
 /// <param name="category">The category.</param>
 public TagDto(TagCategory category)
     : base(new TagValidator())
 {
     this.Category = category;
 }
コード例 #26
0
 public void Category(string name, TagCategory <ElementRequest> category)
 {
     _category = name;
 }
コード例 #27
0
 /// <summary>
 /// Gets all the tags with the specified catagory.
 /// </summary>
 /// <returns></returns>
 public IList <TagDto> GetTags(TagCategory category)
 {
     return(new Selector(this.Session).GetTags(category));
 }
コード例 #28
0
        public async Task <ActionResult <TagCategory> > Post([FromBody] TagCategory tagCategory)
        {
            var newTagCategory = await tagCategoryService.InsertTagCategory(tagCategory);

            return(Ok(newTagCategory));
        }
コード例 #29
0
        public async Task <TagCategory> InsertTagCategory(TagCategory tagCategory)
        {
            var newTagCategory = await tagCategoryRepository.InsertTagCategory(tagCategory);

            return(newTagCategory);
        }
コード例 #30
0
ファイル: TagImporter.cs プロジェクト: thabet-fix/ndoctor
 public TagImporter(SQLiteConnection connection, IImportComponent component, TagCategory category, string table)
     : base(connection, component, category.ToString())
 {
     this.Table    = table;
     this.Category = category;
 }
コード例 #31
0
 /// <summary>
 /// Gets all the tags with the specified catagory.
 /// </summary>
 /// <param name="category"></param>
 /// <returns></returns>
 public IEnumerable<TagDto> GetTags(TagCategory category)
 {
     return new Selector(this.Session).GetTags(category);
 }
コード例 #32
0
        public async Task <ActionResult <TagCategory> > Put(int id, [FromBody] TagCategory tagCategory)
        {
            var updatedTagCategory = await tagCategoryService.UpdateTagCategory(tagCategory);

            return(Ok(updatedTagCategory));
        }