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 void SaveListConfigDetail(List <Dictionary <string, object> > detailList) { var context = this.GetDocConfigContext(); if (this.ListConfig() == null) { throw new Formula.Exceptions.BusinessException("指定的节点【" + this.ID + "】未能找到"); } foreach (var item in detailList) { if (!item.ContainsKey("AttrField") || Tool.IsNullOrEmpty(item["AttrField"])) { continue; } //if (!String.IsNullOrEmpty(item.GetValue("AttrField"))) continue; string fileName = item.GetValue("AttrField"); S_DOC_ListConfigDetail entity; string ID = item.GetValue("ID"); if (!String.IsNullOrEmpty(ID)) { int id = Convert.ToInt32(ID); // entity = configSession.GetEntityByPrimaryKey<S_DOC_ListConfigDetail>(table["ID"].ToString()); entity = context.S_DOC_ListConfigDetail.SingleOrDefault(d => d.ID == id); } else { entity = this.ListConfig().S_DOC_ListConfigDetail.FirstOrDefault(d => d.AttrField == fileName); } if (entity == null) { entity = new S_DOC_ListConfigDetail(); entity.AllowSort = TrueOrFalse.True.ToString(); entity.Align = Algin.center.ToString(); entity.Dispaly = TrueOrFalse.True.ToString(); entity.Width = 150; if (this.ListConfig().S_DOC_QueryParam.Count > 0) { entity.DetailSort = this.ListConfig().S_DOC_QueryParam.Max(d => d.QuerySort) + 1; } else { entity.DetailSort = 1; } this.ListConfig().S_DOC_ListConfigDetail.Add(entity); } Tool.UpdateHashtableInstance <S_DOC_ListConfigDetail>(entity, item); ; } }
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); } } }
public void AddListConfigDetail(S_DOC_NodeAttr item) { var entity = this.ListConfig().S_DOC_ListConfigDetail.FirstOrDefault(d => d.AttrField == item.AttrField); if (entity == null) { entity = new S_DOC_ListConfigDetail(); entity.AttrName = item.AttrName; entity.AttrField = item.AttrField; entity.AllowSort = TrueOrFalse.True.ToString(); entity.Align = Algin.center.ToString(); entity.Dispaly = TrueOrFalse.True.ToString(); entity.Width = 150; if (this.ListConfig().S_DOC_ListConfigDetail.Count > 0) { entity.DetailSort = this.ListConfig().S_DOC_ListConfigDetail.Max(d => d.DetailSort) + 1; } else { entity.DetailSort = 1; } this.ListConfig().S_DOC_ListConfigDetail.Add(entity); } }