public async Task <IHttpActionResult> PutTCategory(int id, CategoryNames tCategory)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != tCategory.Id)
            {
                return(BadRequest());
            }

            db.Entry(tCategory).State = EntityState.Modified;

            try
            {
                await db.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!TCategoryExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
예제 #2
0
        public async Task Disable([Name("카테고리")] string category)
        {
            if (!CategoryNames.Contains(category))
            {
                await Context.MsgReplyEmbedAsync($"알 수 없는 카테고리에요\n{string.Join(", ", CategoryNames.Select(c => $"`{c}`"))} 중 하나를 선택할 수 있어요");

                return;
            }

            OliveGuild.GuildSetting setting = OliveGuild.Get(Context.Guild.Id).Setting;
            CategoryType            cat     = StringToCategory(category);

            if (cat == CategoryType.Setting)
            {
                await Context.MsgReplyEmbedAsync($"비활성화 할 수 없는 카테고리에요");

                return;
            }

            if (!setting.EnabledCategories.Contains(cat))
            {
                await Context.MsgReplyEmbedAsync($"이미 비활성화돼있는 카테고리에요");

                return;
            }

            setting.EnabledCategories.Remove(cat);
            OliveGuild.Set(Context.Guild.Id, g => g.Setting, setting);

            await Context.MsgReplyEmbedAsync($"{category} 카테고리를 비활성화했어요");
        }
예제 #3
0
 public CategoryEntity(Category Category, params object[] args) : base(Category)
 {
     foreach (object arg in args)
     {
         if (arg is Category Parent)
         {
             ParentEntity = new CategoryEntity(Parent);
         }
         if (arg is ICollection <CategoryName> CategoryNames)
         {
             CategoryNameEntities = CategoryNames.Select(model => new CategoryNameEntity(model, model.Language)).ToList();
         }
         if (arg is ICollection <Category> InverseParent)
         {
             InverseParentEntities = InverseParent.Select(model => new CategoryEntity(model)).ToList();
         }
         if (arg is ICollection <ProductAttribute> ProductAttributes)
         {
             ProductAttributeEntities = ProductAttributes.Select(model => new ProductAttributeEntity(model)).ToList();
         }
         if (arg is ICollection <Product> Products)
         {
             ProductEntities = Products.Select(model => new ProductEntity(model, model.Manufacturer)).ToList();
         }
         if (arg is ICollection <Tax> Taxes)
         {
             TaxEntities = Taxes.Select(model => new TaxEntity(model, model.Country)).ToList();
         }
     }
 }
예제 #4
0
        private void CategoryLoad()
        {
            string text;

            string[] items;
            string[] splits = new string[1];
            splits[0] = OVERHEAD;

            try
            {
                foreach (var txtFile in categoryDirectoryInfo.GetFiles())
                {
                    text  = File.ReadAllText(CATEGORY_FILE_PATH + txtFile);
                    items = text.Split(splits, StringSplitOptions.RemoveEmptyEntries);

                    Category category = new Category
                    {
                        Name = items[0],
                        Kind = (ECategory)Enum.Parse(typeof(ECategory), items[1])
                    };


                    Categories.Add(category);
                    CategoryNames.Add(category.Name);
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex + DateTime.Now.ToLongTimeString());
            }
        }
        /// <summary>
        /// retrieves tags and categories for the resource
        /// </summary>
        private void RetrieveTagsAndCategories()
        {
            using (ZentityContext context = CoreHelper.CreateZentityContext())
            {
                ScholarlyWorkItem resource = context.Resources
                                             .OfType <ScholarlyWorkItem>()
                                             .Where(res => res.Id == ResourceUri)
                                             .FirstOrDefault();

                if (resource == null ||
                    !resource.Authorize("Read", context, CoreHelper.GetAuthenticationToken()))
                {
                    return;
                }

                resource.CategoryNodes.Load();
                List <string> categoryNames = resource.CategoryNodes
                                              .Select(category => category.Title)
                                              .ToList();
                CategoryNames.AddRange(categoryNames);

                resource.Tags.Load();
                List <string> tagNames = resource.Tags
                                         .Select(tag => tag.Name)
                                         .ToList();
                TagNames.AddRange(tagNames);
            }
        }
        public async Task <IHttpActionResult> GetTCategory(int id)
        {
            CategoryNames tCategory = await db.CategoryName.FindAsync(id);

            if (tCategory == null)
            {
                return(NotFound());
            }

            return(Ok(tCategory));
        }
        public ArticleViewModelCollection()
        {
            var categories = new CategoryCollection();

            //List<string> categoryList = new List<string>();
            foreach (var item in categories.AvailibleCategories.Keys)
            {
                CategoryNames.Add(new SelectListItem {
                    Text = item, Value = item
                });
            }
        }
예제 #8
0
        /// <summary>
        ///     Sets up the data bindings of the DateTime pickers and the category picker
        /// </summary>
        private void SetupDataBindings()
        {
            startDateValue.DataBindings.Clear();
            endDateValue.DataBindings.Clear();
            categoryPicker.Items.Clear();

            categoryPicker.Items.AddRange(CategoryNames.ToArray <string>());

            // This prevents crossovers on the data time pickers
            startDateValue.DataBindings.Add("MaxDate", endDateValue, "Value");
            endDateValue.DataBindings.Add("MinDate", startDateValue, "Value");
        }
        public async Task <IHttpActionResult> PostTCategory(CategoryNames tCategory)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.CategoryName.Add(tCategory);
            await db.SaveChangesAsync();

            return(CreatedAtRoute("DefaultApi", new { id = tCategory.Id }, tCategory));
        }
