private static string GetFormatedText(PromotionPaymentFactor 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(PromotionPaymentFactor target, string parentFilter) { bool result = true; parentFilter = parentFilter.Replace(" ", ""); // remove spaces parentFilter = parentFilter.Replace("'", ""); // remove ' string [] parsed = parentFilter.Split('='); // parse if (target.WorkplaceId == 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 { PromotionPaymentFactor parentTemplate = PromotionPaymentFactor.Load(target.WorkplaceId); result = IgnorThis(parentTemplate, parentFilter); } return(result); }