Esempio n. 1
0
 private void SetBlankFields(TemplateEngine te)
 {
     var anchor = Request.Get<string>("anchor", "about");
     te.Put(TagFields.CurrentPage, anchor);
     switch (anchor)
     {
         case "agreement":
             te.Put(TagFields.PageTitle, "服务协议");
             break;
         default:
             break;
     }
 }
Esempio n. 2
0
 private void SetAboutFields(TemplateEngine te)
 {
     var anchor = Request.Get<string>("anchor", "about");
     te.Put(TagFields.CurrentPage, anchor);
     switch (anchor)
     {
         case "contact":
             te.Put(TagFields.PageTitle, "联系我们");
             break;
         case "clause":
             te.Put(TagFields.PageTitle, "服务条款");
             break;
         default:
             te.Put(TagFields.PageTitle, "公司简介");
             break;
     }
 }
Esempio n. 3
0
        private void SetFields(TemplateEngine te, string pageType)
        {
            te.Put(TagFields.IsDefault, pageType == "default" ? 1 : 0);
            te.Put(TagFields.PageType, pageType);
            te.Put(TagFields.SiteName, SiteSetting.Instance.SiteName ?? "");
            te.Put(TagFields.MetaKeywords, SiteSetting.Instance.MetaKeywords ?? "");
            te.Put(TagFields.MetaDescription, SiteSetting.Instance.MetaDescription ?? "");
            te.Put(TagFields.SitePath, SitePath); //KConfig.SitePath);
            te.Put(TagFields.SiteUrl, SiteUrl); //KConfig.SiteUrl);
            te.Put(TagFields.Errors, "");
            te.Put(TagFields.FooterHtml, FormatUrl(SiteSetting.Instance.FooterHtml ?? ""));
            var navLinks = Link.GetNavigationLinks();
            navLinks.ForEach(l => l.Url = FormatUrl(l.Url));
            te.Put(TagFields.NavLinks, navLinks);
            var links = Link.GetLinks();
            links.ForEach(l => l.Url = FormatUrl(l.Url));
            te.Put(TagFields.Links, links);

            switch (pageType)
            {
                case "login":
                    SetLoginFields(te);
                    break;
                case "register":
                    SetRegisterFields(te);
                    break;
                case "submitorder":
                    SetSubmitOrderFields(te);
                    break;
                case "myorder":
                    SetMyOrderFields(te);
                    break;
                case "about":
                    SetAboutFields(te);
                    break;
                case "blank":
                    SetBlankFields(te);
                    break;
                default:
                    break;
            }
        }
Esempio n. 4
0
 private void SetSubmitOrderFields(TemplateEngine te)
 {
     te.Put(TagFields.PageTitle, "在线订车");
 }
Esempio n. 5
0
        private void SetRegisterFields(TemplateEngine te)
        {
            te.Put(TagFields.PageTitle, "注册");

            if (Request.IsPost())
            {
                var member = new Member();
                member.RealName = Request.Get<string>("realName");
                member.Mobile = Request.Get<string>("userMobile");
                member.Password = Request.Get<string>("password").ToMd5();
                member.RegisterIP = Request.GetIPAddress();
                var errors = member.Validate();
                var password = Request.Get<string>("password");
                var password1 = Request.Get<string>("password1");
                if (string.IsNullOrEmpty(password))
                    errors.Add("设置密码不能为空!");
                if (string.IsNullOrEmpty(password1))
                    errors.Add("确认密码不能为空!");
                if (!string.IsNullOrEmpty(password) && !string.IsNullOrEmpty(password1) && password != password1)
                    errors.Add("两次密码不一致!");

                if (errors.Count > 0)
                {
                    te.Put(TagFields.Errors, GetErrorsHtml(errors));
                }
                else
                {
                    member.Save();
                }
            }
        }
Esempio n. 6
0
 private void SetMyOrderFields(TemplateEngine te)
 {
     te.Put(TagFields.PageTitle, "我的订单");
 }
Esempio n. 7
0
 private void SetLoginFields(TemplateEngine te)
 {
     te.Put(TagFields.PageTitle, "登录");
 }