예제 #10
0
        private void CategoryDelete()
        {
            string   selete   = SelectCategory;
            FileInfo fileInfo = new FileInfo(CATEGORY_FILE_PATH + selete + CATEGORY_FILE_NAME);

            if (fileInfo.Exists)
            {
                fileInfo.Delete();
                Categories.Remove(Categories.Where(x => x.Name.Equals(selete)).Single());
                CategoryNames.Remove(CategoryNames.Where(x => x.Equals(selete)).Single());
            }
        }
예제 #11
0
        private void CategoryValuePush()
        {
            Category category = new Category
            {
                Name = Name,
                Kind = ECategory.Other
            };

            Categories.Add(category);
            CategorySave(category);
            CategoryNames.Add(Name);
        }
예제 #12
0
        public ContactsViewModel()
        {
            contactsinfo = new ObservableCollection <Contacts>();
            Random r = new Random();

            foreach (var cusName in CustomerNames)
            {
                var contact = new Contacts(cusName, r.Next(720, 799).ToString() + " - " + r.Next(3010, 3999).ToString());
                contact.ContactColor = Color.FromRgb(r.Next(40, 255), r.Next(40, 255), r.Next(40, 255));
                contact.Category     = CategoryNames[r.Next(0, CategoryNames.Count())];
                contactsinfo.Add(contact);
            }
        }
        public async Task <IHttpActionResult> DeleteTCategory(int id)
        {
            CategoryNames tCategory = await db.CategoryName.FindAsync(id);

            if (tCategory == null)
            {
                return(NotFound());
            }

            db.CategoryName.Remove(tCategory);
            await db.SaveChangesAsync();

            return(Ok(tCategory));
        }
