public string getColumnNotFoundWarning(AuditColumns input) { string result = ""; PropertyInfo[] properties = input.GetType().GetProperties(); foreach (PropertyInfo property in properties) { string colValue = input.GetType().GetProperty(property.Name).GetValue(input).ToString(); if (colValue == "") { result += property.Name + ", "; } } return(result); }
public AuditColumns cleanUpNonExistingColumn(AuditColumns input) { AuditColumns result = new AuditColumns(); PropertyInfo[] properties = input.GetType().GetProperties(); foreach (PropertyInfo property in properties) { string colValue = input.GetType().GetProperty(property.Name).GetValue(input).ToString(); if (colValue.Length > 2 || colValue.Length <= 0) { result.GetType().GetProperty(property.Name).SetValue(result, ""); } else { result.GetType().GetProperty(property.Name).SetValue(result, colValue); } } return(result); }