public void AddQueryParam(S_DOC_NodeAttr item) { var entity = this.ListConfig().S_DOC_QueryParam.FirstOrDefault(d => d.AttrField == item.AttrField); if (entity == null) { entity = new S_DOC_QueryParam(); entity.AttrField = item.AttrField; entity.AttrName = item.AttrName; entity.InKey = TrueOrFalse.False.ToString(); entity.InnerField = item.AttrField; entity.InAdvancedQuery = TrueOrFalse.True.ToString(); entity.QueryType = QueryType.LK.ToString(); entity.DataType = item.DataType; if (this.ListConfig().S_DOC_QueryParam.Count > 0) { entity.QuerySort = this.ListConfig().S_DOC_QueryParam.Max(d => d.QuerySort) + 1; } else { entity.QuerySort = 1; } this.ListConfig().S_DOC_QueryParam.Add(entity); } }
public void SaveQueryParam(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; } // var table = row as Hashtable; //if (!String.IsNullOrEmpty(item.GetValue("AttrField"))) continue; string fileName = item.GetValue("AttrField"); S_DOC_QueryParam entity; string ID = item.GetValue("ID"); if (!String.IsNullOrEmpty(ID)) { int id = Convert.ToInt32(ID); // entity = configSession.GetEntityByPrimaryKey<S_DOC_QueryParam>(table["ID"].ToString()); entity = context.S_DOC_QueryParam.SingleOrDefault(d => d.ID == id); } else { entity = this.ListConfig().S_DOC_QueryParam.FirstOrDefault(d => d.AttrField == fileName); } if (entity == null) { entity = new S_DOC_QueryParam(); entity.AttrField = item.GetValue("AttrField"); //table["AttrField"].ToString(); entity.AttrName = item.GetValue("AttrName"); //table["AttrName"].ToString(); entity.InKey = TrueOrFalse.False.ToString(); entity.InnerField = item.GetValue("AttrField"); //table["AttrField"].ToString(); entity.QueryType = QueryType.LK.ToString(); if (this.ListConfig().S_DOC_QueryParam.Count > 0) { entity.QuerySort = this.ListConfig().S_DOC_QueryParam.Max(d => d.QuerySort) + 1; } else { entity.QuerySort = 1; } this.ListConfig().S_DOC_QueryParam.Add(entity); } //FrameDataAdapter.UpdateHashtableInstance<S_DOC_QueryParam>(entity, table); Tool.UpdateHashtableInstance <S_DOC_QueryParam>(entity, item); } }