Пример #1
0
        public string getHtml(HttpRequest request, string virtualWebDir, string url, bool isMobile)
        {
            Config.systemVariables["webUrl"] = "http://" + request.Url();
            //            Config.systemVariables["webUrl"] = "http://" + PageContext.Current.Request.Url.Authority + Config.webPath;
            //Config.systemVariables["pageUrl"] = PageContext.Current.Request.Url.AbsoluteUri.ToString();// "http://" + PageContext.Current.Request.Url.Authority +""+ Config.webPath;
            _pageNo = 1;
            Regex        r            = new Regex(@"(?<=/)((.[^/]*)_((\d){1,5}))(." + BaseConfig.extension + ")", RegexOptions.IgnoreCase);
            string       newUrl       = r.Replace(url, new MatchEvaluator(_replaceUrl));
            PageTemplate pageTemplate = null;

            pageTemplate = new PageTemplate(newUrl, isMobile);
            pageTemplate.Build();
            //TemplateInfo info = TemplateClass.get(newUrl, isMobile);
            if (pageTemplate == null)
            {
                Page.ERR404("模板不存在");
            }
            else
            {
                /*
                 * if (info.u_type == 2)
                 * {
                 *  Helper.Sql.ExecuteNonQuery("update mainTable set clickCount=clickCount+1 where id=@id", new SqlParameter[]{
                 *  new SqlParameter("id",info.variable["id"])
                 * });
                 * }*/
                if (newUrl.IndexOf(".") > -1)
                {
                    string[] u = newUrl.Split('/');
                    _fileName = u[u.Length - 1].Replace("." + BaseConfig.extension, "");
                }
                else
                {
                    _fileName = "default";
                }

                pageTemplate.Variable.Add("_pageNo", _pageNo);
                pageTemplate.Variable.Add("_url", request.Url());
                pageTemplate.Variable.Add("_fileName", _fileName);
                string html = RazorEngine.Razor.Run(pageTemplate.TemplateId.ToString(), new object[] { Config.systemVariables, pageTemplate.Variable, pageTemplate.Parameter });

                SubDomains subDomains = new SubDomains();
                subDomains.isMobile = isMobile;
                subDomains.replaceUrl(ref html);
                return(html);
            }
            return(null);
        }
Пример #2
0
 public static string priceText(Domains site, SubDomains subsite, double price) {
   switch (site) {
     case Domains.el:
     case Domains.sz:
     case Domains.cz: return price.ToString("C", Currency.kcCulture);
     //case Domains.com: return priceText(SubDomain.subDomainToCurr(subsite), price);
     default: throw new Exception("Missing code here");
   }
 }
Пример #3
0
 public static string comBasicPath(SubDomains subSite, LMApps appId) {
   return null;
   //switch (appId) {
   //  case LMApps.commerce:
   //  case LMApps.web:
   //    return SubDomain.subdomainToUrl(subSite) + "/lmcom/";
   //  case LMApps.ea:
   //  //return SubDomain.subdomainToUrl(SubDomains.com) + "/";
   //  case LMApps.no:
   //    return SubDomain.subdomainToUrl(subSite) + "/";
   //  default:
   //    throw new NotImplementedException();
   //}
 }
Пример #4
0
    ////Prevod profilu z vyuky na lm.cz
    //public static string createUserFromVyuka(string eMail, string psw) {
    //  ProfileData prof = LMComDataProvider.readProfile(eMail, null);
    //  if (prof == null) return string.Format("Uživatel {0} neexistuje!", eMail);
    //  if (prof.Site != Domains.sz) return string.Format("Profil uživatele {0} je již převeden!", eMail);
    //  prof.Password = psw;
    //  LMComDataProvider.WriteProfile(prof);
    //  MailSender.sendMail(MailTypes.ConfirmRegistration, Domains.com, SubDomains.com_cz, Langs.cs_cz, eMail, prof);
    //  return null;
    //}

    //public static bool createUserStart(string eMail, string psw) {
    //  return createUserStart(urlInfo.GetUrlInfo(), eMail, psw, null, null)>0;
    //}

    public static Int64 rew_createUserStart(SubDomains subSite, string email, string login, Action<ProfileData> fillProfile) {
      Int64 id = LMComDataProvider.rew_readProfileId(email, login, null);
      if (id > 0) return -1;
      //if (id > 0) return id;
      ProfileData prof = LMComDataProvider.createProfileStart(Domains.com);
      if (login != null) {
        prof.Roles = 0; prof.ActivationMailSent = null;
      } else
        prof.ActivationMailSent = DateTime.UtcNow;
      prof.Email = email;
      prof.Login = login;
      fillProfile(prof);
      LMComDataProvider.WriteProfile(prof);
      return prof.Id;
    }