예제 #1
0
        public UISection AddImageTextValue(string src, string text, String value, Web.UIClick click)
        {
            var cell = UICell.Create("ImageTextValue", new UMC.Web.WebMeta().Put("src", src, "value", value, "text", text).Put("click", click));

            this.Add(cell);
            return(this);
        }
예제 #2
0
        public UISection AddNumberCell(string text, String value, string title, Web.UIClick submit)
        {
            var cell = UICell.Create("NumberCell", new UMC.Web.WebMeta().Put("text", text, "value", value, "title", title).Put("submit", submit));

            this.Add(cell);
            return(this);
        }
예제 #3
0
        public UISection AddImageTextValue(string src, String value, int imageWidth, Web.UIClick click)
        {
            var cell = UICell.Create("ImageTextValue", new UMC.Web.WebMeta().Put("src", src, "value", value).Put("click", click));

            cell.Style.Name("image-width", imageWidth);
            this.Add(cell);
            return(this);
        }
예제 #4
0
        public static void Search(UISection ui, Data.Sql.IObjectEntity <Subject> subEntity, String model, String cmd, int start, int limit, bool isblock)
        {
            var subs    = new List <Subject>();
            var cateids = new List <Guid>();
            var ids     = new List <Guid>();
            var itemIds = new List <Guid>();

            var search = UMC.Data.Reflection.CreateInstance <Subject>();

            search.DataJSON  = null;
            search.Content   = null;
            search.ConfigXml = null;
            subEntity.Query(search, start, limit, dr =>
            {
                subs.Add(dr);
                if (dr.project_id.HasValue)
                {
                    cateids.Add(dr.project_id ?? Guid.Empty);
                }
                ids.Add(dr.Id.Value);
                if (dr.project_item_id.HasValue)
                {
                    itemIds.Add(dr.project_item_id.Value);
                }
            });
            var cates  = new List <Project>();
            var pitems = new List <Data.Entities.ProjectItem>();


            if (itemIds.Count > 0)
            {
                Utility.CMS.ObjectEntity <ProjectItem>().Where.And().In(new ProjectItem
                {
                    Id = itemIds[0]
                }, itemIds.ToArray())
                .Entities.Query(dr => pitems.Add(dr));
            }
            if (cateids.Count > 0)
            {
                Utility.CMS.ObjectEntity <Project>().Where.And().In(new Project {
                    Id = cateids[0]
                }, cateids.ToArray())
                .Entities.Query(dr => cates.Add(dr));
            }
            var pics = new List <UMC.Data.Entities.Picture>();

            if (ids.Count > 0)
            {
                Utility.CMS.ObjectEntity <Data.Entities.Picture>().Where.And().In(new Data.Entities.Picture
                {
                    group_id = ids[0]
                }, ids.ToArray()).Entities.Order.Asc(new Data.Entities.Picture {
                    Seq = 0
                }).Entities.Query(g => pics.Add(g));
            }
            ;
            var items = ui;
            var webr  = UMC.Data.WebResource.Instance();


            foreach (var sub in subs)
            {
                if (sub.Visible == 0)
                {
                    continue;
                }
                var ims = new List <UMC.Data.Entities.Picture>();
                pics.RemoveAll(g =>
                {
                    if (g.group_id == sub.Id)
                    {
                        ims.Add(g);
                        return(true);
                    }
                    return(false);
                });
                var imgs = new List <String>();

                if (ims.Count > 0)
                {
                    switch (ims.Count)
                    {
                    case 2:
                    case 1:

                        imgs.Add(webr.ResolveUrl(sub.Id.Value, 1, "0") + "!cms" + ((sub.IsPicture ?? false) ? "1" : "3") + "?_ts=" + UMC.Data.Utility.TimeSpan(ims[0].UploadDate.Value));

                        break;

                    default:
                        for (var i = 0; i < 3; i++)
                        {
                            imgs.Add(webr.ResolveUrl(sub.Id.Value, ims[i].Seq ?? 0, "0") + "!cms3?_ts=" + UMC.Data.Utility.TimeSpan(ims[i].UploadDate.Value));
                        }
                        break;
                    }
                }
                var click = new Web.UIClick(sub.Id.ToString()).Send(model, cmd);
                var data  = new UMC.Web.WebMeta().Put("title", sub.Title).Put("reply", (sub.Reply ?? 0).ToString()).Put("look", (sub.Look ?? 0).ToString());


                var cate  = cates.Find(g => g.Id == sub.project_id);
                var pitem = pitems.Find(g => g.Id == sub.project_item_id);
                data.Put("pname", cate == null ? "草稿" : cate.Caption);
                if (sub.project_id == sub.user_id)
                {
                    data.Put("iname", "");
                }
                else
                {
                    data.Put("iname", pitem == null ? "" : pitem.Caption);
                }
                data.Put("time", Utility.GetDate(sub.ReleaseDate));
                if (cate != null && pitem != null)
                {
                    data.Put("spa", new WebMeta().Put("id", sub.Id).Put("path", String.Format("{0}/{1}/{2}", cate.Code, pitem.Code, sub.Code)));
                }
                else
                {
                    data.Put("sub-id", Utility.Guid(sub.Id.Value));//.Put("path", String.Format("{0}/{1}/{2}", cate.Code, pitem.Code, sub.Code)));
                }
                data.Put("desc", sub.Description);
                UICell cell;
                switch (imgs.Count)
                {
                case 0:
                    cell = new UICMS(click, data);
                    break;

                default:
                    cell = (sub.IsPicture ?? false) ? new UICMS(click, data, imgs[0], true) : (ims.Count > 2 ? new UICMS(click, data, imgs[0], imgs[1], imgs[2]) : new UICMS(click, data, imgs[0]));


                    break;
                }
                cell.Format.Put("left", "{pname} {iname} {time}");
                cell.Style.Name("licon", new UIStyle().Size(12).Font("wdk")).Name("ricon", new UIStyle().Size(12).Font("wdk"));
                cell.Style.Name("pname").Color(0x777);
                cell.Style.Name("iname").Color(0x777);
                if (isblock)
                {
                    cell.Style.Name("block").Size(12).Color(0xaaa).Font("wdk").Click(UIClick.Click(new UIClick("Id", sub.Id.ToString(), "Type", "Block").Send(model, "TipOff")));
                    data.Put("block", "\uea0d");

                    cell.Format.Put("right", "\uF06E{1:licon} {look}   \uF0E6{1:ricon} {reply}  {2:block}");
                }
                else
                {
                    cell.Format.Put("right", "\uF06E{1:licon} {look}   \uF0E6{1:ricon} {reply}");
                }
                items.Add(cell);
            }
            ui.Total = subEntity.Count();;
        }
예제 #5
0
 public UISectionBuilder Scanning(Web.UIClick click)
 {
     _data.Put("Scanning", click);
     return(this);
 }