private static string GetFormatedText(MemberVipData target, string[] textField, string textFormatString) { for (int i = 0; i < textField.Length; i++) { PropertyInfo pi = target.GetType().GetProperty(textField[i]); textFormatString = textFormatString.Replace("{" + i.ToString() + "}", pi != null ? pi.GetValue(target, null).ToString() : string.Empty); } return(textFormatString); }
private static bool IgnorThis(MemberVipData target, string parentFilter) { bool result = true; parentFilter = parentFilter.Replace(" ", ""); // remove spaces parentFilter = parentFilter.Replace("'", ""); // remove ' string[] parsed = parentFilter.Split('='); // parse if (target.MemberId == Guid.Empty) { PropertyInfo pi = target.GetType().GetProperty(parsed[0]); string filterField = (string)pi.GetValue(target, null); if (filterField.ToLower() == parsed[1].ToLower()) { result = false; } } else { MemberVipData parentTemplate = MemberVipData.Load(target.MemberId); result = IgnorThis(parentTemplate, parentFilter); } return(result); }