protected void SelectCategory(object sender, EventArgs e) { FaqCategoryInfo cat = SnitzFaq.GetCategory(ddlCategoryEdit.SelectedItem.Text); if (cat != null) { if (currentfaq == cat.Id) { return; } currentfaq = cat.Id; catDescription.Text = cat.Description; catLang.Text = cat.Language; catOrder.Text = cat.Order.ToString(); catRole.Text = cat.Roles; } else { currentfaq = -1; catDescription.Text = ""; catLang.Text = "en"; catOrder.Text = "99"; catRole.Text = ""; } }
protected void DeleteCat(object sender, ImageClickEventArgs e) { FaqCategoryInfo cat = SnitzFaq.GetCategory(fcCategory.SelectedItem.Text); if (cat != null) { var questions = SnitzFaq.GetFaqQuestionsByCategory(cat.Id, CultureInfo.CurrentCulture.TwoLetterISOLanguageName); if (!questions.Any()) { SnitzFaq.DeleteFaqCategory(cat); //refresh the category cache Cache.Remove("faqcatlist"); Response.Redirect(this.Request.RawUrl); } } }
protected void SelectCategory(object sender, EventArgs e) { FaqCategoryInfo cat = SnitzFaq.GetCategory(fcCategory.SelectedItem.Text); if (cat != null) { fcTitle.Text = cat.Description; fcRoles.Text = cat.Roles; fcLang.Text = cat.Language; fcOrder.Text = cat.Order.ToString(); } else { fcTitle.Text = ""; fcLang.Text = "en"; fcOrder.Text = "99"; fcRoles.Text = ""; } }
protected void SaveCat(object sender, ImageClickEventArgs e) { FaqCategoryInfo cat = SnitzFaq.GetCategory(fcTitle.Text) ?? new FaqCategoryInfo(); cat.Description = fcTitle.Text; cat.Order = Convert.ToInt32(fcOrder.Text); cat.Roles = fcRoles.Text; cat.Language = CultureInfo.CurrentCulture.TwoLetterISOLanguageName; if (cat.Id > 0) { SnitzFaq.UpdateFaqCategory(cat); } else { SnitzFaq.AddFaqCategory(cat); } //refresh the category cache Cache.Remove("faqcatlist"); Response.Redirect(this.Request.RawUrl); }
protected void AddNewCategory(object sender, EventArgs e) { FaqCategoryInfo cat = SnitzFaq.GetCategory(catDescription.Text) ?? new FaqCategoryInfo(); cat.Description = catDescription.Text; cat.Order = Convert.ToInt32(catOrder.Text); cat.Roles = catRole.Text; cat.Language = CultureInfo.CurrentCulture.TwoLetterISOLanguageName; if (cat.Id > 0) { SnitzFaq.UpdateFaqCategory(cat); } else { SnitzFaq.AddFaqCategory(cat); } SetDefaultView(); //refresh the category cache Cache.Remove("faqcatlist"); Response.Redirect(this.Request.RawUrl); }