/// <summary> /// 将扩展值集合组合为字符串 /// </summary> /// <param name="extpropertycollection"></param> /// <returns></returns> protected string CombineExtProperty(NameValueCollection extpropertycollection, string modelname) { string str = ""; UD_ModelFieldsDAL dal = new UD_ModelFieldsDAL(); IList <UD_ModelFields> extfields = dal.GetExtFieldsList(modelname); if (extpropertycollection != null) { foreach (UD_ModelFields modelfield in extfields) { str += extpropertycollection[modelfield.FieldName] + "|"; } } return(str); }
/// <summary> /// 分解扩展属性值至集合 /// </summary> /// <param name="tablename"></param> /// <param name="extfieldvalue"></param> /// <returns></returns> protected NameValueCollection SpiltExtProperty(string modelname, string extvalue) { NameValueCollection ExtPropertyCollection = new NameValueCollection(); UD_ModelFieldsDAL dal = new UD_ModelFieldsDAL(); IList <UD_ModelFields> extfields = dal.GetExtFieldsList(modelname); string[] vaules = extvalue.Split('|'); for (int i = 0; i < extfields.Count; i++) { if (i < vaules.Length) { ExtPropertyCollection.Add(extfields[i].FieldName, vaules[i]); } else { ExtPropertyCollection.Add(extfields[i].FieldName, ""); } } return(ExtPropertyCollection); }