protected void btnDeleteLastConfirm_Click(object sender, EventArgs e)
        {
            var cc = new CategoryController();
            var fc = new FAQController();

            foreach (var c in cc.GetCategories(ModuleId))
            {
                if (c.CategoryName == ddCategory.SelectedValue)
                {
                    categoryId.Text = c.CategoryId.ToString();
                }
            }
            cc.DeleteCategory(Convert.ToInt32(categoryId.Text.Trim()), ModuleId);
            foreach (var f in fc.GetFAQs(ModuleId))
            {
                if (f.FaqCategory == ddCategory.SelectedValue)
                {
                    fc.DeleteFAQ(f);
                }
            }
            lblSubTitle.Text = "Category Deleted! FAQ Entries Deleted!";
            pnlPopUp.Visible = false;
            CategoryDropdownFill(cc);
            LoadNew();
        }
        protected void btnDeleteConfirm_Click(object sender, EventArgs e)
        {
            var  cc            = new CategoryController();
            var  fc            = new FAQController();
            bool emptyCategory = true;

            foreach (var c in cc.GetCategories(ModuleId))
            {
                if (c.CategoryName == ddCategory.SelectedValue)
                {
                    categoryId.Text = c.CategoryId.ToString();
                }
            }
            foreach (var f in fc.GetFAQs(ModuleId))
            {
                if (f.FaqCategory == ddCategory.SelectedValue)
                {
                    emptyCategory = false;
                }
            }
            if (emptyCategory)
            {
                cc.DeleteCategory(Convert.ToInt32(categoryId.Text.Trim()), ModuleId);
                CategoryDropdownFill(cc);
                LoadNew();
                pnlPopUp.Visible = false;
                lblSubTitle.Text = "Category Deleted!";
                HeaderMenuStatus("success");
            }
            else
            {
                lblPopUpMsg.Text         = "Category Contains FAQ Entries! <br>What to Do With Them?";
                btnMoveToEmpty.Visible   = btnDeleteAllEntries.Visible = true;
                btnDeleteConfirm.Visible = false;
            }
        }
Beispiel #3
0
        protected void Save()
        {
            var    cc = new CategoryController();
            var    fc = new FAQController();
            string status;

            if (FaqId > 0)
            {
                switch (rblCategoryOption.SelectedValue)
                {
                case "new":
                    var c = new Category()
                    {
                        CategoryName        = txtCategoryName.Text.Trim(),
                        CategoryDescription = txtCategoryDescription.Text.Trim(),
                        ShowCategory        = true,
                        ModuleId            = ModuleId
                    };
                    cc.CreateCategory(c);
                    var f = fc.GetFAQ(FaqId, ModuleId);
                    f.FaqCategory = txtCategoryName.Text.Trim();
                    f.FaqQuestion = txtQuestion.Text.Trim();
                    f.FaqAnswer   = txtAnswer.Text.Trim();
                    f.ShowFaq     = !cbHideFAQ.Checked;
                    f.Categorized = true;
                    f.ModuleId    = ModuleId;
                    fc.UpdateFAQ(f);
                    break;

                case "list":
                    var lf = fc.GetFAQ(FaqId, ModuleId);
                    lf.FaqCategory = ddCategory.SelectedValue;
                    lf.FaqQuestion = txtQuestion.Text.Trim();
                    lf.FaqAnswer   = txtAnswer.Text.Trim();
                    lf.ShowFaq     = !cbHideFAQ.Checked;
                    lf.Categorized = true;
                    lf.ModuleId    = ModuleId;
                    fc.UpdateFAQ(lf);
                    break;

                case "empty":
                    var ef = fc.GetFAQ(FaqId, ModuleId);
                    ef.FaqCategory = "NotCategorized";
                    ef.FaqQuestion = txtQuestion.Text.Trim();
                    ef.FaqAnswer   = txtAnswer.Text.Trim();
                    ef.ShowFaq     = !cbHideFAQ.Checked;
                    ef.Categorized = false;
                    ef.ModuleId    = ModuleId;
                    fc.UpdateFAQ(ef);
                    break;

                default:
                    break;
                }
                lblSubTitle.Text = "FAQ Entry Updated!";
                status           = "success";
            }
            else
            {
                bool faqExists = false;
                foreach (var faq in fc.GetFAQs(ModuleId))
                {
                    if (faq.FaqQuestion == txtQuestion.Text.Trim())
                    {
                        faqExists = true;
                    }
                }
                if (!faqExists)
                {
                    switch (rblCategoryOption.SelectedValue)
                    {
                    case "new":
                        var c = new Category()
                        {
                            CategoryName        = txtCategoryName.Text.Trim(),
                            CategoryDescription = txtCategoryDescription.Text.Trim(),
                            ShowCategory        = true,
                            ModuleId            = ModuleId
                        };
                        cc.CreateCategory(c);
                        var f = new FAQ()
                        {
                            FaqCategory = txtCategoryName.Text.Trim(),
                            FaqQuestion = txtQuestion.Text.Trim(),
                            FaqAnswer   = txtAnswer.Text.Trim(),
                            ShowFaq     = !cbHideFAQ.Checked,
                            Categorized = true,
                            ModuleId    = ModuleId
                        };
                        fc.CreateFAQ(f);
                        break;

                    case "list":
                        var lf = new FAQ()
                        {
                            FaqCategory = ddCategory.SelectedValue,
                            FaqQuestion = txtQuestion.Text.Trim(),
                            FaqAnswer   = txtAnswer.Text.Trim(),
                            ShowFaq     = !cbHideFAQ.Checked,
                            Categorized = true,
                            ModuleId    = ModuleId
                        };
                        fc.CreateFAQ(lf);
                        break;

                    case "empty":
                        var ef = new FAQ()
                        {
                            FaqCategory = "NotCategorized",
                            FaqQuestion = txtQuestion.Text.Trim(),
                            FaqAnswer   = txtAnswer.Text.Trim(),
                            ShowFaq     = !cbHideFAQ.Checked,
                            Categorized = false,
                            ModuleId    = ModuleId
                        };
                        fc.CreateFAQ(ef);
                        break;

                    default:
                        break;
                    }
                    lblSubTitle.Text = "FAQ Entry Added!";
                    status           = "success";
                }
                else
                {
                    lblSubTitle.Text = "FAQ with that Question already Exists!!";
                    status           = "error";
                }
            }
            headerMenu.CssClass  = "dnnFormMessage two-controls dnnFormTitle no-spacing " + status;
            lnkManage.CssClass   = "btn btn-primary link-manage no-txt " + status;
            lnkSettings.CssClass = "btn btn-primary link-settings no-txt " + status;
        }
