private void _InitSystemAtt(S_DOC_ListConfig listConfig) { var sort = 1; var lastSort = 10000; var tmpList = this.S_DOC_FileAttr.Where(a => a.AttrSort < 10000); if (tmpList.Count() > 0) { sort = tmpList.Max(a => a.AttrSort) + 1; } foreach (var item in S_DOC_Space.DefaultFileAttrArray) { var systemAttr = this.S_DOC_FileAttr.FirstOrDefault(a => a.FileAttrField == item.FileAttrField); if (systemAttr != null) { continue; } systemAttr = new S_DOC_FileAttr { ID = FormulaHelper.CreateGuid(), FileAttrField = item.FileAttrField, FileAttrName = item.FileAttrName, AttrType = item.AttrType, DataType = item.DataType, InputType = item.InputType, IsEnum = item.IsEnum, EnumKey = item.EnumKey, ValidateType = item.ValidateType, Required = item.Required, Disabled = item.Disabled, Visible = item.Visible, VType = item.VType, SpaceID = this.SpaceID, AttrSort = item.IsEdit ? sort : lastSort, SelectorKey = item.SelectorKey, ReturnParams = item.ReturnParams }; this.S_DOC_FileAttr.Add(systemAttr); if (item.FileAttrField == "Name") { var listDetail = listConfig.S_DOC_ListConfigDetail.FirstOrDefault(d => d.AttrField == item.FileAttrField); if (listDetail == null) { listDetail = new S_DOC_ListConfigDetail(); listDetail.AttrField = item.FileAttrField; listDetail.AttrName = item.FileAttrName; listDetail.Dispaly = TrueOrFalse.True.ToString(); listDetail.AllowSort = TrueOrFalse.True.ToString(); listDetail.Align = Algin.center.ToString(); listDetail.Width = 150; listDetail.DetailSort = listConfig.S_DOC_ListConfigDetail.Count + 1; listConfig.S_DOC_ListConfigDetail.Add(listDetail); } } sort++; lastSort += 100; } }
public S_DOC_ListConfig ListConfig() { if (_listConfig == null) { var context = this.GetDocConfigContext(); _listConfig = context.S_DOC_ListConfig.FirstOrDefault(d => d.RelationID == this.ID && d.SpaceID == this.SpaceID); } return(_listConfig); }
public void Add() { var listConfig = new S_DOC_ListConfig(); listConfig.ID = FormulaHelper.CreateGuid(); listConfig.RelationID = this.ID; listConfig.QueryKeyText = "请输入名称或编号"; listConfig.Type = ListConfigType.Node.ToString(); listConfig.SpaceID = this.SpaceID; this._InitSystemAtt(listConfig); var context = this.GetDocConfigContext(); context.S_DOC_ListConfig.Add(listConfig); }
public void Save() { var list = this.ListConfig(); if (list == null) { var context = this.GetDocConfigContext(); list = new S_DOC_ListConfig(); list.ID = FormulaHelper.CreateGuid(); list.RelationID = this.ID; list.QueryKeyText = "请输入名称或编号"; list.Type = ListConfigType.File.ToString(); list.SpaceID = this.SpaceID; context.S_DOC_ListConfig.Add(list); } _InitSystemAtt(list); }
private void _InitSystemAtt(S_DOC_ListConfig listConfig) { for (int i = 0; i < this.SystemAttrField.Length; i++) { var systemAttr = this.S_DOC_FileAttr.FirstOrDefault(d => d.FileAttrField == SystemAttrField[i]); if (systemAttr != null) { continue; } systemAttr = new S_DOC_FileAttr(); systemAttr.FileAttrField = SystemAttrField[i]; systemAttr.FileAttrName = SystemAttrName[i]; systemAttr.AttrType = AttrType.System.ToString(); systemAttr.DataType = AttrDataType.NVarchar200.ToString(); systemAttr.ID = FormulaHelper.CreateGuid(); //IdentityGenerator.CreateID(); systemAttr.InputType = ControlType.TextBox.ToString(); systemAttr.IsEnum = TrueOrFalse.False.ToString(); systemAttr.ValidateType = ValidateType.BortherUnique.ToString(); systemAttr.Required = TrueOrFalse.True.ToString(); systemAttr.Disabled = TrueOrFalse.False.ToString(); systemAttr.Visible = TrueOrFalse.True.ToString(); systemAttr.VType = "maxLength:500"; systemAttr.SpaceID = this.SpaceID; systemAttr.AttrSort = this.S_DOC_FileAttr.Count == 0 ? 1 : this.S_DOC_FileAttr.Max(d => d.AttrSort) + 1; this.S_DOC_FileAttr.Add(systemAttr); var listDetail = listConfig.S_DOC_ListConfigDetail.FirstOrDefault(d => d.AttrField == SystemAttrField[i]); if (listDetail == null) { listDetail = new S_DOC_ListConfigDetail(); listDetail.AttrField = SystemAttrField[i]; listDetail.AttrName = SystemAttrName[i]; listDetail.Dispaly = TrueOrFalse.True.ToString(); listDetail.AllowSort = TrueOrFalse.True.ToString(); listDetail.Align = Algin.center.ToString(); listDetail.Width = 150; listDetail.DetailSort = listConfig.S_DOC_ListConfigDetail.Count + 1; listConfig.S_DOC_ListConfigDetail.Add(listDetail); } } }