protected override void AddTempData(JinianNet.JNTemplate.TemplateContext context) { base.AddTempData(context); //取最新抢购的优惠活动 List <Model.ACT.SiteActivity> liActive = new List <Model.ACT.SiteActivity>(); DAL.ACT.SiteActivityDAL dalActive = new SiteActivityDAL(); List <MyCouponInfo> liCoupon = new List <MyCouponInfo>(); CouponDAL dalCoup = new CouponDAL(); DataSet dsActive = dalActive.GetActivityList(" SiteCode = '" + SiteCode + "' AND ActStatus = 1 AND ActType = 'RushCoupon' AND StartTime < GETDATE() AND EndTime > GETDATE() "); if (null != dsActive && dsActive.Tables.Count > 0 && dsActive.Tables[0].Rows.Count > 0) { foreach (DataRow row in dsActive.Tables[0].Rows) { if (!dalCoup.ExistCoupon(SiteCode, row["ID"].ToString(), OpenID)) { Model.ACT.SiteActivity modelActive = DataConvert.DataRowToModel <Model.ACT.SiteActivity>(row); liActive.Add(modelActive); } } } DataSet ds = dalCoup.GetCouponInfoList(SiteCode, OpenID); string strInfo = string.Empty; if (null != ds && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0) { foreach (DataRow row in ds.Tables[0].Rows) { MyCouponInfo model = DataConvert.DataRowToModel <MyCouponInfo>(row); liCoupon.Add(model); } } else { strInfo = "亲,你还没有参加过活动哦,多多关注我们的新活动!"; } context.TempData["openid"] = OpenID; context.TempData["rushcoupon_list"] = liActive; context.TempData["coupon_list"] = liCoupon; context.TempData["couponinfo"] = strInfo; }
protected override void AddTempData(JinianNet.JNTemplate.TemplateContext context) { base.AddTempData(context); List <DC_House> HouseList = new List <DC_House>(); DC_HouseDAL dal = new DC_HouseDAL(); DataSet Houseds = dal.GetDCHouseList(this.SiteCode, "1"); string housecount = Houseds.Tables[0].Rows.Count.ToString(); foreach (DataRow row in Houseds.Tables[0].Rows) { DC_House model = DataConvert.DataRowToModel <DC_House>(row); HouseList.Add(model); } context.TempData["HouseCount"] = housecount; context.TempData["HouseList"] = HouseList; }
protected void Page_Load(object sender, EventArgs e) { string text = System.IO.File.ReadAllText(Server.MapPath("Themes/Default/LoginOK.html")); JinianNet.JNTemplate.TemplateContext context = new JinianNet.JNTemplate.TemplateContext(); context.TempData["title"] = "用户登录完成"; if (null == Session["strName"]) { context.TempData["username"] = "******"; } context.TempData["username"] = Session["strName"].ToString(); context.TempData["customerid"] = Session["strCustomerID"].ToString(); context.TempData["sitecode"] = Session["strSiteCode"].ToString(); context.TempData["footer"] = "奥琦微商易"; JinianNet.JNTemplate.Template t = new JinianNet.JNTemplate.Template(context, text); t.Render(Response.Output); }
protected override void AddTempData(JinianNet.JNTemplate.TemplateContext context) { base.AddTempData(context); List <CMS_Article> liArticle = new List <CMS_Article>(); ArticleDAL dal = new ArticleDAL(); DataSet ds = dal.GetCategoryList(SiteCode, strCatID); foreach (DataRow row in ds.Tables[0].Rows) { CMS_Article model = DataConvert.DataRowToModel <CMS_Article>(row); liArticle.Add(model); } context.TempData["Article_list"] = liArticle; }
public void TestPage() { var conf = Configuration.EngineConfig.CreateDefault(); conf.CachingProvider = "JinianNet.JNTemplate.Caching.MemoryCache"; Engine.Configure(conf); JinianNet.JNTemplate.TemplateContext ctx = new JinianNet.JNTemplate.TemplateContext(); ctx.TempData.Push("func", new TemplateMethod()); SiteInfo site = new SiteInfo(); site.Copyright = "©2014 - 2015"; site.Description = ""; site.Host = "localhost"; site.KeyWords = ""; site.Logo = ""; site.Name = "xxx"; site.SiteDirectory = ""; site.Theme = "Blue"; site.ThemeDirectory = "theme"; site.Title = "jntemplate测试页"; site.Url = string.Concat("http://localhost"); if (!string.IsNullOrEmpty(site.SiteDirectory) && site.SiteDirectory != "/") { site.Url += "/" + site.SiteDirectory; } site.ThemeUrl = string.Concat(site.Url, "/", site.ThemeDirectory, "/", site.Theme); //ctx.TempData.Push("Model", ); ctx.TempData.Push("Site", site); string basePath = new System.IO.DirectoryInfo(System.Environment.CurrentDirectory).Parent.Parent.FullName; string path = basePath + "\\templets\\default"; JinianNet.JNTemplate.Template t = new JinianNet.JNTemplate.Template(ctx, System.IO.File.ReadAllText(path + "\\questionlist.html")); t.Context.CurrentPath = path; string result = t.Render(); //可直接查看项目录下的html/jnt.html 文件效果 System.IO.File.WriteAllText(basePath + "\\html\\jnt.html", result); }
void GetHtmlPage() { MSProductOrderDAL orderDal = new MSProductOrderDAL(); MyOrderList myorderlistModel = new MyOrderList(); string strWhere = string.Empty; string payway = string.Empty; if (struid != null && struid != "") { struid = " and a.CustomerID='" + struid + "' "; } strWhere = struid + " and a.ID='" + oid + "' "; DataSet orderds = orderDal.GetCustomerOrderList(strWhere); if (orderds != null && orderds.Tables.Count > 0 && orderds.Tables[0].Rows.Count > 0) { myorderlistModel = DataConvert.DataRowToModel <MyOrderList>(orderds.Tables[0].Rows[0]); payway = myorderlistModel.PayWay; string[] way = payway.Split('|'); try { payway = way[1].ToString(); } catch (Exception) { } } else { errormsg = JQDialog.alertOKMsgBox(5, "无效的请求方式", "CustomerOrder.aspx", "error"); } string text = System.IO.File.ReadAllText(Server.MapPath("../ShopPage/OrderDetail.html")); JinianNet.JNTemplate.TemplateContext context = new JinianNet.JNTemplate.TemplateContext(); context.TempData["errormsg"] = errormsg; context.TempData["uid"] = struid; context.TempData["payway"] = payway; context.TempData["orderdetail"] = myorderlistModel; JinianNet.JNTemplate.Template t = new JinianNet.JNTemplate.Template(context, text); t.Render(Response.Output); }
protected override void AddTempData(JinianNet.JNTemplate.TemplateContext context) { DAL.BBS.BBSSectionDAL dalBBS = new DAL.BBS.BBSSectionDAL(); //取社区主题 DataSet dsTopic = dalBBS.GetTopicList(Section); List <BBS_TopicInfo> liTopic = new List <BBS_TopicInfo>(); if (null != dsTopic && dsTopic.Tables.Count > 0 && dsTopic.Tables[0].Rows.Count > 0) { foreach (DataRow row in dsTopic.Tables[0].Rows) { BBS_TopicInfo model = DataConvert.DataRowToModel <BBS_TopicInfo>(row); liTopic.Add(model); } } context.TempData["topiclist"] = liTopic; }
/// <summary> /// 获取活动详细 /// </summary> void GetHolidayDetail() { if (strID.Trim() != null && strID.Trim() != "") { HoliDayDAL holidaydal = new HoliDayDAL(); HD_HoliDay holidaymodel = new HD_HoliDay(); DataSet ds = holidaydal.GetHoliDayDateil(strID); string starttime = string.Empty; string endtime = string.Empty; if (null != ds && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0) { holidaymodel = DataConvert.DataRowToModel <HD_HoliDay>(ds.Tables[0].Rows[0]); } if (holidaymodel.HstartTime < DateTime.Now) { starttime = holidaymodel.HstartTime.ToString(); } else { starttime = ""; } if (holidaymodel.HendTime < DateTime.Now) { endtime = ""; } else { endtime = holidaymodel.HendTime.ToString(); } //读取模板内容 string text = string.Empty; text = System.IO.File.ReadAllText(Server.MapPath("Themes/HoliDay/HolidayRsg.html")); JinianNet.JNTemplate.TemplateContext context = new JinianNet.JNTemplate.TemplateContext(); context.TempData["title"] = "活动详细信息"; context.TempData["holidayDetail"] = holidaymodel; context.TempData["starttime"] = starttime; context.TempData["endtime"] = endtime; context.TempData["sitecode"] = strSiteCode; context.TempData["hid"] = strID; context.TempData["footer"] = "奥琦微商易"; JinianNet.JNTemplate.Template t = new JinianNet.JNTemplate.Template(context, text); t.Render(Response.Output); } }
void GetHtmlPage() { int receive = 0; if (Request["id"] != null && Request["id"] != "") { Extfildid = Common.Common.NoHtml(Request["id"]); } if (Extfildid != null && Extfildid != "") { MSVAcctDetailDAL msvadetailDal = new MSVAcctDetailDAL(); try { receive = Convert.ToInt32(msvadetailDal.GetMSVAcctDetailByFid("IsReceive", Extfildid).ToString()); } catch (Exception) { receive = -1; } if (receive == 0) { msvadetailDal.UpdateMSVacct(Extfildid); } try { Amount = Convert.ToInt32(msvadetailDal.GetMSVAcctDetailByFid("Amount", Extfildid).ToString()); } catch (Exception) { } } string text = System.IO.File.ReadAllText(Server.MapPath("../ShopPage/CodeAward.html")); JinianNet.JNTemplate.TemplateContext context = new JinianNet.JNTemplate.TemplateContext(); context.TempData["errormsg"] = errormsg; context.TempData["extfid"] = Extfildid; context.TempData["receive"] = receive; context.TempData["amount"] = Amount; JinianNet.JNTemplate.Template t = new JinianNet.JNTemplate.Template(context, text); t.Render(Response.Output); }
protected void Page_Load(object sender, EventArgs e) { if (null == Request.QueryString["id"]) { return; } strThumbID = Common.Common.NoHtml(Request.QueryString["id"].ToString()); //读取模板内容 string text = System.IO.File.ReadAllText(Server.MapPath("Themes/PhotoWall/MyThumbPrintOne.html")); JinianNet.JNTemplate.TemplateContext context = new JinianNet.JNTemplate.TemplateContext(); context.TempData["title"] = "照片信息"; context.TempData["ThumbID"] = strThumbID; context.TempData["footer"] = "奥琦微商易"; JinianNet.JNTemplate.Template t = new JinianNet.JNTemplate.Template(context, text); t.Render(Response.Output); }
/// <summary> /// 获取奖项列表 /// </summary> void GetAwardList() { if (strSiteCode.Trim() != null && strSiteCode.Trim() != "" && strActID.Trim() != null && strActID.Trim() != "") { string where = string.Empty; where = " and SiteCode='" + strSiteCode + "' and a.ActID='" + strActID + "' "; List <LuckyAward> modelList = new List <LuckyAward>(); //DataSet modellistds = AwardDal.GetAwardList(where); DataSet modellistds = AwardDal.GetActAwardList(strActID, 0); foreach (DataRow row in modellistds.Tables[0].Rows) { LuckyAward Awardmodel = DataConvert.DataRowToModel <LuckyAward>(row); modelList.Add(Awardmodel); } int awardcount = modellistds.Tables[0].Rows.Count; string awardpre = string.Empty; //decimal awardpervalue =100/Convert.ToDecimal(awardcount); //if (awardpervalue.ToString().Contains(".")) //{ // awardpre = awardpervalue.ToString().Substring(0, awardpervalue.ToString().IndexOf(".") + 3); //} //else //{ // awardpre = awardpervalue.ToString(); //} //读取模板内容 string text = string.Empty; text = System.IO.File.ReadAllText(Server.MapPath("Themes/Game/award.html")); JinianNet.JNTemplate.TemplateContext context = new JinianNet.JNTemplate.TemplateContext(); context.TempData["title"] = "抽奖活动详细信息"; context.TempData["awardmodellist"] = modelList; context.TempData["sitecode"] = strSiteCode; context.TempData["openid"] = strOpenID; context.TempData["awardcount"] = awardcount; //context.TempData["awardper"] = awardpre+ "%"; context.TempData["footer"] = "奥琦微商易"; JinianNet.JNTemplate.Template t = new JinianNet.JNTemplate.Template(context, text); t.Render(Response.Output); } }
protected void Page_Load(object sender, EventArgs e) { string strProductID = string.Empty; string strSiteCode = string.Empty; if (null == Request.QueryString["id"]) { return; } strProductID = Common.Common.NoHtml(Request.QueryString["id"].ToString()); ProductDAL dal = new ProductDAL(); DataSet ds = dal.GetProductDetail(strProductID); SP_Product model = new SP_Product(); if (null != ds && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0) { model = DataConvert.DataRowToModel <SP_Product>(ds.Tables[0].Rows[0]); } strSiteCode = model.SiteCode; //读取模板内容 string text = System.IO.File.ReadAllText(Server.MapPath("Themes/Default/ProductDetail.html")); JinianNet.JNTemplate.TemplateContext context = new JinianNet.JNTemplate.TemplateContext(); context.TempData["sitecode"] = strSiteCode; context.TempData["title"] = "商品详细信息"; context.TempData["pDetail"] = model; if (null == Session["strName"]) { context.TempData["username"] = "******"; } else { context.TempData["username"] = CustomerSession.strName; } context.TempData["footer"] = "奥琦微商易"; JinianNet.JNTemplate.Template t = new JinianNet.JNTemplate.Template(context, text); t.Render(Response.Output); }
protected void SetQRCode(JinianNet.JNTemplate.TemplateContext context, string id) { QRCode qr = new QRCode(); ModuleField moduleFieldQRCodeType = this.ModuleFields.FirstOrDefault(f => f.Code == "QRCodeType"); ModuleField moduleFieldQRCodeUrl = this.ModuleFields.FirstOrDefault(f => f.Code == "QRCodeUrl"); string url = "http://www.vgo2013.com/WebService/QR.aspx"; if (moduleFieldQRCodeUrl != null) { url = moduleFieldQRCodeUrl.Value; } if (moduleFieldQRCodeType != null && moduleFieldQRCodeType.Value == "ImageQRCode") { context.TempData["qrcode"] = qr.GetImageQRCode(url + "?ID=" + id); } else { context.TempData["qrcode"] = qr.GetQRCode(url + "?ID=" + id); } }
protected void Page_Load(object sender, EventArgs e) { if (null != Request.QueryString["action"]) { strAction = Common.Common.NoHtml(Request.QueryString["action"].ToString()); strbirthday = Common.Common.NoHtml(Request.Form["txtNumber"].ToString()); if (strAction == "query") { strInfo = "今天运程:" + GetAstroInfo(strbirthday); } } string text = System.IO.File.ReadAllText(Server.MapPath("../ServicePage/Astro.html")); JinianNet.JNTemplate.TemplateContext context = new JinianNet.JNTemplate.TemplateContext(); context.TempData["title"] = "星座运程"; context.TempData["errinfo"] = strInfo; context.TempData["footer"] = "奥琦微商易"; JinianNet.JNTemplate.Template t = new JinianNet.JNTemplate.Template(context, text); t.Render(Response.Output); }
protected override void AddTempData(JinianNet.JNTemplate.TemplateContext context) { //取站点信息 DAL.SYS.AccountDAL dalAccount = new DAL.SYS.AccountDAL(); DAL.Album.AlbumDAL dalAlbum = new DAL.Album.AlbumDAL(); //取站点相册列表 DataSet dsAlbumType = dalAlbum.GetAlbumTypeList(SiteCode); List <PA_AlbumType> liAlbumType = new List <PA_AlbumType>(); if (null != dsAlbumType && dsAlbumType.Tables.Count > 0 && dsAlbumType.Tables[0].Rows.Count > 0) { foreach (DataRow row in dsAlbumType.Tables[0].Rows) { PA_AlbumType model = DataConvert.DataRowToModel <PA_AlbumType>(row); liAlbumType.Add(model); } } context.TempData["AlbumTypelist"] = liAlbumType; }
void GetHtmlPage() { MSShop shopModel = new MSShop(); MSCustomers UserModel = new MSCustomers(); #region -----------------店铺详情----------------------- if (strSID != null && strSID != "") { MSShopDAL shopDal = new MSShopDAL(); DataSet shopds = shopDal.GetMSShopDetail(strSID); if (shopds != null && shopds.Tables.Count > 0 && shopds.Tables[0].Rows.Count > 0) { shopModel = DataConvert.DataRowToModel <MSShop>(shopds.Tables[0].Rows[0]); } } #endregion #region ---------------店铺用户资料详情-------------------- if (strUid != null && strUid != "") { MSCustomersDAL UserDal = new MSCustomersDAL(); DataSet userds = UserDal.GetCustomerDetail(strUid); if (userds != null && userds.Tables.Count > 0 && userds.Tables[0].Rows.Count > 0) { UserModel = DataConvert.DataRowToModel <MSCustomers>(userds.Tables[0].Rows[0]); } } #endregion string text = System.IO.File.ReadAllText(Server.MapPath("../ShopPage/ApplyShop.html")); JinianNet.JNTemplate.TemplateContext context = new JinianNet.JNTemplate.TemplateContext(); context.TempData["footer"] = "奥琦微商易"; context.TempData["errorscript"] = errorscript; context.TempData["shopdetail"] = shopModel; context.TempData["usredetail"] = UserModel; context.TempData["action"] = action; context.TempData["sid"] = strSID; JinianNet.JNTemplate.Template t = new JinianNet.JNTemplate.Template(context, text); t.Render(Response.Output); }
public void TestILage() { JinianNet.JNTemplate.TemplateContext ctx = new JinianNet.JNTemplate.TemplateContext(); ctx.TempData.Push("func", new TemplateMethod()); SiteInfo site = new SiteInfo(); site.Copyright = "©2014 - 2015"; site.Description = ""; site.Host = "localhost"; site.KeyWords = ""; site.Logo = ""; site.Name = "xxx"; site.SiteDirectory = ""; site.Theme = "Blue"; site.ThemeDirectory = "theme"; site.Title = "jntemplate测试页"; site.Url = string.Concat("http://localhost"); if (!string.IsNullOrEmpty(site.SiteDirectory) && site.SiteDirectory != "/") { site.Url += "/" + site.SiteDirectory; } site.ThemeUrl = string.Concat(site.Url, "/", site.ThemeDirectory, "/", site.Theme); //ctx.TempData.Push("Model", ); ctx.TempData.Push("Site", site); string basePath = new System.IO.DirectoryInfo(System.Environment.CurrentDirectory).Parent.Parent.FullName; string path = basePath + "\\templets\\default"; var conf = Configuration.EngineConfig.CreateDefault(); conf.CachingProvider = "JinianNet.JNTemplate.Caching.MemoryCache"; Engine.Configure(conf); for (var i = 0; i < 20000; i++) { JinianNet.JNTemplate.Template t = new JinianNet.JNTemplate.Template(ctx, System.IO.File.ReadAllText(path + "\\questionlist.html")); t.Context.CurrentPath = path; t.Render(); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { string strSiteCode = string.Empty; string strCatID = string.Empty; if (null == Request.QueryString["SiteCode"]) { strSiteCode = "VYIGO"; } if (null == Request.QueryString["CatID"]) { strCatID = "VYIGO"; } strSiteCode = Common.Common.NoHtml(Request.QueryString["SiteCode"].ToString()); strCatID = Common.Common.NoHtml(Request.QueryString["CatID"].ToString()); DAL.CMS.ArticleDAL dalCat = new DAL.CMS.ArticleDAL(); DataSet dsArt = dalCat.GetCategoryList(strSiteCode, strCatID); List <CMS_Article> liArtList = new List <CMS_Article>(); if (null != dsArt && dsArt.Tables.Count > 0 && dsArt.Tables[0].Rows.Count > 0) { foreach (DataRow row in dsArt.Tables[0].Rows) { CMS_Article model = DataConvert.DataRowToModel <CMS_Article>(row); liArtList.Add(model); } } string text = System.IO.File.ReadAllText(Server.MapPath("../ShopPage/helpdoc.html")); JinianNet.JNTemplate.TemplateContext context = new JinianNet.JNTemplate.TemplateContext(); context.TempData["artList"] = liArtList; JinianNet.JNTemplate.Template t = new JinianNet.JNTemplate.Template(context, text); t.Render(Response.Output); } }
void GetInfo() { string like = string.Empty; string strwhere = string.Empty; strwhere = " and a.CustomerID='" + Session["customerID"] + "' "; if (Request["like"] != null && Request["like"] != "") { like = " and a.ptitle like '%" + Request["like"] + "%' "; } else { like = ""; } strwhere = strwhere + like; MSProductDAL productDal = new MSProductDAL(); List <SecHandModel> MySecHandModel = new List <SecHandModel>(); DataSet sechandDs = productDal.GetSecHandProduct(strwhere); if (sechandDs != null && sechandDs.Tables.Count > 0 && sechandDs.Tables[0].Rows.Count > 0) { foreach (DataRow row in sechandDs.Tables[0].Rows) { SecHandModel sechandModel = DataConvert.DataRowToModel <SecHandModel>(row); MySecHandModel.Add(sechandModel); } } string text = System.IO.File.ReadAllText(Server.MapPath("../ShopPage/MySecHand.html")); JinianNet.JNTemplate.TemplateContext context = new JinianNet.JNTemplate.TemplateContext(); context.TempData["title"] = "我的商品"; context.TempData["errorscript"] = errorscript; context.TempData["productlist"] = MySecHandModel; context.TempData["footer"] = "奥琦微商易"; JinianNet.JNTemplate.Template t = new JinianNet.JNTemplate.Template(context, text); t.Render(Response.Output); }
public void TestPage() { JinianNet.JNTemplate.TemplateContext ctx = new JinianNet.JNTemplate.TemplateContext(); ctx.TempData.Push("func", new TemplateMethod()); SiteInfo site = new SiteInfo(); site.Copyright = "©2014 - 2015"; site.Description = ""; site.Host = "localhost"; site.KeyWords = ""; site.Logo = ""; site.Name = "xxx"; site.SiteDirectory = ""; site.Theme = "Blue"; site.ThemeDirectory = "theme"; site.Title = "jntemplate测试页"; site.Url = string.Concat("http://localhost"); if (!string.IsNullOrEmpty(site.SiteDirectory) && site.SiteDirectory != "/") { site.Url += "/" + site.SiteDirectory; } site.ThemeUrl = string.Concat(site.Url, "/", site.ThemeDirectory, "/", site.Theme); //ctx.TempData.Push("Model", ); ctx.TempData.Push("Site", site); string basePath = new System.IO.DirectoryInfo(System.Environment.CurrentDirectory).Parent.Parent.FullName; string path = basePath + "\\templets\\default"; JinianNet.JNTemplate.Template t = new JinianNet.JNTemplate.Template(ctx, System.IO.File.ReadAllText(path + "\\questionlist.html")); t.Context.CurrentPath = path; string result = t.Render(); //可直接查看项目录下的html/jnt.html 文件效果 System.IO.File.WriteAllText(basePath + "\\html\\jnt.html", result); }
void GetHtmlPage() { string text = System.IO.File.ReadAllText(Server.MapPath("../ShopPage/PayWay.html")); JinianNet.JNTemplate.TemplateContext context = new JinianNet.JNTemplate.TemplateContext(); if (Session["customerID"] != null && Session["customerID"].ToString() != "") { context.TempData["uid"] = Session["customerID"].ToString(); } context.TempData["title"] = "支付方式"; context.TempData["pname"] = pname; context.TempData["openid"] = strOpenID; context.TempData["ordernum"] = ordernum; context.TempData["countcost"] = countcost; context.TempData["customid"] = customid; context.TempData["payway"] = payway; context.TempData["errormsg"] = errormsg; context.TempData["footer"] = "奥琦微商易"; JinianNet.JNTemplate.Template t = new JinianNet.JNTemplate.Template(context, text); t.Render(Response.Output); }
void getTemplate() { #region --------------获取客户详细----------------- MSCustomers customerModel = new MSCustomers(); MSCustomersDAL customerDal = new MSCustomersDAL(); DataSet customerDs = customerDal.GetCustomerDetail(strUid); if (null != customerDs && customerDs.Tables.Count > 0 && customerDs.Tables[0].Rows.Count > 0) { customerModel = DataConvert.DataRowToModel <MSCustomers>(customerDs.Tables[0].Rows[0]); if (customerModel.HeadImg != null && customerModel.HeadImg != "") { oldimgname = customerModel.HeadImg; } } #endregion string text = System.IO.File.ReadAllText(Server.MapPath("HtmlPage/customerinfo.html")); JinianNet.JNTemplate.TemplateContext context = new JinianNet.JNTemplate.TemplateContext(); JinianNet.JNTemplate.Template t = new JinianNet.JNTemplate.Template(context, text); context.TempData["customer"] = customerModel; context.TempData["errorscript"] = errorscript; context.TempData["fid"] = strfid; context.TempData["footer"] = "奥琦微商易"; t.Render(Response.Output); }
protected void Page_Load(object sender, EventArgs e) { string strSiteCode = string.Empty; if (null == Request.QueryString["sitecode"]) { return; } strSiteCode = Common.Common.NoHtml(Request.QueryString["sitecode"].ToString()); //取站点相册列表 DAL.Vote.OptionDAL dalVotePhoto = new DAL.Vote.OptionDAL(); DataSet dsThumbList = dalVotePhoto.getVotePhoto(strSiteCode); List <VotePhoto> lstThumb = new List <VotePhoto>(); foreach (DataRow row in dsThumbList.Tables[0].Rows) { VotePhoto model = DataConvert.DataRowToModel <VotePhoto>(row); lstThumb.Add(model); } //读取模板内容 string text = System.IO.File.ReadAllText(Server.MapPath("Themes/Vote/VotePhoto.html")); JinianNet.JNTemplate.TemplateContext context = new JinianNet.JNTemplate.TemplateContext(); context.TempData["sitecode"] = strSiteCode; context.TempData["title"] = "梦想展台"; context.TempData["lstThumb"] = lstThumb; context.TempData["footer"] = "奥琦微商易"; JinianNet.JNTemplate.Template t = new JinianNet.JNTemplate.Template(context, text); t.Render(Response.Output); }
/// <summary> /// 获取奖项列表 /// </summary> void GetAwardList() { if (strSiteCode.Trim() != null && strSiteCode.Trim() != "" && strActID.Trim() != null && strActID.Trim() != "") { List <LuckyAward> modelList = new List <LuckyAward>(); DataSet modellistds = AwardDal.GetActAwardList(strActID, 0); foreach (DataRow row in modellistds.Tables[0].Rows) { LuckyAward Awardmodel = DataConvert.DataRowToModel <LuckyAward>(row); modelList.Add(Awardmodel); } int awardcount = modellistds.Tables[0].Rows.Count; string awardtitle = string.Empty; string script = string.Empty; string peize = string.Empty; string peizeid = string.Empty; int peizenum = 0; int frontpeizenum = 0; int beforpeizenum = 0; for (int i = 0; i < awardcount; i++) { try { peizenum = Convert.ToInt32(modellistds.Tables[0].Rows[i]["AwardPro"].ToString()); } catch (Exception) { } peize = modellistds.Tables[0].Rows[i]["Award"].ToString(); peizeid = modellistds.Tables[0].Rows[i]["ID"].ToString(); if (i == 0) { script += "\r\n if(randNum>=1&&randNum<=" + peizenum + ")" + "\r\n {prize=\"" + peize + "\";zjl = true;peizeid=\"" + peizeid + "\";}"; } else { peizenum = beforpeizenum + peizenum; script += "\r\n if(randNum>=" + frontpeizenum + "&&randNum<=" + peizenum + ")" + "\r\n {prize=\"" + peize + "\";zjl = true;peizeid=\"" + peizeid + "\";}"; } frontpeizenum = peizenum + 1; beforpeizenum = peizenum; } //读取模板内容 string text = string.Empty; text = System.IO.File.ReadAllText(Server.MapPath("Themes/Game/scratchcard.html")); JinianNet.JNTemplate.TemplateContext context = new JinianNet.JNTemplate.TemplateContext(); context.TempData["title"] = "刮刮卡活动详细信息"; context.TempData["awardmodellist"] = modelList; context.TempData["sitecode"] = strSiteCode; context.TempData["openid"] = strOpenID; context.TempData["awardcount"] = awardcount; context.TempData["actid"] = strActID; context.TempData["script"] = script; context.TempData["footer"] = "奥琦微商易"; JinianNet.JNTemplate.Template t = new JinianNet.JNTemplate.Template(context, text); t.Render(Response.Output); } }
public void TestILVsReflectionPage() { JinianNet.JNTemplate.TemplateContext ctx = new JinianNet.JNTemplate.TemplateContext(); ctx.TempData.Push("func", new TemplateMethod()); SiteInfo site = new SiteInfo(); site.Copyright = "©2014 - 2015"; site.Description = ""; site.Host = "localhost"; site.KeyWords = ""; site.Logo = ""; site.Name = "xxx"; site.SiteDirectory = ""; site.Theme = "Blue"; site.ThemeDirectory = "theme"; site.Title = "jntemplate测试页"; site.Url = string.Concat("http://localhost"); if (!string.IsNullOrEmpty(site.SiteDirectory) && site.SiteDirectory != "/") { site.Url += "/" + site.SiteDirectory; } site.ThemeUrl = string.Concat(site.Url, "/", site.ThemeDirectory, "/", site.Theme); //ctx.TempData.Push("Model", ); ctx.TempData.Push("Site", site); string basePath = new System.IO.DirectoryInfo(System.Environment.CurrentDirectory).Parent.Parent.FullName; string path = basePath + "\\templets\\default"; // JinianNet.JNTemplate.Dynamic.IDynamicHelpers h; Configuration.EngineConfig conf; string text1 = null, text2 = null; string result = ""; Stopwatch s = new Stopwatch(); s.Start(); s.Stop(); //////////////////////////////////////////////////////////////////////////////////// //h = new JinianNet.JNTemplate.Dynamic.ILHelpers(); conf = Configuration.EngineConfig.CreateDefault(); //conf.CachingProvider = "JinianNet.JNTemplate.Test.UserCache,JinianNet.JNTemplate.Test"; conf.CachingProvider = "JinianNet.JNTemplate.Caching.MemoryCache"; Engine.Configure(conf); s.Restart(); for (var i = 0; i < 1000; i++) { JinianNet.JNTemplate.Template t = new JinianNet.JNTemplate.Template(ctx, System.IO.File.ReadAllText(path + "\\questionlist.html")); t.Context.CurrentPath = path; text1 = t.Render(); } s.Stop(); result += "IL 1000次运行 耗时 :" + s.ElapsedMilliseconds + "毫秒"; //////////////////////////////////////////////////////////////////////////////////// GC.Collect(); //////////////////////////////////////////////////////////////////////////////////// //h = new JinianNet.JNTemplate.Dynamic.ReflectionHelpers(); conf = Configuration.EngineConfig.CreateDefault(); conf.CachingProvider = null; Engine.Configure(conf); s.Restart(); for (var i = 0; i < 1000; i++) { JinianNet.JNTemplate.Template t = new JinianNet.JNTemplate.Template(ctx, System.IO.File.ReadAllText(path + "\\questionlist.html")); t.Context.CurrentPath = path; text2 = t.Render(); //h.ExcuteMethod(DateTime.Now, "AddDays", new object[] { 30 }); } s.Stop(); result += ": Reflection 1000次运行 耗时 :" + s.ElapsedMilliseconds + "毫秒"; //////////////////////////////////////////////////////////////////////////////////// System.IO.File.WriteAllText(basePath + "\\html\\ILVsReflection.txt", result); System.IO.File.WriteAllText(basePath + "\\html\\ILVsReflection1.txt", text1); System.IO.File.WriteAllText(basePath + "\\html\\ILVsReflection2.txt", text2); Assert.AreEqual(text1, text2); }
protected void Page_Load(object sender, EventArgs e) { string strMobile = string.Empty; string strRealName = string.Empty; string strAddress = string.Empty; string strSiteCode = string.Empty; string strSiteName = string.Empty; string strErrInfo = string.Empty; string strCustomerID = string.Empty; if (null != Request.QueryString["SiteCode"] || null != Request.QueryString["CustomerID"]) { strSiteCode = Common.Common.NoHtml(Request.QueryString["SiteCode"].ToString()); strCustomerID = Common.Common.NoHtml(Request.QueryString["CustomerID"].ToString()); CustomerSession.strSiteCode = strSiteCode; CustomerSession.strCustomerID = strCustomerID; } if (null != Request.QueryString["action"]) { if (Request.QueryString["action"] == "checkout") { strMobile = Common.Common.NoHtml(Request.Form["mobile"].ToString()); strRealName = Common.Common.NoHtml(Request.Form["realname"].ToString()); strAddress = Common.Common.NoHtml(Request.Form["address"].ToString()); if (string.IsNullOrEmpty(strMobile) || string.IsNullOrEmpty(strRealName)) { strErrInfo = "请完整填写预订信息!"; } DAL.Product.CartDAL dalCustomer = new DAL.Product.CartDAL(); try { if (dalCustomer.CheckOutOrder(strSiteCode, CustomerSession.strCustomerID, strRealName, strMobile, strAddress) == 1) { strErrInfo = "订单提交完成!"; Response.Redirect("MyOrder.aspx?SiteCode=" + strSiteCode + "&CustomerID=" + strCustomerID, false); return; } else { strErrInfo = "订单提交有误!"; } } catch { strErrInfo = "订单提交有误!"; } } } string text = System.IO.File.ReadAllText(Server.MapPath("Themes/Default/CheckOut.html")); JinianNet.JNTemplate.TemplateContext context = new JinianNet.JNTemplate.TemplateContext(); context.TempData["SiteCode"] = strSiteCode; context.TempData["Customer"] = strCustomerID; context.TempData["ErrInfo"] = strErrInfo; context.TempData["Title"] = "订单结算"; context.TempData["SiteName"] = strSiteName; context.TempData["footer"] = "奥琦微商易"; JinianNet.JNTemplate.Template t = new JinianNet.JNTemplate.Template(context, text); t.Render(Response.Output); }
void getvoteDetail() { // DAL.Vote.IndexDAL dalIndex = new IndexDAL(); strSubjectID = dalIndex.GetSubjectData(strID); if (string.IsNullOrEmpty(strSubjectID)) { return; } //取投票主题与选项 DAL.Vote.SubjectDAL dalSubject = new DAL.Vote.SubjectDAL(); DataSet dsSubject = dalSubject.GetVoteDetail(strSubjectID,strSiteCode); if (null != dsSubject && dsSubject.Tables.Count > 0 && dsSubject.Tables[0].Rows.Count > 0) { strSubjectID = dsSubject.Tables[0].Rows[0]["ID"].ToString(); strSubjectTitle = dsSubject.Tables[0].Rows[0]["Subject"].ToString(); strSubjectContent = dsSubject.Tables[0].Rows[0]["Content"].ToString(); strEndTime = dsSubject.Tables[0].Rows[0]["EndTime"].ToString(); if (Convert.ToDateTime(strEndTime) > DateTime.Now) { strEndTime = "show"; } } else { return; } List<Model.Vote.VOTE_Option> liOption = new List<Model.Vote.VOTE_Option>(); DataSet dsOptions = dalSubject.GetOptionsData(strSubjectID); if (null != dsOptions && dsOptions.Tables.Count > 0 && dsOptions.Tables[0].Rows.Count > 0) { foreach (DataRow row in dsOptions.Tables[0].Rows) { Model.Vote.VOTE_Option model = DataConvert.DataRowToModel<Model.Vote.VOTE_Option>(row); liOption.Add(model); } } List<VOTE_Subject> lisubjectlist = new List<VOTE_Subject>(); DataSet dssublist = dalSubject.GetSubjectDataList(strSiteCode); int sublistcount = dssublist.Tables[0].Rows.Count; if (null != dssublist && dssublist.Tables.Count > 0 && dssublist.Tables[0].Rows.Count > 0) { foreach (DataRow row in dssublist.Tables[0].Rows) { VOTE_Subject model = DataConvert.DataRowToModel<VOTE_Subject>(row); lisubjectlist.Add(model); } } //读取模板内容 string text = string.Empty; if (!File.Exists(Server.MapPath("Themes/" + strTheme + "/Vote.html"))) { text = System.IO.File.ReadAllText(Server.MapPath("Themes/Vote/Vote.html")); } else { text = System.IO.File.ReadAllText(Server.MapPath("Themes/" + strTheme + "/Vote.html")); } JinianNet.JNTemplate.TemplateContext context = new JinianNet.JNTemplate.TemplateContext(); context.TempData["title"] = strTitle; context.TempData["siteid"] = Session["siteid"]; context.TempData["footer"] = "奥琦微商易"; context.TempData["sitecode"] =strSiteCode; context.TempData["openid"] = strOpenID; context.TempData["subjectID"] = strSubjectID; context.TempData["SubjectTitle"] = strSubjectTitle; context.TempData["SubjectContent"] = strSubjectContent; context.TempData["SubjectEndTime"] = strEndTime; context.TempData["option_list"] = liOption; context.TempData["subjectlist"] = lisubjectlist; context.TempData["sublistcount"] = sublistcount; JinianNet.JNTemplate.Template t = new JinianNet.JNTemplate.Template(context, text); t.Render(Response.Output); }
void getTemplate() { #region --------------帖子详细-------------------------- MSForumTopic TopicModel = new MSForumTopic(); MSForumTopicDAL TopicDel = new MSForumTopicDAL(); DataSet TopicDs = TopicDel.GetTopicDetail(strtid); if (null != TopicDs && TopicDs.Tables.Count > 0 && TopicDs.Tables[0].Rows.Count > 0) { TopicModel = DataConvert.DataRowToModel <MSForumTopic>(TopicDs.Tables[0].Rows[0]); } #endregion #region -----------帖子图集---------------- List <MSForumTopicAtlas> atlasModelList = new List <MSForumTopicAtlas>(); MSForumTopicAtlasDAL atlasDal = new MSForumTopicAtlasDAL(); DataSet altasDs = atlasDal.GetMSFTAtlasList(" and tid='" + strtid + "'"); if (altasDs != null && altasDs.Tables.Count > 0 && altasDs.Tables[0].Rows.Count > 0) { foreach (DataRow row in altasDs.Tables[0].Rows) { MSForumTopicAtlas atlasModel = DataConvert.DataRowToModel <MSForumTopicAtlas>(row); atlasModelList.Add(atlasModel); } } #endregion #region ---------点赞或喜欢------------ MSForumTopicLoveDAL lovelikeDal = new MSForumTopicLoveDAL(); string likecount = lovelikeDal.GetLoveOrLikeCount(strtid, "tlike").ToString(); string lovecount = lovelikeDal.GetLoveOrLikeCount(strtid, "tlove").ToString(); #endregion #region ---------评论列表以及图集信息------------ List <CommentListGetSet> commentModelList = new List <CommentListGetSet>(); MSForumCommentDAL commentDal = new MSForumCommentDAL(); DataSet commentDs = commentDal.GetCommentList(" and a.tid='" + strtid + "' "); List <MSForumTopicAtlas> commatlasModelList = new List <MSForumTopicAtlas>(); int commentcount = 0; if (commentDs != null && commentDs.Tables.Count > 0 && commentDs.Tables[0].Rows.Count > 0) { foreach (DataRow row in commentDs.Tables[0].Rows) { CommentListGetSet commentModel = DataConvert.DataRowToModel <CommentListGetSet>(row); string cmmid = commentModel.ID; if (commentModel.NickName == null || commentModel.NickName == "") { commentModel.NickName = "游客"; } #region ------------评论图集----------------------- DataSet commaltasDs = atlasDal.GetMSFTAtlasList(" and tid='comm" + cmmid + "'"); if (commaltasDs != null && commaltasDs.Tables.Count > 0 && commaltasDs.Tables[0].Rows.Count > 0) { foreach (DataRow commrow in commaltasDs.Tables[0].Rows) { MSForumTopicAtlas atlasModel = DataConvert.DataRowToModel <MSForumTopicAtlas>(commrow); commatlasModelList.Add(atlasModel); } } #endregion commentModelList.Add(commentModel); } } try { commentcount = commentDs.Tables[0].Rows.Count; } catch (Exception) { commentcount = 0; } #endregion string text = System.IO.File.ReadAllText(Server.MapPath("HtmlPage/commentlist.html")); JinianNet.JNTemplate.TemplateContext context = new JinianNet.JNTemplate.TemplateContext(); JinianNet.JNTemplate.Template t = new JinianNet.JNTemplate.Template(context, text); context.TempData["topicdetail"] = TopicModel; context.TempData["altaslist"] = atlasModelList; context.TempData["commentlist"] = commentModelList; context.TempData["commentatlaslist"] = commatlasModelList; context.TempData["commentcount"] = commentcount; context.TempData["errorscript"] = errorscript; context.TempData["likecount"] = likecount; context.TempData["lovecount"] = lovecount; context.TempData["fid"] = strfid; context.TempData["uid"] = strUid; context.TempData["footer"] = "奥琦微商易"; t.Render(Response.Output); }
protected void Page_Load(object sender, EventArgs e) { string strMobile = string.Empty; string strPassWord = string.Empty; string strSiteCode = string.Empty; string strTitle = string.Empty; string strTheme = string.Empty; if (null == Session["strSiteCode"]) { return; } strSiteCode = Session["strSiteCode"].ToString(); if (null != Request.QueryString["action"]) { if (Request.QueryString["action"] == "login") { strMobile = Common.Common.NoHtml(Request.Form["mobile"].ToString()); strPassWord = Common.Common.NoHtml(Request.Form["password"].ToString()); DAL.SYS.CustomerDAL dal = new DAL.SYS.CustomerDAL(); DataSet ds = dal.GetCustomerData(strMobile, Common.Common.MD5(strPassWord), strSiteCode); if (null != ds && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0) { CustomerSession.strCustomerID = ds.Tables[0].Rows[0]["ID"].ToString(); CustomerSession.strMobile = ds.Tables[0].Rows[0]["Mobile"].ToString(); CustomerSession.strSiteCode = ds.Tables[0].Rows[0]["SiteCode"].ToString(); CustomerSession.strOpenID = ds.Tables[0].Rows[0]["OpenID"].ToString(); CustomerSession.strName = ds.Tables[0].Rows[0]["Name"].ToString(); Session["strName"] = CustomerSession.strName; Session["strCustomerID"] = CustomerSession.strCustomerID; Session["strSiteCode"] = CustomerSession.strSiteCode; Session["strOpenID"] = CustomerSession.strOpenID; } //Response.Redirect("ProductList.aspx?SiteCode=" + strSiteCode, false); Response.Redirect("LoginOK.aspx", false); } } DAL.SYS.AccountDAL dalAccount = new DAL.SYS.AccountDAL(); DataSet dsAccountExt = dalAccount.GetAExtDataBySiteCode(strSiteCode); if (null != dsAccountExt && dsAccountExt.Tables.Count > 0 && dsAccountExt.Tables[0].Rows.Count > 0) { strTheme = dsAccountExt.Tables[0].Rows[0]["Themes"].ToString(); strTitle = dsAccountExt.Tables[0].Rows[0]["Name"].ToString(); } string text = string.Empty; if (!File.Exists(Server.MapPath("Themes/" + strTheme + "/Login.html"))) { text = System.IO.File.ReadAllText(Server.MapPath("Themes/Default/Login.html")); } else { text = System.IO.File.ReadAllText(Server.MapPath("Themes/" + strTheme + "/Login.html")); } JinianNet.JNTemplate.TemplateContext context = new JinianNet.JNTemplate.TemplateContext(); context.TempData["title"] = "用户登录"; if (null == Session["strName"]) { context.TempData["username"] = "******"; } else { context.TempData["username"] = CustomerSession.strName; } if (null == Session["customerid"]) { context.TempData["customerid"] = null; } else { context.TempData["customerid"] = CustomerSession.strCustomerID; } context.TempData["sitename"] = strTitle; context.TempData["sitecode"] = strSiteCode; context.TempData["footer"] = "奥琦微商易"; JinianNet.JNTemplate.Template t = new JinianNet.JNTemplate.Template(context, text); t.Render(Response.Output); }
public void TestILage() { var c = Configuration.EngineConfig.CreateDefault(); //开始严格大小写模式 默认忽略大小写 //conf.IgnoreCase = false; Engine.Configure(c); JinianNet.JNTemplate.TemplateContext ctx = new JinianNet.JNTemplate.TemplateContext(); ctx.TempData.Push("func", new TemplateMethod()); SiteInfo site = new SiteInfo(); site.Copyright = "©2014 - 2015"; site.Description = ""; site.Host = "localhost"; site.KeyWords = ""; site.Logo = ""; site.Name = "xxx"; site.SiteDirectory = ""; site.Theme = "Blue"; site.ThemeDirectory = "theme"; site.Title = "jntemplate测试页"; site.Url = string.Concat("http://localhost"); if (!string.IsNullOrEmpty(site.SiteDirectory) && site.SiteDirectory != "/") { site.Url += "/" + site.SiteDirectory; } site.ThemeUrl = string.Concat(site.Url, "/", site.ThemeDirectory, "/", site.Theme); //ctx.TempData.Push("Model", ); ctx.TempData.Push("Site", site); string basePath = #if NET20 || NET40 System.Environment.CurrentDirectory; #else new DirectoryInfo(Directory.GetCurrentDirectory()).Parent.Parent.Parent.FullName; #endif string path = basePath + "\\templets\\default"; string html = null; var conf = Configuration.EngineConfig.CreateDefault(); conf.CacheProvider = new UserCache(); conf.DynamicProvider = new JinianNet.JNTemplate.Dynamic.ILDynamicProvider();// new TestExecutor(); Engine.Configure(conf); Stopwatch s = new Stopwatch(); s.Start(); for (var i = 0; i < MAX_RUN_COUNT; i++) { JinianNet.JNTemplate.Template t = new JinianNet.JNTemplate.Template(ctx, System.IO.File.ReadAllText(path + "\\questionlist.html")); t.Context.CurrentPath = path; if (i == MAX_RUN_COUNT - 1) { System.IO.File.WriteAllText(basePath + "\\result\\IL.html", t.Render()); } else { html = t.Render(); } } s.Stop(); string result = "\r\n运行耗时:" + s.ElapsedMilliseconds + "毫秒 IL(" + MAX_RUN_COUNT + "次)"; System.IO.File.AppendAllText(basePath + "\\result\\ILVsReflection.txt", result); Assert.Equal(HTML_RESULT, html.Replace("\r", "").Replace("\t", "").Replace("\n", "").Replace(" ", "")); }
protected void Page_Load(object sender, EventArgs e) { string strSiteCode = string.Empty; string strOpenID = string.Empty; if (null == Request.QueryString["state"]) { return; } else { strSiteCode = Common.Common.NoHtml(Request.QueryString["state"].ToString()); } string code = Request.QueryString["code"] as string; if (!string.IsNullOrEmpty(code)) { WXConfigDAL dal = new WXConfigDAL(); Model.WeiXin.WXConfig wxConfig = dal.GetWXConfigBySiteCode(strSiteCode); if (wxConfig != null) { WeiXinCore.Models.WeiXinConfig weixinConfig = new WeiXinCore.Models.WeiXinConfig() { ID = wxConfig.WXID, Name = wxConfig.WXName, Token = wxConfig.WXToken, AppId = wxConfig.WXAppID, AppSecret = wxConfig.WXAppSecret }; WeiXinCore.WeiXin weixin = new WeiXinCore.WeiXin(weixinConfig); Oauth2AccessToken oauth2AccessToken = weixin.GetOauth2AccessToken(code); if (oauth2AccessToken != null) { strOpenID = oauth2AccessToken.OpenID; } } else { strOpenID = code; } } strOpenID = code; List <Model.MiniShop.MSVProduct> liProduct = new List <Model.MiniShop.MSVProduct>(); DAL.MiniShop.MSProductDAL dalProduct = new DAL.MiniShop.MSProductDAL(); DataSet ds = dalProduct.GetProductListBySiteCode(strSiteCode); foreach (DataRow row in ds.Tables[0].Rows) { Model.MiniShop.MSVProduct model = DataConvert.DataRowToModel <Model.MiniShop.MSVProduct>(row); liProduct.Add(model); } //读取模板内容 string text = System.IO.File.ReadAllText(Server.MapPath("Themes/Default/VProductList.html")); JinianNet.JNTemplate.TemplateContext context = new JinianNet.JNTemplate.TemplateContext(); context.TempData["sitecode"] = strSiteCode; context.TempData["openid"] = strOpenID; context.TempData["product_list"] = liProduct; context.TempData["footer"] = "奥琦微商易"; JinianNet.JNTemplate.Template t = new JinianNet.JNTemplate.Template(context, text); t.Render(Response.Output); }
public void TestILVsReflectionPage() { JinianNet.JNTemplate.TemplateContext ctx = new JinianNet.JNTemplate.TemplateContext(); ctx.TempData.Push("func", new TemplateMethod()); SiteInfo site = new SiteInfo(); site.Copyright = "©2014 - 2015"; site.Description = ""; site.Host = "localhost"; site.KeyWords = ""; site.Logo = ""; site.Name = "xxx"; site.SiteDirectory = ""; site.Theme = "Blue"; site.ThemeDirectory = "theme"; site.Title = "jntemplate测试页"; site.Url = string.Concat("http://localhost"); if (!string.IsNullOrEmpty(site.SiteDirectory) && site.SiteDirectory != "/") { site.Url += "/" + site.SiteDirectory; } site.ThemeUrl = string.Concat(site.Url, "/", site.ThemeDirectory, "/", site.Theme); //ctx.TempData.Push("Model", ); ctx.TempData.Push("Site", site); string basePath = new System.IO.DirectoryInfo(System.Environment.CurrentDirectory).Parent.Parent.FullName; string path = basePath + "\\templets\\default"; // JinianNet.JNTemplate.Dynamic.IDynamicHelpers h; Configuration.EngineConfig conf; string text1 = null, text2 = null; string result=""; Stopwatch s = new Stopwatch(); s.Start(); s.Stop(); //////////////////////////////////////////////////////////////////////////////////// //h = new JinianNet.JNTemplate.Dynamic.ILHelpers(); conf = Configuration.EngineConfig.CreateDefault(); //conf.CachingProvider = "JinianNet.JNTemplate.Test.UserCache,JinianNet.JNTemplate.Test"; conf.CachingProvider = "JinianNet.JNTemplate.Caching.MemoryCache"; Engine.Configure(conf); s.Restart(); for (var i = 0; i < 1000; i++) { JinianNet.JNTemplate.Template t = new JinianNet.JNTemplate.Template(ctx, System.IO.File.ReadAllText(path + "\\questionlist.html")); t.Context.CurrentPath = path; text1 = t.Render(); } s.Stop(); result += "IL 1000次运行 耗时 :" + s.ElapsedMilliseconds + "毫秒"; //////////////////////////////////////////////////////////////////////////////////// GC.Collect(); //////////////////////////////////////////////////////////////////////////////////// //h = new JinianNet.JNTemplate.Dynamic.ReflectionHelpers(); conf = Configuration.EngineConfig.CreateDefault(); conf.CachingProvider = null; Engine.Configure(conf); s.Restart(); for (var i = 0; i < 1000; i++) { JinianNet.JNTemplate.Template t = new JinianNet.JNTemplate.Template(ctx, System.IO.File.ReadAllText(path + "\\questionlist.html")); t.Context.CurrentPath = path; text2 = t.Render(); //h.ExcuteMethod(DateTime.Now, "AddDays", new object[] { 30 }); } s.Stop(); result += ": Reflection 1000次运行 耗时 :" + s.ElapsedMilliseconds + "毫秒"; //////////////////////////////////////////////////////////////////////////////////// System.IO.File.WriteAllText(basePath + "\\html\\ILVsReflection.txt", result); System.IO.File.WriteAllText(basePath + "\\html\\ILVsReflection1.txt", text1); System.IO.File.WriteAllText(basePath + "\\html\\ILVsReflection2.txt", text2); Assert.AreEqual(text1, text2); }
void GetProductDetail() { string ptitle = string.Empty; string shopID = string.Empty; string puid = string.Empty; int paracount = 0; #region 产品详细 MSProductDAL productDal = new MSProductDAL(); MSProduct productModel = new MSProduct(); DataSet productds = productDal.GetProductDetail(strpid); if (null != productds && productds.Tables.Count > 0 && productds.Tables[0].Rows.Count > 0) { productModel = DataConvert.DataRowToModel <MSProduct>(productds.Tables[0].Rows[0]); ptitle = productModel.Ptitle; puid = productModel.CustomerID; if (productModel.SID != null && productModel.SID != "") { shopID = productModel.SID; } } #endregion #region 店铺详细 MSShop shopModel = new MSShop(); if (shopID != null && shopID != "") { MSShopDAL shopDal = new MSShopDAL(); DataSet shopds = shopDal.GetMSShopDetail(shopID); if (shopds != null && shopds.Tables.Count > 0 && shopds.Tables[0].Rows.Count > 0) { shopModel = DataConvert.DataRowToModel <MSShop>(shopds.Tables[0].Rows[0]); } } #endregion #region 图集列表 MSProductAtlasDAL atlasDal = new MSProductAtlasDAL(); List <MSProductAtlas> AtlasListModel = new List <MSProductAtlas>(); DataSet atlasds = atlasDal.GetProductAtlasByPID(strpid); if (null != atlasds && atlasds.Tables.Count > 0 && atlasds.Tables[0].Rows.Count > 0) { foreach (DataRow row in atlasds.Tables[0].Rows) { MSProductAtlas atlasModel = DataConvert.DataRowToModel <MSProductAtlas>(row); AtlasListModel.Add(atlasModel); } } #endregion #region 产品参数列表 //MSProductParaDAL paraDal = new MSProductParaDAL(); //DataSet paramds = paraDal.GetProductParamByPID(strpid); //string paramlist = string.Empty; //if (null != paramds && paramds.Tables.Count > 0 && paramds.Tables[0].Rows.Count > 0) //{ // for (int i = 0; i < paramds.Tables[0].Rows.Count; i++) // { // paramlist += "<tr>\r\n"; // string paraname = paramds.Tables[0].Rows[i]["ParName"].ToString(); // string paravalue = paramds.Tables[0].Rows[i]["ParValue"].ToString(); // paramlist += "<td class=\"td_title\">" + paraname + "</td><td>" + paravalue + "</td>\r\n"; // try // { // i = i + 1; // paraname = paramds.Tables[0].Rows[i]["ParName"].ToString(); // paravalue = paramds.Tables[0].Rows[i]["ParValue"].ToString(); // paramlist += "<td class=\"td_title\">" + paraname + "</td><td>" + paravalue + "</td>\r\n"; // } // catch (Exception) // { // paramlist += "<td class=\"td_title\"> </td><td> </td>\r\n"; // } // paramlist += "</tr>\r\n"; // } //} #endregion #region -------获取产品型号及价格------------ ProductPara ParaModel = new ProductPara(); List <MSProductPara> paralistmodel = new List <MSProductPara>(); MSProductParaDAL paraDal = new MSProductParaDAL(); DataSet parads = paraDal.GetMaxMinPrice(strpid); if (parads != null && parads.Tables.Count > 0 && parads.Tables[0].Rows.Count > 0) { paracount = parads.Tables[0].Rows.Count; ParaModel = DataConvert.DataRowToModel <ProductPara>(parads.Tables[0].Rows[0]); } parads = null; parads = paraDal.GetProductParamByPID(strpid); if (parads != null && parads.Tables.Count > 0 && parads.Tables[0].Rows.Count > 0) { foreach (DataRow item in parads.Tables[0].Rows) { MSProductPara paramodel = DataConvert.DataRowToModel <MSProductPara>(item); paralistmodel.Add(paramodel); } } #endregion #region ----------------根据产品编号获取联系方式-------------------- MSShopContactsDAL contactDal = new MSShopContactsDAL(); MSShopContacts contactModel = new MSShopContacts(); DataSet contactDs = contactDal.GetContactDetailByPID(strpid); MSCustomersDAL CustomerDal = new MSCustomersDAL(); MSCustomers CustomerModel = new MSCustomers(); DataSet PuidDs = null; int contactcount = 0; if (contactDs != null && contactDs.Tables.Count > 0 && contactDs.Tables[0].Rows.Count > 0) { contactModel = DataConvert.DataRowToModel <MSShopContacts>(contactDs.Tables[0].Rows[0]); contactcount = 1; } else { if (puid != null && puid != "") { PuidDs = CustomerDal.GetCustomerDetail(puid); } if (PuidDs != null && PuidDs.Tables.Count > 0 && PuidDs.Tables[0].Rows.Count > 0) { CustomerModel = DataConvert.DataRowToModel <MSCustomers>(PuidDs.Tables[0].Rows[0]); } } #endregion string text = System.IO.File.ReadAllText(Server.MapPath("../ShopPage/Product_detail.html")); JinianNet.JNTemplate.TemplateContext context = new JinianNet.JNTemplate.TemplateContext(); context.TempData["title"] = ptitle; if (shopModel != null) { context.TempData["shopdetail"] = shopModel; } context.TempData["productdetail"] = productModel; context.TempData["atlaslist"] = AtlasListModel; if (contactcount > 0) { context.TempData["contactdetail"] = contactModel; } else { context.TempData["contactdetail"] = CustomerModel; } context.TempData["customid"] = customid; //context.TempData["paramlist"] = paramlist; context.TempData["paracount"] = paracount; context.TempData["paramodel"] = ParaModel; context.TempData["paralist"] = paralistmodel; context.TempData["footer"] = "奥琦微商易"; context.TempData["errorscript"] = errorscript; JinianNet.JNTemplate.Template t = new JinianNet.JNTemplate.Template(context, text); t.Render(Response.Output); }