void Sliders(Design_Item parent, List <Design_Item> baners, UISection U) { if (baners.Count > 0) { WebMeta config = UMC.Data.JSON.Deserialize <WebMeta>(parent.Data) ?? new UMC.Web.WebMeta(); UICell slider2 = UISlider.Create(Sliders(parent.Id.Value, baners)); int[] paddings = UIStyle.Padding(config); if (paddings.Length > 0) { slider2.Style.Padding(paddings); } U.Add(slider2); } else if (_editer) { UIDesc desc = new UIDesc("\ue907"); desc.Click(new UIClick(parent.Id.ToString()) .Send("Design", "Item")); desc.Desc("{desc}\r\n配置横幅栏"); desc.Style.AlignCenter().Name("desc", new UIStyle().Font("wdk").Size(38)); U.Add(desc); } }
void Caption(WebRequest request, WebResponse response, Guid sid, Guid forid) { String Name = this.AsyncDialog("Name", g => new UITextDialog() { Title = ("新建栏位") }); Design_Item item2 = new Design_Item() { Id = Guid.NewGuid(), design_id = sid, for_id = forid, ModifiedDate = DateTime.Now, Type = UIDesigner.StoreDesignTypeCaption, ItemName = Name }; var entity = Database.Instance().ObjectEntity <Design_Item>(); Design_Item max = entity .Where.And().Equal(new Design_Item() { design_id = (sid) }) .Entities.Max(new Design_Item() { Seq = 0 }); //.Seq+1; item2.Seq = (max.Seq ?? 0) + 1; entity.Insert(item2); }
public override void ProcessActivity(WebRequest webRequest, WebResponse webResponse) { String ssid = this.AsyncDialog("Id", "请输入ID"); var sId = UMC.Data.Utility.Guid(ssid, true); var entity = Database.Instance().ObjectEntity <Design_Item>(); entity.Where.And().Equal(new Design_Item() { Id = (sId) }); Design_Item baner = entity.Single(); UIClick c = UMC.Data.JSON.Deserialize <UIClick>(baner.Click) ?? new UIClick(); entity.Update(new Design_Item() { Click = UMC.Data.JSON.Serialize(this.Click(c)) }); this.Context.Send("Click", false); this.Prompt("关联成功"); }
void Design(WebRequest request, Guid itemId) { var entity = Database.Instance().ObjectEntity <Design_Item>(); entity.Where.And().Equal(new Design_Item { Id = itemId }); Design_Item item = entity.Single(); if (item == null) { Design_Item max = entity .Where.Reset().And().Equal(new Design_Item() { design_id = Guid.Empty, for_id = Guid.Empty }) //Design_id(Utility.uuidEmpty).For_id(Utility.uuidEmpty)) .Entities.Max(new Design_Item { Seq = 0 }); max.Seq = (max.Seq ?? 0) + 1; item = max; } Design_Item fitem = item; WebMeta meta = this.AsyncDialog(g => { UIFormDialog from = new UIFormDialog(); from.Title = ("页面分类项"); from.AddText("标题", "ItemName", fitem.ItemName); from.AddNumber("顺序", "Seq", fitem.Seq); from.Submit("确认", request, "Design"); return(from); }, "Setting"); Design_Item newItem = new Design_Item() { ItemName = meta.Get("ItemName"), ModifiedDate = DateTime.Now, Seq = Utility.Parse(meta.Get("Seq"), 0) }; entity.Where.Reset().And().Equal(new Design_Item() { Id = itemId }); entity.IFF(e => e.Update(newItem) == 0, e => { newItem.design_id = Guid.Empty; newItem.for_id = Guid.Empty; newItem.Id = Guid.NewGuid(); newItem.Type = UIDesigner.StoreDesignType; e.Insert(newItem); }); this.Context.Send("Design", true); }
public static UIClick Click(Design_Item item, bool editer) { if (editer) { return(new UIClick(item.Id.ToString()).Send("Design", "Item")); } else { return(JSON.Deserialize <UIClick>(item.Click)); } }
void Items(Design_Item parent, List <Design_Item> baners, UISection U) { Guid parentId = parent.Id.Value; List <UIItem> list = new List <UIItem>(); UMC.Data.WebResource webr = UMC.Data.WebResource.Instance(); for (int i = 0; i < baners.Count && i < 4; i++) { Design_Item b = baners[i]; WebMeta icon = UMC.Data.JSON.Deserialize <WebMeta>(b.Data) ?? new UMC.Web.WebMeta(); UIItem slider = UIItem.Create(icon); slider.Click(this.Click(b)); String t = "100"; switch (baners.Count) { case 1: t = "4-1"; break; case 2: t = "2-1"; break; case 3: if (i == 0) { t = "2-1"; } break; } slider.Src(String.Format("{0}!{1}?{2}", webr.ImageResolve(b.Id.Value, "1", 0), t, TimeSpan(b.ModifiedDate))); list.Add(slider); } if (list.Count > 0) { U.AddItems(list.ToArray());// (new UIItem[0])); } else if (_editer) { ; UIDesc desc = new UIDesc("\ue907"); desc.Desc("{desc}\r\n配置分块栏"); desc.Style.AlignCenter().Name("desc", new UIStyle().Font("wdk").Size(38).Click(new UIClick(parentId.ToString()) .Send("Design", "Item"))); U.Add(desc); } }
void Seq(WebRequest request, WebResponse response, Design_Item item) { var entity = Database.Instance().ObjectEntity <Design_Item>(); entity.Where.And().Equal(new Design_Item() { Id = (item.Id) }); WebMeta meta = this.AsyncDialog(g => { UIFormDialog from = new UIFormDialog(); from.Title = ("调整顺序"); from.AddNumber("展示顺序", "Seq", item.Seq); return(from); }, "Setting"); entity.Update(new Design_Item() { ModifiedDate = DateTime.Now, Seq = Utility.IntParse(meta.Get("Seq"), 0) }); }
void TitleDesc(WebRequest request, Guid itemId) { UMC.Data.WebResource webr = UMC.Data.WebResource.Instance(); var entity = Database.Instance().ObjectEntity <Design_Item>(); entity.Where.Reset().And().Equal(new Design_Item() { Id = itemId }); Design_Item item = entity.Single(); WebMeta meta = this.AsyncDialog(g => { WebMeta config = new UMC.Web.WebMeta(); switch (item.Type ?? 0) { case UIDesigner.StoreDesignTypeItem: Design_Item parent = entity.Where.Reset().And().Equal(new Design_Item() { Id = item.for_id }).Entities.Single(); config = UMC.Data.JSON.Deserialize <WebMeta>(parent.Data) ?? new UMC.Web.WebMeta(); break; case UIDesigner.StoreDesignTypeTitleDesc: config = UMC.Data.JSON.Deserialize <WebMeta>(item.Data) ?? new UMC.Web.WebMeta(); Design_Item item2 = new Design_Item() { Id = Guid.NewGuid(), design_id = item.design_id, for_id = item.Id, ModifiedDate = DateTime.Now, Type = UIDesigner.StoreDesignTypeItem }; Design_Item max = entity .Where.And().Equal(new Design_Item() { design_id = item.design_id, for_id = item.Id }) .Entities.Max(new Design_Item() { Seq = 0 }); //.Seq+1; item2.Seq = (max.Seq ?? 0) + 1; entity.Insert(item2); item = item2; request.Arguments.Put("Id", item.Id); break; default: this.Prompt("类型错误"); break; } //config = UMC.Data.JSON.Deserialize<WebMeta>(item.Data) ?? new UMC.Web.WebMeta(); WebMeta data = UMC.Data.JSON.Deserialize <WebMeta>(item.Data) ?? new UMC.Web.WebMeta(); ;// Utility.isNull(UMC.Data.JSON.deserialize(finalItem.Data, WebMeta.class), new UMC.Web.WebMeta()); UIFormDialog from = new UIFormDialog(); from.Title = ("图文项"); String total = data.Get("Total") ?? "1"; from.AddFile(String.Format("{0}比例图片", total == "1" ? "100:55" : "1:1"), "_Image", webr.ImageResolve(item.Id.Value, "1", 4)) .Command("Design", "Image", new UMC.Web.WebMeta().Put("id", item.Id).Put("seq", "1")); String hide = config.Get("Hide") ?? ""; if (hide.IndexOf("HideTitle") == -1) { from.AddText("图文标题", "title", item.ItemName); } if (hide.IndexOf("HideDesc") == -1) { from.AddText("图文描述", "desc", item.ItemDesc); } if (hide.IndexOf("HideLeft") == -1) { from.AddText("左角价格", "left", data.Get("left")); } if (hide.IndexOf("HideRight") == -1) { from.AddText("右角说明", "right", data.Get("right")); } from.AddNumber("顺序", "Seq", item.Seq); from.Submit("确认", request, "Design"); return(from); }, "Setting"); entity.Where.Reset().And().Equal(new Design_Item() { Id = item.Id }); entity.Update(new Design_Item() { ItemName = meta.Get("title"), ItemDesc = meta.Get("desc"), Data = UMC.Data.JSON.Serialize(meta), ModifiedDate = DateTime.Now, Seq = Utility.IntParse(meta.Get("Seq"), 0) }); //entity.Where.reset().And().Equal(new Design_Item().Id(item.Id)); //entity.update(new Design_Item().ItemName(meta.get("title")) // .ItemDesc(meta.get("desc")) // .Data(UMC.Data.JSON.serialize(meta)) // .ModifiedDate(new Date()).Seq(Utility.parse(meta.get("Seq"), 0))); }
public override void ProcessActivity(WebRequest request, WebResponse response) { _IsDesign = IsDesign(request); List <Guid> ids = new List <Guid>(); List <String> strIds = new List <string>(); String strs = this.AsyncDialog("Id", g => this.DialogValue("none"));//, true).Value; if (strs.IndexOf(',') > -1) { foreach (String s in strs.Split(',')) { if (String.IsNullOrEmpty(s) == false) { ids.Add(Utility.Guid(s, true).Value); strIds.Add(s); } } } else { ids.Add(Utility.Guid(strs, true).Value); } List <Guid> pids = new List <Guid>();;// new LinkedList<>(); List <Design_Item> items = new List <Design_Item>(); var itemsEntity = Database.Instance().ObjectEntity <Design_Item>(); if (ids.Count == 1) { itemsEntity.Where.And().Equal(new Design_Item() { design_id = ids[0] }); } else { itemsEntity.Where.And().In(new Design_Item() { design_id = ids[0] }, ids.ToArray()) .And().Equal(new Design_Item { Type = UIDesigner.StoreDesignTypeCustom }); } itemsEntity.Order.Asc(new Design_Item { Seq = 0 }).Entities.Query(dr => items.Add(dr)); List <WebMeta> lis = new List <WebMeta>(); var webr = UMC.Data.WebResource.Instance(); if (strIds.Count > 0) { String config = this.AsyncDialog("Config", g => this.DialogValue("none")); for (int i = 0; i < strIds.Count; i++)// var b in items) { Guid cid = ids[i]; Design_Item item = items.Find(k => k.Id == cid);// Utility.find(items, g->g.Id.compareTo(cid) == 0); if (item != null) { WebMeta pms = JSON.Deserialize <WebMeta>(item.Data); pms.Put("id", strIds[i]); if (_IsDesign) { pms.Put("design", true); if (config.Equals("UISEO")) { pms.Put("click", new UIClick(new UMC.Web.WebMeta().Put("Id", item.Id).Put("Config", config)) .Send("Design", "Custom")); } else { pms.Put("click", UIDesigner.Click(item, true)); } } else { pms.Put("click", UIDesigner.Click(item, false)); } pms.Put("src", webr.ImageResolve(item.Id.Value, "1", 0) + "?" + UIDesigner.TimeSpan(item.ModifiedDate)); lis.Add(pms); } else { if (_IsDesign) { lis.Add(new UMC.Web.WebMeta().Put("design", true).Put("id", strIds[i]).Put("click", new UIClick(new UMC.Web.WebMeta() .Put("Id", Utility.Guid(strIds[i], true).ToString(), "Config", config)) .Send("Design", "Custom"))); } } } } else { items.RemoveAll(g => { switch (g.Type) { case UIDesigner.StoreDesignTypeCustom: case UIDesigner.StoreDesignTypeItem: return(false); } return(true); }); foreach (Design_Item b in items) { WebMeta pms = JSON.Deserialize <WebMeta>(b.Data); pms.Put("id", b.Id); pms.Put("click", UIDesigner.Click(b, _IsDesign)); if (_IsDesign) { pms.Put("design", true); } pms.Put("src", webr.ImageResolve(b.Id.Value, "1", 0) + UIDesigner.TimeSpan(b.ModifiedDate)); lis.Add(pms); } if (items.Count == 0) { if (_IsDesign) { String config = this.AsyncDialog("Config", g => this.DialogValue(strs)); lis.Add(new UMC.Web.WebMeta().Put("design", true).Put("click", new UIClick(new UMC.Web.WebMeta().Put("Config", config)) .Send("Store", "DesignUIItem"))); } } } response.Redirect(lis); }
public override void ProcessActivity(WebRequest request, WebResponse response) { var user = UMC.Security.Identity.Current; var ids = new List <Guid>(); var itemId = Utility.Guid(this.AsyncDialog("Id", g => this.DialogValue(Guid.NewGuid().ToString())), true);//, true).Value; var config = this.AsyncDialog("Config", g => { return(this.DialogValue("none")); }); var pids = new List <Guid>(); var items = new List <Design_Item>(); var itemsEntity = Database.Instance().ObjectEntity <Design_Item>() .Where.And().Equal(new Design_Item { Id = itemId }); var size = this.AsyncDialog("Size", g => { return(this.DialogValue("none")); }); var webr = UMC.Data.WebResource.Instance(); var ts = this.AsyncDialog("Setting", g => { var fm = new UIFormDialog() { Title = "界面配置" }; var item = itemsEntity.Entities.Single(); WebMeta meta = new UMC.Web.WebMeta(); if (item != null) { meta = UMC.Data.JSON.Deserialize <WebMeta>(item.Data) ?? meta; if (String.Equals(config, "none")) { if (meta.ContainsKey("Config")) { config = meta["Config"]; } } } if (String.Equals(config, "none")) { this.Prompt("您配置错误"); } else if (config == "UISEO") { fm.Title = "SEO优化"; fm.AddTextarea("标题", "Title", meta["Title"]); fm.AddTextarea("关键词", "Keywords", meta["Keywords"]); fm.AddTextarea("描述", "Description", meta["Description"]); return(fm); } request.Arguments["Config"] = config; var keyIndex = config.IndexOf('.'); if (keyIndex > -1) { config = config.Substring(keyIndex + 1); } if (String.Equals(size, "none")) { size = "注意图片尺寸"; } else { size = String.Format("图片尺寸:{0}", size); } var pictureEntity = Database.Instance().ObjectEntity <Design_Config>(); pictureEntity.Order.Asc(new Design_Config { Sequence = 0 }); var pices = pictureEntity.Where.And().Equal(new Design_Config { GroupBy = config }).Entities.Query(); if (new List <Design_Config>(pices).Exists(dr => dr.Value == "Image" && dr.Name == "none") == false) { fm.AddFile(size, "_Image", webr.ResolveUrl(String.Format("{0}{1}/1/0.jpg!100", UMC.Data.WebResource.ImageResource, itemId))) //.Put("Model", "Settings").Put("Command", "Jpeg").Put("SendValue", new WebADNuke.Web.WebMeta().Put("Id", itemId)); .Command("Design", "Image", new UMC.Web.WebMeta().Put("id", itemId).Put("seq", "1", "type", "jpg")); } UMC.Data.Utility.Each(pices, dr => { if (dr.Value == "Image" && dr.Name == "none") { } else { fm.AddText(dr.Name, dr.Value, meta[dr.Value]); } }); if (item == null) { item = itemsEntity.Reset().And().Equal(new Design_Item { design_id = UMC.Data.Utility.Guid(config, true) }).Entities.Max(new Design_Item { Seq = 0 }); item.Seq = (item.Seq ?? 0) + 1; } fm.AddNumber("展示顺序", "Seq", item.Seq ?? 0); return(fm); }); var seq = UMC.Data.Utility.IntParse(ts["Seq"], 0); ts.Remove("Seq"); ts.Remove("Image"); ts["Config"] = config; var ite = new Design_Item { Type = UIDesigner.StoreDesignTypeCustom, ModifiedDate = DateTime.Now, Data = UMC.Data.JSON.Serialize(ts), Id = itemId, Seq = seq }; itemsEntity.Entities.IFF(e => e.Update(ite) == 0, e => { ite.design_id = UMC.Data.Utility.Guid(config, true); e.Insert(ite); }); this.Context.Send(new UMC.Web.WebMeta().Put("type", "Design"), true); }
void Icons(WebRequest request, Guid itemId) { var entity = Database.Instance().ObjectEntity <Design_Item>(); entity.Where.And().Equal(new Design_Item() { Id = itemId }); Design_Item item = entity.Single(); var webr = UMC.Data.WebResource.Instance(); WebMeta meta = this.AsyncDialog(g => { Design_Item finalItem = item; switch (item.Type ?? 0) { case UIDesigner.StoreDesignTypeItem: break; case UIDesigner.StoreDesignTypeIcons: Design_Item item2 = new Design_Item() { Id = Guid.NewGuid(), design_id = item.design_id, for_id = item.Id, ModifiedDate = DateTime.Now, Type = UIDesigner.StoreDesignTypeItem }; Design_Item max = entity .Where.And().Equal(new Design_Item() { design_id = item.design_id, for_id = item.Id }) .Entities.Max(new Design_Item() { Seq = 0 }); //.Seq+1; item2.Seq = (max.Seq ?? 0) + 1; entity.Insert(item2); finalItem = item2; request.Arguments.Put("Id", finalItem.Id); break; default: this.Prompt("类型错误"); break; } UIFormDialog from = new UIFormDialog(); from.Title = ("图标"); from.AddFile("图片", "_Image", webr.ImageResolve(finalItem.Id.Value, "1", 4)) .Command("Design", "Image", new UMC.Web.WebMeta().Put("id", finalItem.Id).Put("seq", "1")); from.AddText("标题", "ItemName", finalItem.ItemName); from.AddNumber("顺序", "Seq", finalItem.Seq); from.Submit("确认", request, "Design"); return(from); }, "Setting"); entity.Where.Reset().And().Equal(new Design_Item() { Id = item.Id }); entity.Update(new Design_Item() { ItemName = meta.Get("ItemName"), ModifiedDate = DateTime.Now, Seq = Utility.IntParse(meta.Get("Seq"), 0) }); }
public override void ProcessActivity(WebRequest request, WebResponse response) { var user = UMC.Security.Identity.Current; String ssid = this.AsyncDialog("Id", d => this.DialogValue(user.Id.ToString())); Guid? sId = UMC.Data.Utility.Guid(ssid); String size = this.AsyncDialog("Size", g => this.DialogValue("none")); UMC.Data.WebResource webr = UMC.Data.WebResource.Instance(); var entity = Database.Instance().ObjectEntity <Design_Item>(); //entity.Where.Reset().And().Equal(new Design_Item() { Id = itemId }); Design_Item item = null;//entity.single(); if (sId.HasValue) { entity.Where.Reset().And().Equal(new Design_Item() { Id = sId }); //entity.Where.And().Equal(new Design_Item().Id(sId)); item = entity.Single(); } if (item != null && item.Type != UIDesigner.StoreDesignType) { Design_Item finalItem = item; String type = this.AsyncDialog("Type", g => { UIRadioDialog di = new UIRadioDialog(); switch (finalItem.Type) { case UIDesigner.StoreDesignTypeCustom: break; case UIDesigner.StoreDesignType: di.Title = ("页面设计"); di.Options.Put("编辑此项", "Edit"); di.Options.Put("增加新项", "Append"); di.Options.Put("删除此项", "Delete"); break; case UIDesigner.StoreDesignTypeItem: di.Title = ("单项设计"); di.Options.Put("编辑此项", "Edit"); di.Options.Put("配置参数", "Config"); di.Options.Put("增加新项", "Append"); di.Options.Put("点击到...", "Union"); di.Options.Put("删除此项", "Delete"); break; case UIDesigner.StoreDesignTypeProduct: di.Title = ("商品栏位"); di.Options.Put("调整顺序", "Seq"); di.Options.Put("配置参数", "Config"); di.Options.Put("增加商品", "Append"); di.Options.Put("删除此项", "Delete"); break; case UIDesigner.StoreDesignTypeDiscount: di.Title = ("卡券栏位"); di.Options.Put("调整顺序", "Seq"); //di.options().put("配置参数", "Config"); di.Options.Put("增加卡券", "Append"); di.Options.Put("删除此项", "Delete"); break; case UIDesigner.StoreDesignTypeCaption: di.Title = ("栏目设计"); di.Options.Put("编辑栏目", "Config"); di.Options.Put("添加横幅区", "AddBanner"); di.Options.Put("添加图标区", "AddIcon"); di.Options.Put("添加分列区", "AddItem"); di.Options.Put("添加图文区", "AddTitleDesc"); di.Options.Put("删除栏目", "Delete"); return(di); case UIDesigner.StoreDesignTypeBanners: di.Title = ("横幅栏位"); di.Options.Put("添加横幅页", "Banners"); di.Options.Put("配置参数", "Config"); di.Options.Put("删除横幅栏", "Delete"); break; case UIDesigner.StoreDesignTypeProducts: di.Title = ("商品栏位"); di.Options.Put("添加商品", "Product"); di.Options.Put("配置参数", "Config"); di.Options.Put("删除商品栏", "Delete"); break; case UIDesigner.StoreDesignTypeDiscounts: di.Title = ("卡券栏位"); di.Options.Put("添加卡券", "Discount"); //di.options().put("配置参数", "Config"); di.Options.Put("删除卡券栏", "Delete"); break; case UIDesigner.StoreDesignTypeTitleDesc: di.Title = ("图文栏位"); di.Options.Put("添加子项", "TitleDesc"); di.Options.Put("配置图文", "Config"); di.Options.Put("删除图文栏", "Delete"); break; case UIDesigner.StoreDesignTypeItems: di.Title = ("分列栏位"); di.Options.Put("添加子列", "Items"); di.Options.Put("配置参数", "Config"); di.Options.Put("删除分列栏", "Delete"); break; case UIDesigner.StoreDesignTypeIcons: di.Title = ("图标栏位"); di.Options.Put("添加子项", "Icons"); di.Options.Put("配置参数", "Config"); di.Options.Put("删除图标位", "Delete"); break; default: break; } return(di); }); switch (type) { case "Seq": Seq(request, response, item); break; case "Delete": if (item.Type == UIDesigner.StoreDesignType) { entity.Where.Reset().And().Equal(new Design_Item() { design_id = item.Id }); if (entity.Count() > 0) { this.Prompt("请先删除子项"); } entity.Where.Reset().And().Equal(new Design_Item() { design_id = sId }); entity.Delete(); this.Context.Send("Design", true); } else { entity.Where.Reset().And().Equal(new Design_Item() { for_id = item.Id }); if (entity.Count() > 0) { this.Prompt("请先删除子项"); } entity.Where.Reset().And().Equal(new Design_Item() { design_id = sId }); entity.Delete(); this.Context.Send("Design", true); } break; case "TitleDesc": this.TitleDesc(request, sId.Value); break; case "Config": this.Config(request, sId.Value); break; case "Union": response.Redirect("Design", "Click", sId.ToString(), true); break; case "Icons": Icons(request, sId.Value); break; case "Banners": Banner(request, sId.Value); break; case "Items": Items(request, sId.Value); break; case "Edit": if (item.Type == UIDesigner.StoreDesignTypeCustom) { response.Redirect("Design", "Custom", new UMC.Web.WebMeta().Put("Id", item.Id.ToString(), "Size", size), true); } else { Design_Item eitem = entity.Where.Reset().And().Equal(new Design_Item() { Id = item.for_id }).Entities.Single(); switch (eitem.Type) { case UIDesigner.StoreDesignTypeTitleDesc: TitleDesc(request, sId.Value); break; case UIDesigner.StoreDesignTypeBanners: Banner(request, sId.Value); break; case UIDesigner.StoreDesignTypeIcons: Icons(request, sId.Value); break; case UIDesigner.StoreDesignTypeItems: Items(request, sId.Value); break; } } break; case "AddCaption": this.Caption(request, response, item.design_id.Value, item.Id.Value); break; case "AddTitleDesc": case "AddProduct": case "AddItem": case "AddIcon": case "AddBanner": Design_Item item3 = new Design_Item() { Id = Guid.NewGuid(), for_id = item.Id, design_id = item.design_id }; //Design_Item item3 = new Design_Item().Id(Guid.randomGuid()).Design_id(item.design_id) // .For_id(item.Id); switch (type) { case "AddProduct": item3.Type = UIDesigner.StoreDesignTypeProducts; break; case "AddIcon": item3.Type = UIDesigner.StoreDesignTypeIcons; break; case "AddTitleDesc": item3.Type = UIDesigner.StoreDesignTypeTitleDesc; break; case "AddBanner": item3.Type = UIDesigner.StoreDesignTypeBanners; break; case "AddItem": item3.Type = UIDesigner.StoreDesignTypeItems; break; case "AddDiscount": item3.Type = UIDesigner.StoreDesignTypeDiscounts; break; } if (item3.Type != null) { Design_Item max = entity .Where.Reset().And().Equal(new Design_Item() { for_id = item.Id }) .Entities.Max(new Design_Item() { Seq = 0 }); //.Seq+1; item3.Seq = (max.Seq ?? 0) + 1; entity.Insert(item3); } break; case "Append": if (item.Type == UIDesigner.StoreDesignTypeCustom) { WebMeta meta = UMC.Data.JSON.Deserialize <WebMeta>(item.Data); response.Redirect("Design", "Custom", new UMC.Web.WebMeta().Put("Config", meta.Get("Config")).Put("Size", size), true); } Design_Item aitem = entity.Where.Reset().And().Equal(new Design_Item() { Id = item.for_id }).Entities.Single(); switch (aitem.Type) { case UIDesigner.StoreDesignTypeTitleDesc: TitleDesc(request, aitem.Id.Value); break; case UIDesigner.StoreDesignTypeBanners: Banner(request, aitem.Id.Value); break; case UIDesigner.StoreDesignTypeIcons: Icons(request, aitem.Id.Value); break; case UIDesigner.StoreDesignTypeItems: Items(request, aitem.Id.Value); break; } break; } } else { String type = this.AsyncDialog("Type", g => { UIRadioDialog di = new UIRadioDialog(); di.Title = ("界面设计"); di.Options.Put("添加标题栏", "Caption"); di.Options.Put("添加广告栏", "Banner"); di.Options.Put("添加图标栏", "Icons"); di.Options.Put("添加分块栏", "Items"); return(di); }); Design_Item item2 = new Design_Item() { Id = Guid.NewGuid(), for_id = Guid.Empty, design_id = sId }; //Id=GU.nId(Guid.randomGuid()).Design_id(sId) //.For_id(Utility.uuidEmpty); switch (type) { case "Caption": Caption(request, response, sId.Value, Guid.Empty); break; case "TitleDesc": item2.Type = UIDesigner.StoreDesignTypeTitleDesc; break; case "Products": item2.Type = UIDesigner.StoreDesignTypeProducts; break; case "Icons": item2.Type = UIDesigner.StoreDesignTypeIcons; break; case "Banner": item2.Type = UIDesigner.StoreDesignTypeBanners; break; case "Items": item2.Type = UIDesigner.StoreDesignTypeItems; break; case "Discounts": item2.Type = UIDesigner.StoreDesignTypeDiscounts; break; } if (item2.Type != null) { Design_Item max = entity .Where.Reset().And().Equal(new Design_Item { design_id = sId, for_id = Guid.Empty }) .Entities.Max(new Design_Item { Seq = 0 }); //.Seq+1; item2.Seq = (max.Seq ?? 0) + 1; entity.Insert(item2); } } this.Context.Send("Design", true); }
void Banner(WebRequest request, Guid itemId) { UMC.Data.WebResource webr = UMC.Data.WebResource.Instance(); var entity = Database.Instance().ObjectEntity <Design_Item>(); entity.Where.Reset().And().Equal(new Design_Item() { Id = itemId }); Design_Item item = entity.Single(); WebMeta meta = this.AsyncDialog(g => { switch (item.Type ?? 0) { case UIDesigner.StoreDesignTypeItem: break; case UIDesigner.StoreDesignTypeBanners: Design_Item item2 = new Design_Item() { Id = Guid.NewGuid(), design_id = item.design_id, for_id = item.Id, ModifiedDate = DateTime.Now, Type = UIDesigner.StoreDesignTypeItem }; Design_Item max = entity .Where.And().Equal(new Design_Item() { design_id = item.design_id, for_id = item.Id }) .Entities.Max(new Design_Item() { Seq = 0 }); //.Seq+1; item2.Seq = (max.Seq ?? 0) + 1; entity.Insert(item2); item = item2; request.Arguments.Put("Id", item.Id); break; default: this.Prompt("类型错误"); break; } var from = new UIFormDialog() { Title = "展示图片" }; var size = request.Arguments["Size"]; if (size == "none") { size = "默认尺寸100:55"; } else { size = String.Format("参考尺寸:{0}", size); } from.AddFile(size, "_Image", webr.ResolveUrl(String.Format("{0}{1}/1/0.jpg!100", UMC.Data.WebResource.ImageResource, item.Id))) .Command("Design", "Image", new UMC.Web.WebMeta().Put("id", item.Id).Put("seq", "1")); from.AddNumber("展示顺序", "Seq", item.Seq); from.Submit("确认", request, "Design"); return(from); }, "Setting"); entity.Where.Reset().And().Equal(new Design_Item() { Id = item.Id }); entity.Update(new Design_Item { Data = UMC.Data.JSON.Serialize(meta), ModifiedDate = DateTime.Now }); }
void Config(WebRequest request, Guid itemId) { UMC.Data.WebResource webr = UMC.Data.WebResource.Instance(); var entity = Database.Instance().ObjectEntity <Design_Item>(); entity.Where.Reset().And().Equal(new Design_Item() { Id = itemId }); Design_Item item = entity.Single(); switch (item.Type ?? 0) { case UIDesigner.StoreDesignTypeItem: case UIDesigner.StoreDesignTypeProduct: item = entity.Where.Reset().And().Equal(new Design_Item() { Id = item.for_id }).Entities.Single(); break; } Design_Item finalItem = item; WebMeta meta = this.AsyncDialog(g => { WebMeta data = UMC.Data.JSON.Deserialize <WebMeta>(finalItem.Data) ?? new UMC.Web.WebMeta(); //WebMeta data = Utility.isNull(UMC.Data.JSON.deserialize(finalItem.Data, WebMeta.class), new UMC.Web.WebMeta()); UIFormDialog from = new UIFormDialog(); from.Title = ("配置"); from.AddText("缩进", "Padding", data.Get("Padding") ?? "0"); from.AddNumber("展示顺序", "Seq", finalItem.Seq); switch (finalItem.Type) { case UIDesigner.StoreDesignTypeBanners: from.Title = ("广告横幅"); break; case UIDesigner.StoreDesignTypeItems: from.Title = ("分块区配置"); from.AddRadio("风格", "Model").Put("展示标题", "Title", data.Get("Model").Equals("Title") || data.ContainsKey("Model") == false).Put("仅显示图片 ", "Image", data.Get("Model").Equals("Image")); break; case UIDesigner.StoreDesignTypeTitleDesc: from.Title = ("图文区配置"); String total = data.Get("Total") ?? "1"; // data["Total"] ??"1"; String model = data.Get("Hide") ?? ""; // data["Hide"] ??""; ; from.AddCheckBox("界面", "Hide", "T").Put("不显示标题", "HideTitle", model.IndexOf("HideTitle") > -1) .Put("不显描述 ", "HideDesc", model.IndexOf("HideDesc") > -1) .Put("不显左角价格 ", "HideLeft", model.IndexOf("HideLeft") > -1) .Put("不显右角说明 ", "HideRight", model.IndexOf("HideRight") > -1); from.AddNumber("图文数量", "Total", Utility.Parse(total, 0)); break; case UIDesigner.StoreDesignTypeCaption: from.Title = "标题配置"; from.AddText("标题", "ItemName", item.ItemName); from.AddCheckBox("标题隐藏", "Show", "Y").Put("隐藏", "Hide", data["Show"] == "Hide"); break; case UIDesigner.StoreDesignTypeProducts: from.Title = "商品展示配置"; from.AddText("标题", "ItemName", item.ItemName); from.AddRadio("展示风格", "Model").Put("分块展示", "Area", data["Model"] == "Area" || data.ContainsKey("Model") == false).Put("分行展示 ", "Rows", data["Model"] == "Rows"); from.AddNumber("单行商品数", "Total", data["Total"] ?? "2"); break; case UIDesigner.StoreDesignTypeCustom: String config = data.Get("Config"); if (String.IsNullOrEmpty(config) == false && config.StartsWith("UI")) { this.Context.Response.Redirect("Design", config); } else { this.Prompt("参数错误"); } break; default: this.Prompt("参数错误"); break; } from.Submit("确认", request, "Design"); return(from); }, "Setting"); String show = meta.Get("Show"); if (String.IsNullOrEmpty(show) == false) { meta.Put("Show", show.Contains("Hide") ? "Hide" : "Show"); } entity.Where.Reset().And().Equal(new Design_Item() { Id = item.Id }); entity.Update(new Design_Item { ItemName = meta["ItemName"], ModifiedDate = DateTime.Now, Seq = UMC.Data.Utility.IntParse(meta["Seq"], 0), Data = UMC.Data.JSON.Serialize(meta) }); }
void TitleDesc(Design_Item parent, List <Design_Item> items, UISection U) { UMC.Data.WebResource webr = UMC.Data.WebResource.Instance(); //WebMeta config = Utility.isNull(UMC.Data.JSON.deserialize(parent.Data, WebMeta.class), new UMC.Web.WebMeta()); WebMeta config = UMC.Data.JSON.Deserialize <WebMeta>(parent.Data) ?? new UMC.Web.WebMeta(); int rows = UMC.Data.Utility.IntParse(config.Get("Total"), 1); if (rows <= 1) { int[] padding = UIStyle.Padding(config); foreach (Design_Item i in items) { UICell tdesc = this.TitleDesc(config, i, "cms1", webr); if (padding.Length > 0) { tdesc.Style.Padding(padding); } U.Add(tdesc); } } else { int m = 0; String hide = config.Get("Hide") ?? ""; if (hide.Contains("HideTitle")) { m |= 1; } if (hide.Contains("HideDesc")) { m |= 2; } if (hide.Contains("HideLeft")) { m |= 4; } if (hide.Contains("HideRight")) { m |= 8; } int len = items.Count; for (int i = 0; (i + rows - 1) < len; i = i + rows) { List <WebMeta> ls = new List <WebMeta>();//<>(); for (int c = 0; c < rows; c++) { UICell p = TitleDesc(config, items[i + c], "350", webr); ls.Add(new UMC.Web.WebMeta().Put("value", p.Data).Put("format", p.Format).Put("style", p.Style)); } UICell desc = UICell.Create("ItemsTitleDesc", new UMC.Web.WebMeta().Put("items", ls.ToArray()).Put("total", rows).Put("show", m)); int[] paddings = UIStyle.Padding(config); if (paddings.Length > 0) { desc.Style.Padding(paddings); } U.Add(desc); } int total = len % rows; if (total > 0) { List <WebMeta> ls = new List <WebMeta>(); for (int c = total; c > 0; c--) { UICell p = TitleDesc(config, items[len - c], "350", webr); ls.Add(new UMC.Web.WebMeta().Put("value", p.Data).Put("format", p.Format).Put("style", p.Style)); } UICell desc = UICell.Create("ItemsTitleDesc", new UMC.Web.WebMeta().Put("items", ls.ToArray()).Put("total", rows).Put("show", m)); int[] paddings = UIStyle.Padding(config); if (paddings.Length > 0) { desc.Style.Padding(paddings); } U.Add(desc); } } if (items.Count == 0 && _editer) { UIDesc desc = new UIDesc("\ue907"); desc.Desc("{desc}\r\n配置图文栏"); desc.Style.AlignCenter().Name("desc", new UIStyle().Font("wdk").Size(38).Click(new UIClick(parent.Id.ToString()) .Send("Design", "Item"))); U.Add(desc); } }
void Items(WebRequest request, Guid itemId) { UMC.Data.WebResource webr = UMC.Data.WebResource.Instance(); var entity = Database.Instance().ObjectEntity <Design_Item>(); entity.Where.Reset().And().Equal(new Design_Item() { Id = itemId }); Design_Item item = entity.Single(); WebMeta meta = this.AsyncDialog(g => { Design_Item finalItem = item; switch (item.Type) { case UIDesigner.StoreDesignTypeItem: break; case UIDesigner.StoreDesignTypeItems: int count = entity.Where.Reset() .And().Equal(new Design_Item() { for_id = itemId }) .Entities.Count(); if (count > 3) { this.Prompt("分列栏,只能添加4列"); } Design_Item item2 = new Design_Item() { Id = Guid.NewGuid(), design_id = item.design_id, for_id = item.Id, ModifiedDate = DateTime.Now, Type = UIDesigner.StoreDesignTypeItem }; Design_Item max = entity .Where.And().Equal(new Design_Item() { design_id = item.design_id, for_id = item.Id }) .Entities.Max(new Design_Item() { Seq = 0 }); //.Seq+1; item2.Seq = (max.Seq ?? 0) + 1; entity.Insert(item2); finalItem = item2; request.Arguments.Put("Id", finalItem.Id); break; default: this.Prompt("类型错误"); break; } WebMeta data = UMC.Data.JSON.Deserialize <WebMeta>(finalItem.Data) ?? new UMC.Web.WebMeta(); UIFormDialog from = new UIFormDialog(); from.Title = ("图标"); from.AddFile("图片", "_Image", webr.ImageResolve(finalItem.Id.Value, "1", 4)) .Command("Design", "Image", new UMC.Web.WebMeta().Put("id", finalItem.Id).Put("seq", "1")); from.AddText("标题", "title", finalItem.ItemName); from.AddText("描述", "desc", finalItem.ItemDesc); from.Add("Color", "startColor", "标题开始色", data.Get("startColor")); from.Add("Color", "endColor", "标题结束色", data.Get("endColor")); from.AddNumber("顺序", "Seq", finalItem.Seq); // from.submit("确认", request.model(), request.cmd(), new UMC.Web.WebMeta().put("Id", finalItem.Id).put("Type", "Edit")); from.Submit("确认", request, "Design"); return(from); }, "Setting"); entity.Where.Reset().And().Equal(new Design_Item() { Id = item.Id }); entity.Update(new Design_Item() { ItemName = meta.Get("title"), ItemDesc = meta.Get("desc"), Data = UMC.Data.JSON.Serialize(meta), ModifiedDate = DateTime.Now, Seq = Utility.IntParse(meta.Get("Seq"), 0) }); //entity.Where.reset().And().Equal(new Design_Item().Id(item.Id)); //entity.update(new Design_Item().ItemName(meta.get("title")) // .ItemDesc(meta.get("desc")) // .Data(UMC.Data.JSON.serialize(meta)) // .ModifiedDate(new Date()).Seq(Utility.parse(meta.get("Seq"), 0))); }
UIImageTitleDescBottom TitleDesc(WebMeta config, Design_Item item, String img, UMC.Data.WebResource webr) { //WebMeta data = Utility.isNull(UMC.Data.JSON.deserialize(item.Data, WebMeta.class), new UMC.Web.WebMeta()); WebMeta data = UMC.Data.JSON.Deserialize <WebMeta>(item.Data) ?? new UMC.Web.WebMeta(); int m = 0; String hide = config.Get("Hide") ?? ""; if (hide.Contains("HideTitle")) { m |= 1; data.Remove("title"); } if (hide.Contains("HideDesc")) { m |= 2; data.Remove("desc"); } if (hide.Contains("HideLeft")) { m |= 4; data.Remove("left"); } if (hide.Contains("HideRight")) { m |= 8; data.Remove("right"); } data.Put("show", m); String src = (String.Format("{0}!{1}?{2}", webr.ImageResolve(item.Id.Value, "1", 0), img, TimeSpan(item.ModifiedDate))); // list.add(slider); // UIImageTitleDescBottom btm = UIImageTitleDescBottom.Create(data, src); btm.Click(this.Click(item)); var left = data["left"]; if (String.IsNullOrEmpty(left) == false) { var p = @"\d+\.?\d{0,2}"; int i = -1; var t = System.Text.RegularExpressions.Regex.Replace(left, p, dr => { i++; switch (i) { case 0: data.Put("price", dr.Value); return("¥{1:price} "); case 1: data.Put("orgin", dr.Value); return(" {orgin}"); } return(dr.Value); }, System.Text.RegularExpressions.RegexOptions.Multiline); btm.Left(t); btm.Style.Name("price", new UIStyle().Size(16).Color(0xdb3652)).Name("unit", new UIStyle().Size(12).Color(0x999)).Name("orgin", new UIStyle().Color(0x999).Size(12).DelLine()); } ; return(btm); }
private UISection Section(UISection Us, List <Design_Item> items) { List <Design_Item> groups = items.FindAll(g => g.for_id == Guid.Empty); Design_Item b = groups.Find(g => g.Type == StoreDesignTypeBanners); if (b != null) { Sliders(b, groups.FindAll(it => it.for_id == b.Id), Us); } if (b != null) { groups.Remove(b); } foreach (Design_Item bp in groups) { UISection use = Us; if (Us.Length > 0) { use = Us.NewSection(); } switch (bp.Type ?? 0) { case StoreDesignTypeBanners: Sliders(bp, items.FindAll(it => it.for_id == bp.Id), use); break; case StoreDesignTypeIcons: //Icons(bp.Id, Utility.findAll(items, it->it.for_id.compareTo(bp.Id) == 0), use); Icons(bp.Id.Value, items.FindAll(it => it.for_id == bp.Id), use); break; case StoreDesignTypeItems: //Items(bp, Utility.findAll(items, it->it.for_id.compareTo(bp.Id) == 0), use); Items(bp, items.FindAll(it => it.for_id == bp.Id), use); break; case StoreDesignTypeTitleDesc: //TitleDesc(bp, Utility.findAll(items, it->it.for_id.compareTo(bp.Id) == 0), use); TitleDesc(bp, items.FindAll(it => it.for_id == bp.Id), use); break; case StoreDesignTypeProducts: case StoreDesignTypeDiscounts: break; case StoreDesignTypeCaption: //WebMeta config = Utility.isNull(UMC.Data.JSON.deserialize(bp.Data, WebMeta), new UMC.Web.WebMeta()); WebMeta config = UMC.Data.JSON.Deserialize <WebMeta>(bp.Data) ?? new UMC.Web.WebMeta(); if ("Hide".Equals(config.Get("Show"))) { if (_editer) { UITitleMore more = UITitleMore.Create(bp.ItemName).More("已隐藏{3:more}"); more.Style.Name("more", new UIStyle().Color(0xc00)); use.Add(more.Click(this.Click(bp))); } } else { UITitleMore more = UITitleMore.Create(bp.ItemName).Click(this.Click(bp)); more.Style.Padding(UIStyle.Padding(config)); use.Add(more); } List <Design_Item> groups2 = items.FindAll(it => it.for_id == (bp.Id)); // items.FindAll(it = > it.for_id == bp.Id); foreach (Design_Item bp2 in groups2) { switch (bp2.Type) { case StoreDesignTypeBanners: Sliders(bp2, items.FindAll(it => it.for_id == (bp2.Id)), use); break; case StoreDesignTypeIcons: //Icons(bp2.Id, Utility.findAll(items, it->it.for_id.compareTo(bp2.Id) == 0), use); Icons(bp2.Id.Value, items.FindAll(it => it.for_id == (bp2.Id)), use); break; case StoreDesignTypeItems: //Items(bp2, Utility.findAll(items, it->it.for_id.compareTo(bp2.Id) == 0), use); Items(bp2, items.FindAll(it => it.for_id == (bp2.Id)), use); break; case StoreDesignTypeTitleDesc: //TitleDesc(bp2, Utility.findAll(items, it->it.for_id.compareTo(bp2.Id) == 0), use); TitleDesc(bp2, items.FindAll(it => it.for_id == (bp2.Id)), use); break; } } break; } } return(Us); }
UIClick Click(Design_Item item) { return(Click(item, _editer)); }