public static DanhMuc FromConcept(String maNhom, JsonObject concept) { var dm = new DanhMuc(); dm.MaNhom = maNhom; dm.Ma = concept["code"].AsString; dm.Ten = concept["display"].AsString; var properties = concept["property"].AsJsonArray; foreach (var property in properties) { string ma = property["code"].AsString; Object giaTri = GetPropertyValue(property); if (ma != "slug") { dm.DsThuocTinh.Add(new ThuocTinh(ma, giaTri)); } } return(dm); }
public static DanhMuc FromParams(string maNhom, JsonArray paramArr) { var dm = new DanhMuc(); dm.MaNhom = maNhom; foreach (var param in paramArr) { if (param["name"].AsString == "name") { dm.Ma = param["valueString"].AsString; } if (param["name"].AsString == "display") { dm.Ten = param["valueString"].AsString; } if (param["name"].AsString == "property") { var parts = param["part"].AsJsonArray; foreach (var part in parts) { string ma = part["name"].AsString; Object giaTri = GetPropertyValue(part); if (ma != "slug") { dm.DsThuocTinh.Add(new ThuocTinh(ma, giaTri)); } } } } return(dm); }