예제 #1
0
        // GET: /Policies/{action}
        public ActionResult Index(string policykind)
        {
            Policy p = new Policy();

            switch (policykind.Trim().ToLowerInvariant())
            {
                case "privacy":
                    p = LoadPolicy(PolicyType.Privacy);
                    break;
                case "terms":
                    p = LoadPolicy(PolicyType.TermsAndConditions);
                    break;
                case "returns":
                    p = LoadPolicy(PolicyType.Returns);
                    break;
                case "faq":
                    p = LoadPolicy(PolicyType.Faq);
                    break;
                default:
                    p = new Policy();
                    p.Title = "Content Not Found";
                    p.Blocks.Add(new PolicyBlock() { Description = "<p>The requested policy could not be found. Please close this window and try again.</p>" });
                    break;
            }          

            ViewBag.Title = p.Title;
            return View(p);
        }
        // Get: /Policies/Faq
        public ActionResult Faq()
        {
            // Breadcrumbs
            BreadCrumbViewModel crumbs = new BreadCrumbViewModel();
            crumbs.HomeName = SiteTerms.GetTerm(SiteTermIds.Home);
            crumbs.Items.Enqueue(new BreadCrumbItem()
            {
                Name = SiteTerms.GetTerm(SiteTermIds.CustomerService),
                Link = Url.Content("~/ContactUs")
            });
            crumbs.Items.Enqueue(new BreadCrumbItem() { Name = SiteTerms.GetTerm(SiteTermIds.FAQ) });
            ViewBag.BreadCrumbTrail = crumbs;

            // Titles
            ViewBag.Title = SiteTerms.GetTerm(SiteTermIds.FAQ);

            Policy p = MTApp.ContentServices.Policies.FindOrCreateByType(PolicyType.Faq);
            if (p == null) p = new Policy();
            return View(p);
        }
예제 #3
0
        // Get: /Policies/Faq
        public ActionResult Faq()
        {
            // Breadcrumbs
            BreadCrumbViewModel crumbs = new BreadCrumbViewModel();
            crumbs.HomeName = SiteTerms.GetTerm(SiteTermIds.Home);
            crumbs.Items.Enqueue(new BreadCrumbItem()
            {
                Name = SiteTerms.GetTerm(SiteTermIds.CustomerService),
                Link = Url.Content("~/ContactUs")
            });
            crumbs.Items.Enqueue(new BreadCrumbItem() { Name = SiteTerms.GetTerm(SiteTermIds.FAQ) });            
            var breadRender = new code.TemplateEngine.TagHandlers.BreadCrumbs();
            ViewBag.BreadCrumbsFinal = breadRender.Render(MTApp, crumbs);

            // Titles
            ViewBag.Title = SiteTerms.GetTerm(SiteTermIds.FAQ);

            Policy p = MTApp.ContentServices.Policies.FindOrCreateByType(PolicyType.Faq);
            if (p == null) p = new Policy();
            return View(p);
        }
예제 #4
0
        protected void btnNew_Click(object sender, System.Web.UI.ImageClickEventArgs e)
        {
            msg.ClearMessage();

            if (this.NewNameField.Text.Trim().Length < 1)
            {
                msg.ShowWarning("Please enter a name for the new policy.");
            }
            else
            {
                Policy p = new Policy();
                p.Title = this.NewNameField.Text.Trim();
                p.SystemPolicy = false;
                if (MTApp.ContentServices.Policies.Create(p) == true)
                {
                    Response.Redirect("Policies_Edit.aspx?id=" + p.Bvin);
                }
                else
                {
                    msg.ShowError("Unable to create policy. Please see event log for details");
                    EventLog.LogEvent("Create New Policy Button", "Unable to create policy", EventLogSeverity.Error);
                }
            }
        }
예제 #5
0
 private Policy LoadPolicy(PolicyType type)
 {
     Policy p = MTApp.ContentServices.Policies.FindOrCreateByType(type);
     if (p == null) p = new Policy();
     return p;            
 }