Exemple #1
0
        UISlider[] Sliders(Guid parentId, List <Design_Item> baners)
        {
            List <UISlider> list = new List <UISlider>();

            UMC.Data.WebResource webr = UMC.Data.WebResource.Instance();
            foreach (Design_Item b in baners)
            {
                UISlider slider = new UISlider();

                slider.Src = webr.ImageResolve(b.Id.Value, "1", 0) + "!slider?" + TimeSpan(b.ModifiedDate);

                if (_editer)
                {
                    slider.Click = (new UIClick(new UMC.Web.WebMeta().Put("Id", b.Id)).Send("Design", "Item"));
                }
                else
                {
                    if (String.IsNullOrEmpty(b.Click) == false)
                    {
                        slider.Click = UMC.Data.JSON.Deserialize <UIClick>(b.Click);
                    }
                }
                list.Add(slider);
            }
            if (list.Count == 0 && _editer)
            {
                list.Add(new UISlider()
                {
                    Click = new UIClick(parentId.ToString()).Send("Design", "Item")
                });
            }
            return(list.ToArray());
        }
        void Items(Design_Item parent, List <Design_Item> baners, UISection U)
        {
            Guid parentId = parent.Id.Value;
            //List<UIItem> list = new List<UIItem>();
            var item = new UIItems();

            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();
                item.Add(icon);
                icon.Put("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;
                }

                icon.Put("src", String.Format("{0}!{1}?{2}", webr.ImageResolve(b.Id.Value, "1", 0), t, TimeSpan(b.ModifiedDate)));
                //list.Add(slider);
            }
            if (item.Count > 0)
            {
                U.Add(item);
            }
            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 Icons(Guid parentId, List <Design_Item> baners, UISection U)
        {
            List <UIEventText> list = new List <UIEventText>();

            UMC.Data.WebResource webr = UMC.Data.WebResource.Instance();
            foreach (Design_Item b in baners)
            {
                UIEventText slider = new UIEventText(b.ItemName);
                if (String.IsNullOrEmpty(b.Data) == false)
                {
                    WebMeta s = UMC.Data.JSON.Deserialize <WebMeta>(b.Data);

                    slider.Icon(s.Get("icon"), s.Get("color"));
                }
                else
                {
                    slider.Src(webr.ImageResolve(b.Id.Value, "1", 4) + "?" + TimeSpan(b.ModifiedDate));
                }
                slider.Click(this.Click(b));

                list.Add(slider);
            }
            if (list.Count > 0)
            {
                var ic = new UMC.Web.UI.UIIcon();
                ic.Style.Name("icon", new UIStyle().Font("wdk").Size(24));

                ic.Add(list.ToArray());
                //U.AddIcon(new UIStyle().Name("icon", new UIStyle().Font("wdk").Size(24)), list.ToArray());
            }
            else if (_editer)
            {
                UIDesc desc = new UIDesc("\ue907");
                desc.Desc("{desc}\r\n配置图标栏");
                desc.Click(new UIClick(parentId.ToString())
                           .Send("Design", "Item"));

                desc.Style.AlignCenter().Name("desc", new UIStyle().Font("wdk").Size(38));
                U.Add(desc);
            }
        }
Exemple #4
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", "Picture", 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)));
        }
Exemple #5
0
        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", "Picture", 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 = new UIImageTitleDescBottom(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);
        }