public static void SavePropertyForCategory(ISession session, int categoryId, ErpPropertyInfo prop) { int id = (int)session.Save(prop); prop.PropertyId = id; PropertyRship pr = new PropertyRship(); pr.FromEntityId = id; pr.ToEntityId = categoryId; pr.RelationshipTypeId = PropertyRShipIsCategoryPropertyOf; session.Save(pr); }
public static bool ContainsInfoKey(this List <BusinessEntityPropertyItem> props, ErpPropertyInfo key) { return(props.Any(prop => Equals(prop.PropertyInfo, key) && prop.Value != null)); }
public static void AddValueByPropertyInfo(this List <BusinessEntityPropertyItem> props, ErpPropertyInfo key, String value) { foreach (var prop in props) { if (prop.PropertyInfo.PropertyId == key.PropertyId) { prop.Value = value; return; } } props.Add(new BusinessEntityPropertyItem { PropertyInfo = key, Value = value }); }
public static String GetValueByPropertyInfo(this List <BusinessEntityPropertyItem> props, ErpPropertyInfo key) { return((from prop in props where prop.PropertyInfo.PropertyId == key.PropertyId select prop.Value).FirstOrDefault()); }
/// <summary> /// 从数据库字段值转换到用户数据 /// </summary> /// <param name="pro"></param> /// <param name="value">数据库字段</param> /// <returns>用户应看到的数据</returns> public static String ParseValue(ErpPropertyInfo pro, String value) { return(value); }
/// <summary> /// 从用户数据转换到数据库字段值 /// </summary> /// <param name="pro"></param> /// <param name="value">用户输入的数据</param> /// <returns>数据库字段应存数值</returns> public static String FormatValue(ErpPropertyInfo pro, String value) { return(value); }
protected bool Equals(ErpPropertyInfo other) { return(PropertyId == other.PropertyId); }