public static List <CommentCategory> GetCommentCategory(List <OrderData> Orders) { List <CommentCategory> categories = new List <CommentCategory>(); foreach (OrderData order in Orders) { CommentCategory cat = categories.Find(x => x.Category == order.CommentCategory); if (cat == null) { cat = new CommentCategory() { Category = order.CommentCategory, Orders = new List <OrderData>() { order } }; categories.Add(cat); } else { cat.Orders.Add(order); } } return(categories); }
public CommentDescriptionAttribute(string aName, string aAbbreviation, CommentCategory aCategory) { Name = aName; Abbreviation = aAbbreviation; Category = aCategory; WriterMistakeType = WriterMistakeType.Unknown; }
private void categoryListView_SelectedIndexChanged(object sender, EventArgs e) { try { var items = this.categoryListView.SelectedItems; if (items.Count == 0) { return; } this.textListView.Items.Clear(); //複数選択できないようプロパティを設定しているので、複数選択のケアはしない CommentCategory category = items[0].Tag as CommentCategory; foreach (var comment in category.Comments) { ListViewItem item = new ListViewItem(); item.Text = comment.Text; item.Tag = comment; this.textListView.Items.Add(item); } } catch (Exception ex) { MessageDialog.ShowError(ex); } finally { this.Cursor = Cursors.Default; } }
public Comment(string[] textLines, CommentCategory category, CommentPlacement placement, int lineIndexDistanceFromOwner, CommentKind kind, bool isDecorated) { this.TextLines = textLines; this.Category = category; this.Placement = placement; this.LineIndexDistanceFromOwner = lineIndexDistanceFromOwner; this.Kind = kind; this.IsDecorated = isDecorated; }
public ActionResult Edit(int id = 0) { CommentCategory category = _categoryRepository.GetCommentCategoryById(id); if (category != null) { return(View(category)); } TempData["Error"] = "Brak kategorii o podanym ID!"; return(RedirectToAction("Index")); }
private CommentCategoryConfiguration BuildCommentCategories() { CommentCategoryConfiguration config = new CommentCategoryConfiguration(); //all keys that we care about start with "category_" List <string> keys = (from key in Request.Form.AllKeys where key.Contains("category_") select key).ToList(); //we know this one for sure so no need to loop config.Name = Request.Form["category_config_name"].ToString(); //but the rest are variable, so we need to loop foreach (string key in keys) { //All category keys go something like "category_BLAH1_BLAH2_...". Based on how //many underscores the current key has, we can determine what data it is //providing to us string[] pieces = key.Split('_'); //length of 2 is a category name if (pieces.Length == 2) { int catId = 0; Int32.TryParse(pieces[1], out catId); //does the comment category already exist? CommentCategory category = GetOrCreateCategory(config, catId); category.Name = Request.Form[key].ToString(); } //length of 4 is a category option else if (pieces.Length == 4) { int catId = 0; int order = 0; Int32.TryParse(pieces[2], out catId); Int32.TryParse(pieces[3], out order); CommentCategory category = GetOrCreateCategory(config, catId); CommentCategoryOption option = new CommentCategoryOption(); option.Name = Request.Form[key].ToString(); category.Options.Insert(order, option); } } //when we're all done, zero out the category IDs to ensure that the items get //added to the DB correctly foreach (CommentCategory c in config.Categories) { c.ID = 0; } return(config); }
/// <summary> /// 左側のカテゴリーリストに表示するデータを設定する。 /// </summary> protected override void LoadMasters() { CommentCategory category = UnitWiring.Masters.CommentCategories.Find(p => p.Id == Const.CommentCategoryId.SerialForUnitWiringOnly); if (category != null) { ListViewItem item = new ListViewItem(); item.Text = category.Name; item.Tag = category; this.categoryListView.Items.Add(item); } }
private CommentCategory GetOrCreateCategory(CommentCategoryConfiguration config, int categoryId) { //does the comment category already exist? CommentCategory category = (from c in config.Categories where c.ID == categoryId select c).FirstOrDefault(); if (category == null) { category = new CommentCategory(); category.ID = categoryId; config.Categories.Add(category); } return(category); }
public ActionResult Create(CommentCategory commentcategory) { if (ModelState.IsValid) { // Dodanie nowej kategorii komentarzy i zapisanie w bazie danych if (TryUpdateModel(commentcategory)) { _categoryRepo.Add(commentcategory); _categoryRepo.SaveChanges(); TempData["Message"] = "Pomyślnie dodano kategorię!"; return(RedirectToAction("Index")); } } TempData["Error"] = "Wystąpił błąd podczas dodawania kategorii!"; return(View(commentcategory)); }
public ActionResult Edit([Bind(Include = "CommentCategoryId,Name")] CommentCategory commentCategory) { if (ModelState.IsValid) { try { _categoryRepository.Edit(commentCategory); _categoryRepository.SaveChanges(); TempData["Message"] = "Pomyślnie zmodyfikowano kategorię!"; return(RedirectToAction("Index")); } catch (Exception) { TempData["Error"] = "Wystąpił błąd podczas modyfikowania kategorii!"; return(View(commentCategory)); } } TempData["Error"] = "Wprowadź poprawnie modyfikowane dane!"; return(View(commentCategory)); }
public CommentCategory Save(CommentCategory item) { return(new CommentCategoryRepository().SaveOrUpdate(item)); }
/// <summary> /// Dodanie kategorii. /// </summary> /// <param name="category">Dodawana kategoria.</param> public void Add(CommentCategory category) { _db.CommentCategories.Add(category); }
/// <summary> /// Usunięcie kategorii komentarza /// </summary> /// <param name="category">Usuwana kategoria komentarza.</param> public void Delete(CommentCategory category) { _db.CommentCategories.Remove(category); }
protected void SaveClicked(object o, EventArgs e) { var account = new Account(); account.ChangedBy = -1; account.CommentsWeight = 40; account.Company = tbCompany.Text; account.DateCreated = DateTime.Now; account.Domain = tbSiteAddress.Text.ToLower() .Replace(" ", "") .Replace("_", "") .Replace("'", "") .Replace("@", "") .Replace("-", "") .Replace("?", "") .Replace("&", "") .Replace("%", "") .Replace("^", "") + ".hrriver.com"; account.EnteredBy = -1; account.GoalsWeight = 30; account.LastUpdated = DateTime.Now; account.QuestionsWeight = 30; new AccountServices().Save(account); var dept = new Department(); dept.AccountID = account.ID; dept.Description = "Human Resources"; dept.Name = "HR"; new DepartmentServices().Save(dept); var admin = new Person(); admin.AccountID = account.ID; admin.AvatarPath = "http://www.gravatar.com/avatar/" + DateTime.Now.Ticks.ToString() + "?d=identicon&s="; admin.ChangedBy = admin.ID; admin.EnteredBy = admin.ID; admin.IsActive = true; admin.DateCreated = DateTime.Now; admin.IsManager = true; admin.FirstName = tbFirstName.Text; admin.LastName = tbLastName.Text; admin.Email = tbEmail.Text; admin.DepartmentID = dept.ID; admin.LastUpdated = DateTime.Now; admin.MarkedForDeletion = false; admin.Password = SecurityUtils.GetMd5Hash(tbPassword.Text); admin.PasswordQuestion = "What is your work email address?"; admin.PasswordAnswer = tbEmail.Text; admin.ReceiveCommentNotifications = true; admin.RoleID = (int)SecurityRole.ADMIN; admin.Title = "Admin"; admin.ManagerID = admin.ID; admin.UserName = admin.Email; new PersonServices().Save(admin); var commentcat = new CommentCategory(); commentcat.AccountID = account.ID; commentcat.Name = "Discipline"; new CommentCategoryServices().Save(commentcat); commentcat = new CommentCategory(); commentcat.AccountID = account.ID; commentcat.Name = "Teamwork"; new CommentCategoryServices().Save(commentcat); var ratingscale = new QuestionRatingScale(); ratingscale.AccountID = account.ID; ratingscale.Name = "Three Point Scale"; ratingscale.Title = "Three Point Scale"; new QuestionRatingScaleServices().Save(ratingscale); var scalevals = new QuestionRatingScaleValue(); scalevals.Name = "Below Expectations"; scalevals.QuestionRatingScaleID = ratingscale.ID; scalevals.Title = "Below Expectations"; scalevals.Value = 0; new QuestionRatingScaleValueServices().Save(scalevals); scalevals = new QuestionRatingScaleValue(); scalevals.Name = "Meets Expectations"; scalevals.QuestionRatingScaleID = ratingscale.ID; scalevals.Title = "Meets Expectations"; scalevals.Value = 50; new QuestionRatingScaleValueServices().Save(scalevals); scalevals = new QuestionRatingScaleValue(); scalevals.Name = "Exceeds Expectations"; scalevals.QuestionRatingScaleID = ratingscale.ID; scalevals.Title = "Exceeds Expectations"; scalevals.Value = 100; new QuestionRatingScaleValueServices().Save(scalevals); var reviewtemplate = new ReviewTemplate(); reviewtemplate.AccountID = account.ID; reviewtemplate.IsActive = true; reviewtemplate.Name = "Basic Review"; reviewtemplate.Title = "Basic Review"; new ReviewTemplateServices().Save(reviewtemplate); var reviewtemplatequestion = new ReviewTemplateQuestion(); reviewtemplatequestion.CategoryID = commentcat.ID; reviewtemplatequestion.Name = "Works well with others"; reviewtemplatequestion.Question = "Works well with others"; reviewtemplatequestion.QuestionRatingScaleID = ratingscale.ID; reviewtemplatequestion.ReviewTemplateID = reviewtemplate.ID; new ReviewTemplateQuestionServices().Save(reviewtemplatequestion); var review = new Review(); review.AccountID = account.ID; review.ChangedBy = admin.ID; review.CommentsWeight = 40; review.IsActive = true; review.IsCurrent = true; review.LastUpdated = DateTime.Now; review.Name = "Review for " + admin.Name; review.QuestionsWeight = 30; review.ReviewTemplateID = reviewtemplate.ID; review.Score = 0; review.StartDate = DateTime.Now; review.EnteredBy = admin.ID; review.EnteredFor = admin.ID; review.DueDate = DateTime.Now.AddMonths(3); review.Status = (int)GoalStatus.ACCEPTED; review.Title = "Review for " + admin.Name; review.DateCreated = DateTime.Now; new ReviewServices().Save(review); var team = new Team(); team.AccountID = account.ID; team.Description = "Company Wide"; team.Name = "Company Wide"; new TeamServices().Save(team); var member = new TeamMember(); member.HasAccess = true; member.IsActive = true; member.IsManager = true; member.PersonID = admin.ID; member.RecievesNotifications = true; member.TeamID = team.ID; new TeamMemberServices().Save(member); var response = new SecurityServices().AuthenticateUser(admin.Email, tbPassword.Text, ""); if (response.IsAuthenticated) { if (Request.QueryString["redirect"] != null) { Response.Redirect(Request.QueryString["redirect"]); } Response.Redirect(ResourceStrings.Page_Default); } }
/// <summary> /// Usuniecie kategorii komentarzy /// </summary> /// <param name="element">Kategoria komentarzy do usuniecia</param> public void Delete(CommentCategory element) { _db.CommentCategories.Remove(element); }
public void Delete(CommentCategory item) { new CommentCategoryRepository().Delete(item); }
public IActionResult CommentCategory(CommentCategory commentCommentCategory) { this.dataService.DeleteCommentCategory(commentCommentCategory.Id); return(this.RedirectToAction("CommentCategories", "Admin")); }
public IActionResult CommentCategory(int id) { CommentCategory model = this.dataService.GetObjectByPropertyValue <CommentCategory>("Id", id); return(this.View(model)); }
/// <summary> /// Edytowanie kategorii komentarzy /// </summary> /// <param name="element">Kategoria komentarzy do edycji</param> public void Edit(CommentCategory element) { _db.Entry(element).State = EntityState.Modified; }
/// <summary> /// Dodanie kategorii komentarzy /// </summary> /// <param name="element">Kategoria komentarza do dodania</param> public void Add(CommentCategory element) { _db.CommentCategories.Add(element); }