public TView PrepareView(int itemTypeId, EntityLayoutType layoutType) { string layoutJson = ""; if (itemTypeId != 0) { var layout = LayoutDbService.GetItemTypeLayout(_AppContext.MasterId, _EntityId.Code, itemTypeId, (int)layoutType); if (layout == null) { throw new EntityException("ItemType is not defined."); } //layoutXml = layout.Get("layoutxml", string.Empty); layoutJson = layout.Get("layoutjson", string.Empty); } if (string.IsNullOrWhiteSpace(layoutJson)) { var _Entity = Core.EntityMetaData.Get(_EntityId); var lview = _Entity.GetDefaultLayoutView(layoutType); return(lview); } return(TView.ParseFromJSON(layoutJson)); }
public override Model.Layout.TView GetDefaultLayoutView(EntityLayoutType layoutType) { var view = base.GetDefaultLayoutView(layoutType); view.Commands = new List <Model.Layout.TCommand>(); view.Commands.Add(new Model.Layout.TCommand() { Id = 12, Text = "Designer" }); return(view); }
public List <BaseField> GetLayoutFields(EntityLayoutType type) { var fs = new List <BaseField>(); foreach (var f in this.Fields) { if (f.Value.ViewId == 0 || f.Value.ViewId == Convert.ToInt16(type)) { fs.Add(f.Value); } } return(fs); }
public static TView CreateDefault(IDBEntity Entity, EntityLayoutType layoutType) { var view = new TView(); view.Fields = new List <TField>(); var page = new TPage(); view.Pages.Add(page); var group = new TGroup(); page.Groups.Add(group); var start_new_r = true; List <TCol> col_r = new List <TCol>(); var layoutF = Entity.GetLayoutFields(EntityLayoutType.Edit); int idx = 0; foreach (var f in layoutF) { var col = new TCol(f.Name); view.Fields.Add(new TField() { FieldId = f.Name, Text = f.Text }); if (col_r.Count == 1) { start_new_r = true; } else { start_new_r = false; } if (IsWidgetOnFullRow(f.ControlType)) { start_new_r = true; var row = new TRow(); col.Span = 24; row.Cols = new List <TCol>() { col }; group.Rows.Add(row); } else { col_r.Add(col); } if (start_new_r) { var row = new TRow(); row.Cols = col_r; group.Rows.Add(row); col_r = new List <TCol>(); } else if (layoutF.Count - 1 == idx) { var row = new TRow(); row.Cols = col_r; group.Rows.Add(row); } idx++; } return(view); }
public override Model.Layout.TView GetDefaultLayoutView(EntityLayoutType layoutType) { //var view = TView.ParseFromXml(_LayoutXml); //var fields = view.GetAllFields(); var view1 = new TView() { Header = new TPage(), Fields = new List <TField>() }; view1.Fields = new List <TField>() { new TField() { FieldId = "entityid", ReadOnly = "1" }, new TField() { FieldId = "fieldname", ReadOnly = "2" }, new TField() { FieldId = "fieldtype", ReadOnly = "2" }, new TField() { FieldId = "label" }, new TField() { FieldId = "isrequired" }, new TField() { FieldId = "defaultvalue" }, new TField() { FieldId = "ismultiselect", ReadOnly = "2" }, new TField() { FieldId = "computeexpression" }, new TField() { FieldId = "uisetting" }, new TField() { FieldId = "linkentity", ReadOnly = "2", Invisible = @"[{""fieldtype"":[8, ""10,11,20,21""]}]" }, new TField() { FieldId = "linkentity_domain", Invisible = @"[{""fieldtype"":[8, ""10,11,20,21""]}]" }, new TField() { FieldId = "linkentity_field", ReadOnly = "2", Invisible = @"[{""fieldtype"":[8, ""10,11,20,21""]}]" }, new TField() { FieldId = "relatedexp", ReadOnly = "2" }, new TField() { FieldId = "collectionid", ReadOnly = "2", Invisible = @"[{""fieldtype"":[8, ""9,30""]}]" } }; view1.Header.Groups.Add(new TGroup() { Rows = new List <TRow>() { new TRow() { Cols = new List <TCol>() { new TCol("entityid") } }, new TRow() { Cols = new List <TCol>() { new TCol("fieldname"), new TCol("fieldtype") } } } }); view1.Pages.Add(new TPage() { Id = "page_1", Text = "General", Groups = new List <TGroup>() { new TGroup() { Rows = new List <TRow>() { new TRow() { Cols = new List <TCol>() { new TCol("label"), new TCol("isrequired") } }, new TRow() { Cols = new List <TCol>() { new TCol("defaultvalue"), new TCol("ismultiselect") } }, new TRow() { Cols = new List <TCol>() { new TCol("computeexpression") } } } }, new TGroup() { Text = "Relation", Rows = new List <TRow>() { new TRow() { Cols = new List <TCol>() { new TCol("linkentity"), new TCol("linkentity_domain") } }, new TRow() { Cols = new List <TCol>() { new TCol("linkentity_field"), new TCol("relatedexp") } }, new TRow() { Cols = new List <TCol>() { new TCol("collectionid") } } } } } }); view1.Pages.Add(new TPage() { Id = "page_2", Text = "UI Setting", Groups = new List <TGroup>() { new TGroup() { Rows = new List <TRow>() { new TRow() { Cols = new List <TCol>() { new TCol("uisetting") { Span = 2 } } }, } } } }); return(view1); }
public static List <ActionLinkDefinition> GetActions(StackAppContext appContext, EntityCode entity, EntityLayoutType layoutType) { return(_Links.Where(x => (x.EntityId.Code == 0 || x.EntityId.Equals(entity)) && x.Viewtype == layoutType).ToList()); }
public static ActionLinkDefinition GetViewAction(StackAppContext appContext, EntityCode entity, EntityLayoutType layoutType, int actionId) { return(_Links.Find(x => x.Id == actionId && x.Viewtype == layoutType)); }
public virtual Model.Layout.TView GetDefaultLayoutView(EntityLayoutType layoutType) { return(EntityLayoutService.CreateDefault(this, layoutType)); }