Beispiel #4
0
        protected void LoadPage()
        {
            try
            {
                //Code should be improved
                lblContentHolder.Text     = "<strong class='link-key'>Installed Key: </strong>jDEnn#$%rfdDGessd&$^Iskh";
                lblContentHolder.CssClass = "content-holder warning";

                lblContentHolderActivate.Text     = "<strong class='link-unlock'>Activated</strong>";
                lblContentHolderActivate.CssClass = "content-holder success";

                lnkCheckLicenseKey.Text     = "Activate";
                lnkCheckLicenseKey.ToolTip  = "Activate Module";
                lnkCheckLicenseKey.CssClass = "btn btn-danger link-lock";

                lnkGetOwnerInfo.ToolTip  = "Owner Info";
                lnkGetOwnerInfo.CssClass = "btn btn-success link-info no-txt";

                lblInfoInstalledKey.Text = "<strong class='link-key'>Installed Key: </strong>47334jLJND#@fsssdg#dvjjbb343#$$";
                lblInfoConfirmKey.Text   = "<strong class='link-key'>Confirm Key: </strong>fsjjdv34347bbs33D#@#$s4jLJNdg#$";
                lblInfoCompany.Text      = "<strong class='link-company'>Company: </strong>JoopSOFT Ltd.";
                lblInfoEmail.Text        = "<strong class='link-mail'>Email: </strong><a href='mailto:[email protected]' title='Send mail to [email protected]'>[email protected]</a>";
                lblInfoCellPhone.Text    = "<strong class='link-phone'>Phone: </strong>+359878/209292";
                lblInfoDomain.Text       = "<strong class='link-globe'>Installed on: </strong><a href='www.devedjiev.me' title='Installed on www.devedjiev.me' target='_blank'>www.devedjiev.me</a>";

                //End of this

                lnkFirstButton.NavigateUrl = lnkAdd.NavigateUrl = EditUrl("AddFAQ");
                lnkManage.NavigateUrl      = EditUrl("ManageCategories");
                string PageName = TabController.CurrentPage.TabPath.Remove(0, 1);
                lnkSettings.NavigateUrl = "javascript:dnnModal.show('http://" + Request.Url.Host + PageName + "/ctl/Module/ModuleId/" + ModuleId + "?ReturnURL=" + PageName + "&amp;popUp=true#msSpecificSettings',/*showReturn*/false,550,950,true,'')";
                bool faqPresent    = false;
                bool emptyCategory = true;
                var  cc            = new CategoryController();
                var  fc            = new FAQController();
                var  af            = fc.GetFAQs(ModuleId);
                var  ac            = cc.GetCategories(ModuleId);
                foreach (var f in af)
                {
                    if (f.FaqId > 0)
                    {
                        faqPresent = true;
                    }
                }
                List <Category> categorySource = new List <Category>();
                foreach (var c in ac)
                {
                    foreach (var f in af)
                    {
                        if (c.CategoryName == f.FaqCategory)
                        {
                            emptyCategory = false;
                        }
                    }
                    if (c.ShowCategory && !emptyCategory)
                    {
                        categorySource.Add(c);
                    }
                }
                if (IsEditable)
                {
                    pnlFirstButton.Visible = !faqPresent;
                }
                else
                {
                    pnlFirstButton.Visible = pnlAdmin.Visible = false;
                }
                rptCategory.DataSource = categorySource;
                rptCategory.DataBind();
                foreach (RepeaterItem ri in rptCategory.Items)
                {
                    var        rptFaqEntries = ri.FindControl("rptFaqEntries") as Repeater;
                    var        categoryName  = ri.FindControl("CategoryName") as Label;
                    List <FAQ> faqSource     = new List <FAQ>();
                    foreach (FAQ f in af)
                    {
                        if (f.FaqCategory == categoryName.Text && (f.ShowFaq || btnHiddenFaq.ToolTip == "Hide Hidden FAQs"))
                        {
                            faqSource.Add(f);
                        }
                    }
                    rptFaqEntries.DataSource = faqSource;
                    rptFaqEntries.DataBind();
                    foreach (RepeaterItem fi in rptFaqEntries.Items)
                    {
                        var lnkEdit    = fi.FindControl("lnkEdit") as HyperLink;
                        var faqId      = fi.FindControl("faqId") as Label;
                        var pnlAdmin   = fi.FindControl("pnlControlButtonsAdmin") as Panel;
                        var pnlFaqItem = fi.FindControl("pnlFaqItem") as Panel;
                        pnlAdmin.Visible = IsEditable;
                        if (IsEditable)
                        {
                            pnlFaqItem.CssClass = "faq-item four-controls";
                        }
                        else
                        {
                            pnlFaqItem.CssClass = "faq-item no-controls";
                        }
                        lnkEdit.NavigateUrl = EditUrl(string.Empty, string.Empty, "AddFAQ", "fid=" + Convert.ToInt32(faqId.Text));
                    }
                }
                List <FAQ> notCategorizedSource = new List <FAQ>();
                rptNotCategorized.Visible = false;
                foreach (var f in af)
                {
                    if (f.FaqCategory == "NotCategorized" && (f.ShowFaq || btnHiddenFaq.ToolTip == "Hide Hidden FAQs"))
                    {
                        notCategorizedSource.Add(f);
                        rptNotCategorized.Visible = true;
                    }
                }
                rptNotCategorized.DataSource = notCategorizedSource;
                rptNotCategorized.DataBind();
                foreach (RepeaterItem nci in rptNotCategorized.Items)
                {
                    var lnkEdit    = nci.FindControl("lnkEdit") as HyperLink;
                    var faqId      = nci.FindControl("faqId") as Label;
                    var pnlAdmin   = nci.FindControl("pnlControlButtonsAdmin") as Panel;
                    var pnlFaqItem = nci.FindControl("pnlFaqItem") as Panel;
                    pnlAdmin.Visible = IsEditable;
                    if (IsEditable)
                    {
                        pnlFaqItem.CssClass = "faq-item four-controls";
                    }
                    else
                    {
                        pnlFaqItem.CssClass = "faq-item no-controls";
                    }
                    lnkEdit.NavigateUrl = EditUrl(string.Empty, string.Empty, "AddFAQ", "fid=" + Convert.ToInt32(faqId.Text));
                }
            }
            catch (Exception exc) //Module failed to load
            {
                Exceptions.ProcessModuleLoadException(this, exc);
            }
        }