protected override void OnPreLoad(EventArgs e) { var vmbbl = new View_Members_Br(); _vMember = vmbbl.GetSingle(Request.Url); if (_vMember == null) { Response.Write("<br> 该商铺不存在或已被删除。"); Response.End(); } //装修数据 _ShopConfig = DS_ShopConfig_Br.GetSingle(_vMember.ID, true); //if (!object.Equals(_ShopConfig,null)&&!object.Equals(this.Page.Header, null)) //{ // var lctr = new LiteralControl(); // lctr.Text = "<style type=\"text/css\">"; // if (!string.IsNullOrEmpty(_ShopConfig.SignImg)) // lctr.Text += ".Head{background-image:url(" + _ShopConfig.SignImg + ");}\n"; // if (!string.IsNullOrEmpty(_ShopConfig.MenuBg)) // lctr.Text += ".HeaderMenuBar{background-image:url(" + _ShopConfig.MenuBg + ");}\n"; // if (!string.IsNullOrEmpty(_ShopConfig.NormalMenu)) // lctr.Text += ".HeaderMenuBar ul li{background-image:url(" + _ShopConfig.NormalMenu + ");}\n"; // if (!string.IsNullOrEmpty(_ShopConfig.SelectedMenu)) // lctr.Text += ".HeaderMenuBar ul li:hover{background-image:url(" + _ShopConfig.SelectedMenu + ");}\n"; // if (!string.IsNullOrEmpty(_ShopConfig.SelectedMenu)) // lctr.Text += ".HeaderMenuBar ul li.Check{background-image:url(" + _ShopConfig.SelectedMenu + ");}\n"; // if (!string.IsNullOrEmpty(_ShopConfig.NmColor)) // lctr.Text += ".HeaderMenuBar ul li a:link,.HeaderMenuBar ul li a:visited{color:" + _ShopConfig.NmColor + ";}\n"; // if (!string.IsNullOrEmpty(_ShopConfig.SelmColor)) // lctr.Text += ".HeaderMenuBar ul li:hover a,.HeaderMenuBar ul li a:hover,.HeaderMenuBar ul li.Check a:link,.HeaderMenuBar ul li.Check a:visited{color:" + _ShopConfig.SelmColor + ";}\n"; // if (!string.IsNullOrEmpty(_ShopConfig.ComNameCss)) // lctr.Text += ".Head h1{" + _ShopConfig.ComNameCss + "}\n"; // lctr.Text += "</style>"; // this.Page.Header.Controls.Add(lctr); //} }
protected void Page_Load(object sender, EventArgs e) { string act = Request["action"]; if (!string.IsNullOrEmpty(act)) { var thebl = new DS_ShopTheme_Br(); var wcfbl = new DS_ShopConfig_Br();; switch (act) { case "viewThe": var the = thebl.GetSingle(int.Parse(Request["id"])); the.SignImg = DS_ShopTheme_Br.ThemePath(the.ID) + the.SignImg; Response.Write(Common.JSONHelper.ObjectToJSON(the)); break; case "theSave": the = thebl.GetSingle(int.Parse(Request["theid"])); var shopcf = DS_ShopConfig_Br.GetSingle(_userData.Member.ID, false); if (shopcf == null) { shopcf = wcfbl.CreateModel(); } string thepath = DS_ShopTheme_Br.ThemePath(the.ID); var ty = shopcf.GetType(); var prts = the.GetType().GetProperties(); foreach (var prt in prts) { if (prt.Name == "ID") { continue; } var theitem = prt.GetValue(the, null); if (theitem != null) { var spprt = ty.GetProperty(prt.Name); if (spprt != null) { if (theitem.GetType() == typeof(string)) { string img = (theitem as string).ToLower(); if (img.EndsWith(".jpg") || img.EndsWith(".png") || img.EndsWith(".gif")) { spprt.SetValue(shopcf, thepath + theitem, null); continue; } } spprt.SetValue(shopcf, theitem, null); } } } //shopcf.SignImg =DS_ShopTheme_Br.ThemePath(the.ID)+ the.SignImg; //shopcf.SignBgColor = the.SignBgColor; //shopcf.ComNameCss = the.ComNameCss; //shopcf.ComNameShow = the.ComNameShow; //shopcf.SignType = the.SignType; if (shopcf.ID == 0) { shopcf.MemberID = _userData.Member.ID; wcfbl.Add(shopcf); } else { wcfbl.Update(shopcf); } Response.Write(Common.JSONHelper.ObjectToJSON(new { succ = true })); break; } } }