public CategoryDTO(string name, string description, bool isDefault, CategoryTypes type) { this.Name = name; this.Description = description; this.IsDefault = isDefault; this.Type = type; }
public void Add(string token, string tokenType, CategoryTypes category = CategoryTypes.NULL, int index = -1) { var element = doc.CreateElement("Token"); var dataAttr = doc.CreateAttribute("Value"); var catAttr = doc.CreateAttribute("Category"); var idxAttr = doc.CreateAttribute("Index"); dataAttr.InnerText = token; var typeAttr = doc.CreateAttribute("Type"); typeAttr.InnerText = tokenType; element.Attributes.Append(typeAttr); element.Attributes.Append(dataAttr); if (category != CategoryTypes.NULL) { catAttr.InnerText = category.ToString(); element.Attributes.Append(catAttr); } if (index != -1) { idxAttr.InnerText = index.ToString(); element.Attributes.Append(idxAttr); } doc.DocumentElement.AppendChild(element); }
public void PrintCategory(CategoryTypes category) { if (category == CategoryTypes.Appetizer) { foreach (MenuItem item in Items) { if (item.Category == CategoryTypes.Appetizer) { Console.WriteLine(item.ToString()); } } } if (category == CategoryTypes.Main) { foreach (MenuItem item in Items) { if (item.Category == CategoryTypes.Main) { Console.WriteLine(item.ToString()); } } } if (category == CategoryTypes.Dessert) { foreach (MenuItem item in Items) { if (item.Category == CategoryTypes.Dessert) { Console.WriteLine(item.ToString()); } } } }
public void CreateCategory(Category category, int[] selected, int[] selected2, HttpPostedFileBase image) { Category newcategory = category; //загрузка изображения if (image != null) { newcategory.ImageMimeType = image.ContentType; newcategory.Image = new byte[image.ContentLength]; image.InputStream.Read(newcategory.Image, 0, image.ContentLength); } //загрузка типов категорий newcategory.CategoryTypes.Clear(); if (selected != null) { foreach (CategoryType item in CategoryTypes.Where(item => selected.Contains(item.Id))) { newcategory.CategoryTypes.Add(item); } } //загрузка родительских категорий newcategory.ParentCategories.Clear(); if (selected2 != null) { foreach (Category item in Categories().Where(item => selected2.Contains(item.Id))) { newcategory.ParentCategories.Add(item); } } dbcontex.Categories.Add(newcategory); dbcontex.SaveChanges(); }
public Categories(CategoryTypes type) { InitializeComponent(); DB = new FrContext(); Type = type; FillLB(); }
public static string DeleteNode(string GUID, string NodeType) { UpdateDBResult res = new UpdateDBResult(); try { CategoryTypes type = CategoryTypes.Root; if (Enum.TryParse <CategoryTypes>(NodeType, out type) == true) { switch (type) { case CategoryTypes.Category: case CategoryTypes.Component: SqlProvider.dbExecuteNoQuery("CBOMV2", "delete from CBOM_CATALOG_V2 where ID = '" + GUID + "'"); break; case CategoryTypes.Root: default: break; } } res.IsUpdated = true; } catch (Exception ex) { res.IsUpdated = false; res.ServerMessage = ex.Message; } return(Newtonsoft.Json.JsonConvert.SerializeObject(res)); }
public async Task <CategoryDTO> GetDefault(CategoryTypes type) { var categories = await this.GetCategories(); switch (type) { case CategoryTypes.Organization: return((categories).FirstOrDefault(e => e.IsDefault && e.Type == CategoryTypes.Organization)); case CategoryTypes.Condition: return((categories).FirstOrDefault(e => e.IsDefault && e.Type == CategoryTypes.Condition)); case CategoryTypes.StockType: return((categories).FirstOrDefault(e => e.IsDefault && e.Type == CategoryTypes.StockType)); case CategoryTypes.Usage: return((categories).FirstOrDefault(e => e.IsDefault && e.Type == CategoryTypes.Usage)); case CategoryTypes.InvalidType: return(null); default: return(null); } }
public MenuItem(string name, double price, string description, CategoryTypes category) { Name = name; Price = price; Description = description; Category = category; AddedOn = DateTime.Now; }
// Change category type public void ChangeCategoryTypeAction(int categoryType) { CategoryTypes type = (CategoryTypes)categoryType; SelectedCategory.CategoryType = type; BusinessLayer.UpdateCategory(SelectedCategory); RaisePropertyChanged("SelectedCategory"); }
public CategoryDTO(string name, string description, bool isDefault, int quantity, int minQuantity, int safeQuantity, bool holdsBubblers, CategoryTypes type) { this.Name = name; this.Description = description; this.IsDefault = isDefault; this.Quantity = quantity; this.MinQuantity = minQuantity; this.SafeQuantity = safeQuantity; this.HoldsBubblers = holdsBubblers; this.Type = type; }
public IActionResult Articles(CategoryTypes categoryType) { ViewBag.CategoryType = categoryType; var result = storage.Articles.Find( storage.GetSpecificationBuilder <IArticleBuilder>().ByCategoryType(categoryType).Build(), sort: storage.GetSort <ISortArticle>().AddSort(ArticleSortingType.DateDescNameAsc) ).ToList(); return(View(result)); }
public void InitializeElection(ElectionModels.Election election) { if (election != null) { IMapper mapper = Utils.CreateMapper(); mapper.Map <ElectionModels.Election, ElectionViewModel>(election, this); CategoryTypes = Utils.CategoryTypes(); SelectedCategoryType = CategoryTypes.SingleOrDefault(n => n.Id == (int)CategoryTypeEnum.measure); HasLoaded = true; } }
public static IList <Category> GetCategoriesOfObject(CategoryTypes type, int objectId) { var referenceTableName = "Category_" + type.ToString() + "_Link"; var query = string.Format(@"select c.* from[{0}] pc join[Category] c on c.Id = pc.CategoryId and c.Category_typeId = '{1}' where pc.{2}Id = '{3}'", referenceTableName, (int)type, type.ToString(), objectId); var result = GetListByQuery <Category>(query); return(result); }
public void ModelVisualizer_enum() { CategoryTypes categoryType = CategoryTypes.DiscountCategory; Dictionary <string, object> viewData = new Dictionary <string, object>(); viewData.Add("CategoryType", categoryType); SetupHtmlHelper(null, viewData); string result = _helper.ModelVisualizer(); Assert.IsTrue(result.IndexOf(@"<table border=1 ><tr><td>CategoryType</td><td>DiscountCategory</td></tr></table>") > -1); }
public static IList <Category> GetProductCategories(CategoryTypes type, int productId) { using (var db = new vinabits_homeclickEntities()) { var query = string.Format(@"select c.* from[ProductDanhSachProducts_CategoryDanhSachCategories] pc join[Category] c on c.Id = pc.DanhSachCategories and c.Category_typeId = '{0}' where pc.DanhSachProducts = '{1}'", (int)type, productId); var categories = db.Database.SqlQuery <Category>(query).ToList(); return(categories); } }
/// <summary> /// Конструктор Category /// </summary> /// <param name="categoryName">Имя категории</param> /// <param name="categoryDescription">Описание категории</param> /// <param name="type">Тип категории</param> internal Category(string categoryName, string categoryDescription, CategoryTypes type) { if (categoryName == null) { throw new ArgumentNullException("categoryName"); } if (categoryDescription == null) { throw new ArgumentNullException("categoryDescription"); } Name = categoryName; Description = categoryDescription; Type = type; }
public IList <Category> getDescendantCategories(CategoryTypes categoryType) { IList <Category> descendant = new List <Category>(); string descendantType = categoryType.ToString().ToLower(); descendant = (from cat in db.Categories where ( from product in cat.Products where (from cat2 in product.Categories where cat2.Id == this.Id select cat2).Count <Category>() > 0 select product).Count <Product>() > 0 && cat.Category_type.name == descendantType select cat).ToList <Category>(); return(descendant); }
public CategoryDTO(ICategory category) { this.Id = category.Id; this.Name = category.Name; this.Description = category.Description; this.IsDefault = category.IsDefault; this.Type = category.GetType().Name.GetEnum <CategoryTypes>(CategoryTypes.InvalidType); if (this.Type == CategoryTypes.StockType) { this.Quantity = ((StockType)category).Quantity; this.MinQuantity = ((StockType)category).MinQuantity; this.SafeQuantity = ((StockType)category).SafeQuantity; this.HoldsBubblers = ((StockType)category).HoldsBubblers; } }
/// <summary> /// Конструктор CategoryWrapper /// </summary> /// <param name="name">Имя категории</param> /// <param name="description">Описание категории</param> /// <param name="type">Тип категории</param> internal CategoryWrapper(string name, string description, CategoryTypes type) { if (name == null) { throw new ArgumentNullException("name"); } if (description == null) { throw new ArgumentNullException("description"); } Type = type; Name = name; Description = description; }
public void CreateToDoList(ApplicationUser user, string name, bool isPublic, CategoryTypes category = CategoryTypes.General) { Guard.WhenArgument(user, "user").IsNull().Throw(); Guard.WhenArgument(name, "name").IsNullOrEmpty().Throw(); var listToBeAdded = new ToDoListModel() { Name = name, IsPublic = isPublic, Category = category, Date = DateTime.Now }; user.ToDoLists.Add(listToBeAdded); unitOfWork.Commit(); }
public static List <EasyUITreeNode> GetConfigRecord(String rootid, String sales_org, String cbom_org, int nodetype) { List <EasyUITreeNode> TreeNodes = new List <EasyUITreeNode>(); try { CategoryTypes type = (CategoryTypes)Enum.ToObject(typeof(CategoryTypes), nodetype); if (type == CategoryTypes.SharedComponent) { rootid = SqlProvider.dbExecuteScalar("CBOMV2", string.Format("select top 1 ISNULL(SHARED_CATEGORY_ID,'') AS [SID] from CBOM_CATALOG_CATEGORY_V2 where ID= '{0}' ", rootid.Trim())).ToString(); if (string.IsNullOrEmpty(rootid)) { return(TreeNodes); } } List <CBOM_CATEGORY_RECORD> CBOMCategoryRecords = GetCBOMCategoryRecordByRootId(rootid, cbom_org.Substring(0, 2)); List <CBOM_CATEGORY_RECORD> RootRecord = (from q in CBOMCategoryRecords where q.ID == rootid select q).ToList(); if (RootRecord.Count == 1) { CheckSharedCategory(new List <String>(), ref CBOMCategoryRecords); EasyUITreeNode RootTreeNode = new EasyUITreeNode(RootRecord.First().ID, RootRecord.First().ID, RootRecord.First().CATEGORY_ID, "", RootRecord.First().HIE_ID, "", 0, 0, 1, 0, 0, 0, 0); RootTreeNode.csstype = NodeCssType.Tree_Node_Root; //Ryan 20171120 Check components orderable or not for ACN. CBOMCategoryRecords.RemoveAll(item => (item.CATEGORY_TYPE == CategoryTypes.Component || item.CATEGORY_TYPE == CategoryTypes.SharedComponent) && !CheckItemOrdereable(item.CATEGORY_ID, sales_org)); //if (cbomorg.ToUpper().StartsWith("CN")) // CBOMCategoryRecords.RemoveAll(item => (item.CATEGORY_TYPE == CategoryTypes.Component || item.CATEGORY_TYPE == CategoryTypes.SharedComponent) && !CheckItemOrdereable(item.CATEGORY_ID, org)); //else if (cbomorg.ToUpper().StartsWith("DL")) // CBOMCategoryRecords.RemoveAll(item => (item.CATEGORY_TYPE == CategoryTypes.Component || item.CATEGORY_TYPE == CategoryTypes.SharedComponent) && !CheckItemOrdereable(item.CATEGORY_ID, "US01")); CBOMCategoryRecordsToEasyUITreeNode(CBOMCategoryRecords, RootTreeNode); // Only have to add Special category such as EW and STD assembly if node is BTOS-Parent //if (RootTreeNode.type == (int)CategoryTypes.Root && RootTreeNode.text.Contains("-BTO")) // RuntimeAddSpecialCategory(RootTreeNode, orgid); TreeNodes.Add(RootTreeNode); } } catch { //save error } return(TreeNodes); }
private async Task ClearCategoryDefault(CategoryTypes type) { switch (type) { case CategoryTypes.Organization: var defaultOrganization = await this._context.Categories.OfType <Organization>().FirstOrDefaultAsync(e => e.IsDefault); if (defaultOrganization != null) { defaultOrganization.IsDefault = false; await this._categoryRepository.UpdateAsync(defaultOrganization); } break; case CategoryTypes.Condition: var defaultCondition = await this._context.Categories.OfType <Condition>().FirstOrDefaultAsync(e => e.IsDefault); if (defaultCondition != null) { defaultCondition.IsDefault = false; await this._categoryRepository.UpdateAsync(defaultCondition); } break; case CategoryTypes.StockType: break; case CategoryTypes.Usage: var defaultUsage = await this._context.Categories.OfType <Usage>().FirstOrDefaultAsync(e => e.IsDefault); if (defaultUsage != null) { defaultUsage.IsDefault = false; await this._categoryRepository.UpdateAsync(defaultUsage); } break; case CategoryTypes.InvalidType: break; default: break; } }
/// <summary> /// Конструктор CategoryValueData /// </summary> /// <param name="namePath">Имена родительских категорий и данной</param> /// <param name="type">Тип категории</param> /// <param name="instances">Инстансы в данной категории</param> public CategoryValueData(string[] namePath, CategoryTypes type, InstanceValueData[] instances) { if (namePath == null) { throw new ArgumentNullException("namePath"); } if (namePath.Length == 0) { throw new ArgumentException("namePath is empty"); } if (instances == null) { throw new ArgumentNullException("instances"); } NamePath = namePath; Type = type; Instances = instances; }
public override CategoryInfo CreateCategoryInfo(string key, int cases) { CategoryTypes type = CategoryTypes.NormalValue; string title = EDOConstants.LABEL_UNDEFINED; ICode code = codes.FirstOrDefault(x => x.Value == key); if (code != null) { type = ToCategoryType(code.IsMissingValue); title = code.Label; } CategoryInfo categoryInfo = new CategoryInfo(); categoryInfo.Frequency = cases; categoryInfo.CategoryType = type; categoryInfo.CodeValue = key; categoryInfo.CategoryTitle = title; return(categoryInfo); }
public void CreateTask(ToDoListModel toDoList, CategoryTypes category, PriorityTypes priority, DateTime expirationDate, string task) { Guard.WhenArgument(toDoList, "To-Do List").IsNull().Throw(); Guard.WhenArgument(expirationDate, "Expiration Date").IsLessThan(DateTime.Now.Date).Throw(); Guard.WhenArgument(task, "Task").IsNullOrEmpty().Throw(); var taskToBeAdded = new ToDoListTask() { Task = task, ExpirationDate = expirationDate, Category = category, Priority = priority }; toDoList.Tasks.Add(taskToBeAdded); unitOfWork.Commit(); }
public override async Task OnLoaded() { await base.OnLoaded(); CategoryTypes.Clear(); foreach (CategoryType ct in await DataService.InitCategoryTypes()) { CategoryTypes.Add(ct); } if (SelectedElection != null) { AllResults = await DataService.GetElectionSummary(SelectedElection.Id); await this.InitElection(); } SelectedCategoryType = CategoryTypes.FirstOrDefault(); }
public static CategoryOption GetCategoryOption(this CategoryTypes categoryType) { switch (categoryType) { case CategoryTypes.Organization: return(CategoryOption.Organization); case CategoryTypes.Condition: return(CategoryOption.Condition); case CategoryTypes.StockType: return(CategoryOption.StockType); case CategoryTypes.Usage: return(CategoryOption.Usage); case CategoryTypes.InvalidType: return(CategoryOption.NotSelected); default: return(CategoryOption.NotSelected); } }
public void SaveEditedCategory(Category category, int[] selected, int[] selected2, HttpPostedFileBase image) { Category newcategory = FindCategory(category.Id); newcategory.Title = category.Title; newcategory.Description = category.Description; //загрузка изображения if (image != null) { newcategory.ImageMimeType = image.ContentType; newcategory.Image = new byte[image.ContentLength]; image.InputStream.Read(newcategory.Image, 0, image.ContentLength); } newcategory.CategoryTypes.Clear(); if (selected != null) { foreach (CategoryType item in CategoryTypes.Where(item => selected.Contains(item.Id))) { newcategory.CategoryTypes.Add(item); } } newcategory.ParentCategories.Clear(); if (selected2 != null) { foreach (Category item in Categories().Where(item => selected2.Contains(item.Id))) { newcategory.ParentCategories.Add(item); } } dbcontex.Entry(newcategory).State = EntityState.Modified; dbcontex.SaveChanges(); }
/// <summary> /// Конструктор CategoryDescriptionData /// </summary> /// <param name="namePath">Имена родительских категорий и данной в конце</param> /// <param name="description">Описание категории</param> /// <param name="type">Тип категории</param> /// <param name="counters">Счётчики в данной категории</param> public CategoryDescriptionData(string[] namePath, string description, CategoryTypes type, CounterDescriptionData[] counters) { if (namePath == null) { throw new ArgumentNullException("namePath"); } if (namePath.Length == 0) { throw new ArgumentException("namePath is empty"); } if (description == null) { throw new ArgumentNullException("description"); } if (counters == null) { throw new ArgumentNullException("counters"); } NamePath = namePath; Description = description; Type = type; Counters = counters; }
public CategoryDTO() { this.Type = CategoryTypes.InvalidType; }
private TfsCategory(string categoryId, string categoryName, IssueTrackerCategory[] subCategories, CategoryTypes categoryType) : base(categoryId, categoryName, subCategories) { CategoryType = categoryType; }
public CategoryTypes Update(CategoryTypes categoryTypes) { throw new System.NotImplementedException(); }