예제 #14
0
        public override Task <bool> ExecuteCheckAsync(CommandContext ctx, bool help)
        {
            if (ctx.Guild == null || ctx.Member == null)
            {
                return(Task.FromResult(false));
            }

            bool contains = CategoryNames.Contains(ctx.Channel.Parent.Name, StringComparer.OrdinalIgnoreCase);

            return(CheckMode switch
            {
                ChannelCheckMode.Any => Task.FromResult(contains),
                ChannelCheckMode.None => Task.FromResult(!contains),
                _ => Task.FromResult(false),
            });
        internal ObservableCollection <ListViewShoppingCategoryInfo> GetCategoryInfo()
        {
            var categoryInfo = new ObservableCollection <ListViewShoppingCategoryInfo>();

            for (int i = 0; i < CategoryNames.Count(); i++)
            {
                var info = new ListViewShoppingCategoryInfo()
                {
                    CategoryName        = CategoryNames[i],
                    CategoryDescription = CategoryDescriptions[i],
                    CategoryImage       = ImageSource.FromResource("SampleBrowser.Icons.ListView." + CategoryNames[i] + ".png")
                };
                categoryInfo.Add(info);
            }
            return(categoryInfo);
        }
예제 #16
0
        internal ObservableCollection <ListViewShoppingCategoryInfo> GetCategoryInfo()
        {
            var categoryInfo = new ObservableCollection <ListViewShoppingCategoryInfo>();

            for (int i = 0; i < CategoryNames.Count(); i++)
            {
                var info = new ListViewShoppingCategoryInfo()
                {
                    CategoryName        = CategoryNames[i],
                    CategoryDescription = CategoryDescriptions[i],
                    CategoryImage       = CategoryImages[i]
                };
                categoryInfo.Add(info);
            }
            return(categoryInfo);
        }
예제 #17
0
        public async System.Threading.Tasks.Task RemoveCat(Category cat)
        {
            var        catIdJson  = JsonConvert.SerializeObject(cat.Id);
            HttpClient httpClient = new HttpClient();
            var        url        = $"http://localhost:5001/api/Category/{cat.Id}";
            var        res        = await httpClient.DeleteAsync(new Uri(url));

            if (res.IsSuccessStatusCode)
            {
                var deletedCat = Categories.SingleOrDefault((t) => t.Id == cat.Id);
                if (deletedCat != null)
                {
                    Categories.Remove(deletedCat);
                    CategoryNames.Remove(deletedCat.Name);
                    Travellist.Categories.Remove(deletedCat);
                }
            }
        }
예제 #18
0
 public LanguageEntity(Language Language, params object[] args) : base(Language)
 {
     foreach (object arg in args)
     {
         if (arg is ICollection <CategoryName> CategoryNames)
         {
             CategoryNameEntities = CategoryNames.Select(model => new CategoryNameEntity(model, model.Category)).ToList();
         }
         if (arg is ICollection <ProductAttributeName> ProductAttributeNames)
         {
             ProductAttributeNameEntities = ProductAttributeNames.Select(model => new ProductAttributeNameEntity(model, model.ProductAttribute)).ToList();
         }
         if (arg is ICollection <ProductValue> ProductValues)
         {
             ProductValueEntities = ProductValues.Select(model => new ProductValueEntity(model, model.Attribute, model.Product)).ToList();
         }
     }
 }
예제 #19
0
        public async System.Threading.Tasks.Task AddNewCat(string name)
        {
            var cat = new Category()
            {
                Name = name, DoneCat = false, Items = new List <Item>()
            };
            var        catJson    = JsonConvert.SerializeObject(cat);
            HttpClient httpClient = new HttpClient();
            var        res        = await httpClient.PostAsync(new Uri("http://localhost:5001/api/Category/"),
                                                               new HttpStringContent(catJson, Windows.Storage.Streams.UnicodeEncoding.Utf8, "application/json"));

            if (res.IsSuccessStatusCode)
            {
                Category newCat = JsonConvert.DeserializeObject <Category>(res.Content.ToString());
                Categories.Add(newCat);
                Travellist.Categories.Add(newCat);
                CategoryNames.Add(newCat.Name);
            }
        }
예제 #20
0
        private void loadCategories()
        {
            //HttpClient httpClient = new HttpClient();
            //var json = await httpClient.GetStringAsync(new Uri("http://localhost:5001/api/Category"));
            //var categoryList = JsonConvert.DeserializeObject<IList<Category>>(json);


            var categoryList = Travellist.Categories;

            if (categoryList != null)
            {
                foreach (var c in categoryList)
                {
                    List <Item> orderdItems = c.Items.OrderBy(i => i.Name).ToList();
                    c.Items = orderdItems;
                    Categories.Add(c);
                    CategoryNames.Add(c.Name);
                }
            }
        }
		/// <summary>
		/// Parses the category specified in the configuration specified for the type specified, and returns an array of Versions that are listed in the category.
		/// </summary>
		/// <param name="configuration">The configuration to parse</param>
		/// <param name="type">The type to search for</param>
		/// <param name="categoryName">The category to search in</param>
		/// <returns></returns>
		public static Version[] GetListedVersionsOfType(XmlConfiguration configuration, Type type, CategoryNames categoryName)
		{
			try
			{				
				if (configuration != null)
				{					
					if (type != null)
					{
						// start in the specified category
						XmlConfigurationCategory searchCategory = configuration.Categories[@"SnapIns\" + categoryName.ToString()];
						if (searchCategory != null)
						{
							// enumerate the type category, each subcategory is the full name of a type that is listed
							foreach(XmlConfigurationCategory typeCategory in searchCategory.Categories)
							{
								// compare the category's element name to the full name of the type specified
								if (string.Compare(typeCategory.ElementName, type.FullName, false) == 0)
								{
									// enumerate the version category, each subcategory is the version number of the type
									ArrayList array = new ArrayList();
									foreach(XmlConfigurationCategory versionCategory in typeCategory.Categories)
									{
										Version v = new Version(versionCategory.ElementName);
										array.Add(v);
									}
									return array.ToArray(typeof(Version)) as Version[];
								}
							}
						}
					}
				}
			}
			catch(System.Exception systemException)
			{
				System.Diagnostics.Trace.WriteLine(systemException);
			}			
			return new Version[] {};
		}
예제 #22
0
        /// <summary>
        /// Creates a category for the type including it's version (defaulted to "1.0.0.0" for versionless types) in the specified configuration, using the specified type, and specified category name.
        /// </summary>
        /// <param name="configuration">The configuration in which the category will be created</param>
        /// <param name="type">The type for which the category will be created</param>
        /// <param name="categoryName">The category name in which creation will occur</param>
        /// <returns></returns>
        public static XmlConfigurationCategory CreateCategoryForTypeVersion(XmlConfiguration configuration, Type type, CategoryNames categoryName)
        {
            try
            {
                if (configuration != null)
                {
                    if (type != null)
                    {
                        // start in the specified category
                        XmlConfigurationCategory searchCategory = configuration.Categories[@"SnapIns\" + categoryName.ToString()];
                        if (searchCategory != null)
                        {
                            SnapInAttributeReader reader = new SnapInAttributeReader(type);
                            if (reader != null)
                            {
                                Version version = null;
                                SnapInVersionAttribute versionAttribute = reader.GetSnapInVersionAttribute();
                                if (versionAttribute != null)
                                {
                                    version = versionAttribute.Version;
                                }
                                else
                                {
                                    version = new Version(1, 0, 0, 0);
                                }

                                string path = string.Format("{0}\\{1}\\{2}", @"SnapIns\" + categoryName.ToString(), type.FullName, version.ToString());
                                return(configuration.Categories[path, true]);
                            }
                        }
                    }
                }
            }
            catch (System.Exception systemException)
            {
                System.Diagnostics.Trace.WriteLine(systemException);
            }
            return(null);
        }
예제 #23
0
        internal ObservableCollection <ListViewShoppingCategoryInfo> GetCategoryInfo()
        {
            var      categoryInfo = new ObservableCollection <ListViewShoppingCategoryInfo>();
            Assembly assembly     = typeof(GettingStarted).GetTypeInfo().Assembly;

            for (int i = 0; i < CategoryNames.Count(); i++)
            {
                var info = new ListViewShoppingCategoryInfo()
                {
                    CategoryName        = CategoryNames[i],
                    CategoryDescription = CategoryDescriptions[i],
#if COMMONSB
                    CategoryImage = ImageSource.FromResource("SampleBrowser.Icons." + CategoryNames[i] + ".jpg", assembly)
#else
                    CategoryImage = ImageSource.FromResource("SampleBrowser.SfListView.Icons." + CategoryNames[i] + ".jpg", assembly)
#endif
                };
                categoryInfo.Add(info);
            }
            return(categoryInfo);
        }

        #endregion

        #region CategoryInfo

        string[] CategoryNames = new string[]
        {
            "Fashion",
            "Electronics",
            "Home & Kitchen",
            "Sports & Health",
            "Kids",
            "Books",
            "Footware",
            "Mobile & Accesories",
            "FlowerGiftCakes",
            "Watches",
            "Jewellery",
            "Food",
            "Perfumes",
            "Movies & Music",
            "Cameras & Optics"
        };

        string[] CategoryDescriptions = new string[]
        {
            "Latest fashion trends in online shopping for branded Shoes, Clothing, Dresses, Handbags, Watches, Home decor for Men & Women...",
            "Shop variety of electronics like Mobiles, Laptops, Tablets, Cameras, Gaming Consoles, TVs, LEDs, Music Systems & much more...",
            "Purchase Home & Kitchen accessories like Cookware, Home Cleaning, Furniture, Dining Accessories, Showcase accessories etc ...",
            "Buy accessories for Badminton, Cricket, Football, Swimming, Sports shoes, Tennis, Gym, Volleyball, hockey at lowest price...",
            "Shop for clothing for Boys, Girls and Babies. Explore the range of Tops, Tees, Jeans, Shirts, Trousers, Skirts, Body Suits...",
            "Purchase various books with Book titles with across various categories at lowest price. Read books online and download as pdf...",
            "Buy Footwear for Men, Women & Kids with collection of Formal Shoes, Slippers, Casual Shoes, Sandals and more with best price...",
            "Buy branded Mobile Phones, SmartPhones, Tablets and mobile accessories are Bluetooth, Headsets, MemoryCards, Charger & Covers etc...",
            "Buy different Flowers, Gifts & Cakes in online shopping. Birthday Gifts, Anniversary Gifts, MothersDay Gifts, Flowers and Cakes etc...",
            "Latest range of trendy branded, Digital watches & Analog watches, Digital Steel Watch, Digital LED Watches for Men's and Women's...",
            "Buy Jewellery for Men, Women and Children from brands like Gitanjali, Tara, Orra, Sia Art Jewellery, Addons, Ayesha, Peora etc...",
            "Shop from a wide range of best quality Fruits, Vegetables, Health Food, Indian Grocery, Pulses, Cereals, Noodles, Foods etc...",
            "Choose the best branded Perfume like Azzaro, Davidoff, CK, Axes, Good Morning, Hugo Boss, Jaguar, Calvin Klein & Antonio etc...",
            "Buy variety of Movies & TV Blu-ray in different languages and Musics in variety of formats like audio CD, DVD, MP3, VCD etc...",
            "Purchase variety of Cameras like Tamron, Sigma, Nikon, Sony, and Canon at best prices and SLRs, Lenses and Optics accessories..."
        };

        #endregion
    }
예제 #24
0
 /// <summary>
 /// Parses the category specified in the configuration specified for the type specified, and returns an array of Versions that are listed in the category.
 /// </summary>
 /// <param name="configuration">The configuration to parse</param>
 /// <param name="type">The type to search for</param>
 /// <param name="categoryName">The category to search in</param>
 /// <returns></returns>
 public static Version[] GetListedVersionsOfType(XmlConfiguration configuration, Type type, CategoryNames categoryName)
 {
     try
     {
         if (configuration != null)
         {
             if (type != null)
             {
                 // start in the specified category
                 XmlConfigurationCategory searchCategory = configuration.Categories[@"SnapIns\" + categoryName.ToString()];
                 if (searchCategory != null)
                 {
                     // enumerate the type category, each subcategory is the full name of a type that is listed
                     foreach (XmlConfigurationCategory typeCategory in searchCategory.Categories)
                     {
                         // compare the category's element name to the full name of the type specified
                         if (string.Compare(typeCategory.ElementName, type.FullName, false) == 0)
                         {
                             // enumerate the version category, each subcategory is the version number of the type
                             ArrayList array = new ArrayList();
                             foreach (XmlConfigurationCategory versionCategory in typeCategory.Categories)
                             {
                                 Version v = new Version(versionCategory.ElementName);
                                 array.Add(v);
                             }
                             return(array.ToArray(typeof(Version)) as Version[]);
                         }
                     }
                 }
             }
         }
     }
     catch (System.Exception systemException)
     {
         System.Diagnostics.Trace.WriteLine(systemException);
     }
     return(new Version[] {});
 }
		/// <summary>
		/// Creates a category for the type including it's version (defaulted to "1.0.0.0" for versionless types) in the specified configuration, using the specified type, and specified category name.
		/// </summary>
		/// <param name="configuration">The configuration in which the category will be created</param>
		/// <param name="type">The type for which the category will be created</param>
		/// <param name="categoryName">The category name in which creation will occur</param>
		/// <returns></returns>
		public static XmlConfigurationCategory CreateCategoryForTypeVersion(XmlConfiguration configuration, Type type, CategoryNames categoryName)
		{
			try
			{
				if (configuration != null)
				{					
					if (type != null)
					{
						// start in the specified category
						XmlConfigurationCategory searchCategory = configuration.Categories[@"SnapIns\" + categoryName.ToString()];
						if (searchCategory != null)
						{
							SnapInAttributeReader reader = new SnapInAttributeReader(type);
							if (reader != null)
							{
								Version version = null;
								SnapInVersionAttribute versionAttribute = reader.GetSnapInVersionAttribute();
								if (versionAttribute != null)
									version = versionAttribute.Version;
								else
									version = new Version(1, 0, 0, 0);
								
								string path = string.Format("{0}\\{1}\\{2}", @"SnapIns\" + categoryName.ToString(), type.FullName, version.ToString());
								return configuration.Categories[path, true];
							}
						}
					}
				}
			}
			catch(System.Exception systemException)
			{
				System.Diagnostics.Trace.WriteLine(systemException);
			}
			return null;
		}