public static PattrInfo Parse(string stringify) { string[] ret = stringify.Split(new char[] { '|' }, 5, StringSplitOptions.None); if (ret.Length != 5) { throw new Exception("格式不正确,PattrInfo:" + stringify); } PattrInfo item = new PattrInfo(); if (string.Compare("null", ret[0]) != 0) { item.Id = uint.Parse(ret[0]); } if (string.Compare("null", ret[1]) != 0) { item.Category_id = uint.Parse(ret[1]); } if (string.Compare("null", ret[2]) != 0) { item.Parent_id = uint.Parse(ret[2]); } if (string.Compare("null", ret[3]) != 0) { item.Is_filter = ret[3] == "1"; } if (string.Compare("null", ret[4]) != 0) { item.Name = ret[4].Replace(StringifySplit, "|"); } return(item); }
public int UnflagAttr(PattrInfo Pattr) => UnflagAttr(Pattr.Id);
public Product_attrInfo FlagAttr(PattrInfo Pattr, string Value) => FlagAttr(Pattr.Id, Value);
public static string ToJson(this PattrInfo item) { return(string.Concat(item)); }
public PattrInfo AddPattr(PattrInfo item) { item.Category_id = this.Id; return(item.Save()); }
public PattrInfo AddPattr(PattrInfo Pattr, bool?Is_filter, string Name) => AddPattr(Pattr.Id, Is_filter, Name);
public PattrInfo AddPattr(PattrInfo item) { item.Parent_id = this.Id; return(item.Save()); }