public List <DisplayCategoryMessage> RetriveAllCategoryMessage(string group = null) { string me = whoami(); if (string.IsNullOrEmpty(group)) { group = MembershipHelper.DefaultGroup(me); } else { MembershipHelper.CheckMembership(group, me); } List <DisplayCategoryMessage> msgs = new List <DisplayCategoryMessage>(); List <Category> categories = _categoryManager.GetCategoryByGroup(group); foreach (var category in categories) { CategoryMessage msg = _categoryManager.RetriveCategoryMessage(me, category); if (msg != null) { msgs.Add(ToDisplayCategoryMessage(msg, me)); } } return(msgs); }
public ActionResult EditCategoryMessage(Guid Categoryid, int p) { CategoryMessage categorymessage = categorymessageService.GetByID(Categoryid); ViewBag.pageNumber = p; return(View(categorymessage)); }
public ActionResult DeleteCategoryMessage(Guid Categoryid) { CategoryMessage categorymessage = categorymessageService.GetByID(Categoryid); categorymessageService.Delete(categorymessage); categorymessageService.SaveChanges(); return(RedirectToAction("CategoryMessage")); }
public CategoryMessage UpdateCategoryMessage(string[] eventIDs, string from, string to, Category category, DateTime timestamp) { CategoryMessage message = new CategoryMessage(eventIDs, from, to, category, timestamp); TableOperation insertOperation = TableOperation.InsertOrReplace((CategoryMessageEntity)message); _categoryMsgTable.Execute(insertOperation); return(message); }
private void FilterByCategoryId(CategoryMessage categoryMessage) { var selectedItems = from product in _productRepository.GetProductList() from c in product.Product_Category_Mapping where c.CategoryId == categoryMessage.Id //tagsIDList.Contains(t.TagID) select product; _selectedItems = new ObservableCollection <Domain.Core.Product>(selectedItems); RaisePropertyChanged("Products"); }
public DisplayCategory ToDisplayCategory(Category category, string userid) { DisplayCategory dcat = category; CategoryMessage msg = _categoryManager.RetriveCategoryMessage(userid, category); if (msg != null && msg.EventIDs != null) { dcat.EventCount = msg.EventIDs.Count; } return(dcat); }
public ActionResult EditCategoryMessage(Guid Categoryid) { CategoryMessage categorymessage = categorymessageService.GetByID(Categoryid); if (TryUpdateModel(categorymessage, new string[] { "Categoryname" }) && ModelState.IsValid) { categorymessageService.Update(categorymessage); categorymessageService.SaveChanges(); } return(RedirectToAction("CategoryMessage")); }
public ActionResult AddCategoryMessage(CategoryMessage categorymessage) { if (TryUpdateModel(categorymessage, new string[] { "Categoryname" }) && ModelState.IsValid) { categorymessage.Categoryid = Guid.NewGuid(); categorymessage.Createdate = dt_tw(); categorymessage.Updatedate = dt_tw(); categorymessageService.Create(categorymessage); categorymessageService.SaveChanges(); } return(RedirectToAction("CategoryMessage")); }
public List <DisplayCategoryMessage> RetriveCategoryMessage(string name, string group = null) { string me = whoami(); List <DisplayCategoryMessage> list = new List <DisplayCategoryMessage>(); Category category = GetCategoryModel(name, group); CategoryMessage msg = _categoryManager.RetriveCategoryMessage(me, category); if (msg != null) { list.Add(ToDisplayCategoryMessage(msg, me)); } return(list); }
public List <DisplayCategoryMessage> RetriveCategoryMessageByName(string name) { string me = whoami(); string[] groups = MembershipHelper.JoinedGroup(me); List <DisplayCategoryMessage> list = new List <DisplayCategoryMessage>(); foreach (var category in _categoryManager.GetCategoryByName(name, groups)) { CategoryMessage msg = _categoryManager.RetriveCategoryMessage(me, category); if (msg != null) { list.Add(ToDisplayCategoryMessage(msg, me)); } } return(list); }
private DisplayCategoryMessage ToDisplayCategoryMessage(CategoryMessage msg, string userid) { if (msg == null) { return(null); } DisplayCategoryMessage displayMsg = new DisplayCategoryMessage(); displayMsg.User = msg.User; displayMsg.ID = msg.ID; displayMsg.PostTime = msg.PostTime; displayMsg.CategoryID = msg.CategoryID; displayMsg.CategoryName = msg.CategoryName; displayMsg.EventIDs = msg.EventIDs; displayMsg.NotifyTo = AccountController.GetSimpleUserProfile(msg.NotifyTo); displayMsg.Group = GroupController.GetDisplayGroup(msg.Group, userid); return(displayMsg); }
private void AddCategory() { Category category = new Category(); category.CategoryName = txtCategoryName.Text; if (cmbParentCategory.SelectedItem != null) { category.ParentId = ((Category)cmbParentCategory.SelectedItem).Id; } else { category.ParentId = null; } category.IsActive = cbNotActive.Checked ? false : true; category.IsPopular = cbNotPopuler.Checked ? false : true; category.AddedAt = dpAddedDate.Value; _categoryManager.Add(category); MessageBox.Show(CategoryMessage.AddMessage()); }
private void UpdateCategory() { selectedCategory.ParentId = null; selectedCategory.Parent = null; selectedCategory.CategoryName = txtCategoryName.Text; if (cmbParentCategory.SelectedItem.ToString() == "") { selectedCategory.ParentId = null; } else { selectedCategory.ParentId = ((Category)cmbParentCategory.SelectedItem).Id; } selectedCategory.AddedAt = dpAddedDate.Value; if (cbNotActive.Checked) { selectedCategory.IsActive = false; } else { selectedCategory.IsActive = true; } if (cbNotPopuler.Checked) { selectedCategory.IsPopular = false; } else { selectedCategory.IsPopular = true; } _categoryManager.Update(selectedCategory); MessageBox.Show(CategoryMessage.UpdateMessage()); }
private void OnCategoryItemSelected(CategoryMessage obj) { _treeViewSelectedCategoryNode.Name = obj.Name; _treeViewSelectedCategoryNode.Id = obj.Id; }
private void ShowCategoryName(CategoryMessage categoryMessage) { //MessageBox.Show("CatName = " + catName); }
private void NewMethod() { _categoryManager.Delete(selectedCategory); MessageBox.Show(CategoryMessage.DeleteMessage()); }
private void OnCategorySelectionChanged(CategoryMessage obj) { _categoryId = obj.Id; }
private void OnCategorySelectionChanged(CategoryMessage cm) { _selectedCategory = cm; AddCategoryCommand.RaiseCanExecuteChanged(); DeleteCategoryCommand.RaiseCanExecuteChanged(); }