private static UIControlType GetControlType(IPropDef propDef) { UIControlType type; if (propDef.HasLookupList()) { return(GetComboBoxControlType()); } switch (propDef.PropertyType.Name) { case "String": type = GetTextBoxControlType(); break; case "Boolean": type = GetCheckBoxControlType(); break; case "DateTime": type = GetDateTimeControlType(); break; default: type = GetTextBoxControlType(); break; } return(type); }
private static FilterClauseOperator GetFilterClauseOperator(IPropDef propDef) { if (propDef.HasLookupList()) return FilterClauseOperator.OpEquals; if (propDef.PropertyType.Name == "Boolean" || propDef.PropertyType.Name == "DateTime") return FilterClauseOperator.OpEquals; return FilterClauseOperator.OpLike; }
private static void CheckPropDefHasLookupList(IPropDef propDef) { if (!propDef.HasLookupList()) { throw new HabaneroDeveloperException ("There is a problem with the configuration of this application", string.Format ("The application tried to configure a BOPropLookupList - with the propDef {0} that does not have a lookup list defined", propDef.PropertyName)); } }
private static FilterClauseOperator GetFilterClauseOperator(IPropDef propDef) { if (propDef.HasLookupList()) { return(FilterClauseOperator.OpEquals); } if (propDef.PropertyType.Name == "Boolean" || propDef.PropertyType.Name == "DateTime") { return(FilterClauseOperator.OpEquals); } return(FilterClauseOperator.OpLike); }
// ReSharper restore MemberCanBePrivate.Global /// <summary> /// Returns the class definition related to the /// lookup list for the specified property. /// If the property does not have a LookupList returns null. /// If the LookupList is not of Type <see cref="ILookupListWithClassDef"/> /// then returns null. /// </summary> /// <param name="propertyName">The property name</param> /// <returns>Returns the class definition or null if not available</returns> public IClassDef GetLookupListClassDef(string propertyName) { IClassDef classDef = _businessObject.ClassDef; IPropDef propDef = classDef.GetPropDef(propertyName, false); if (propDef != null && propDef.LookupList != null && propDef.HasLookupList()) { if (propDef.LookupList is ILookupListWithClassDef) { ILookupListWithClassDef lookupList = (ILookupListWithClassDef)propDef.LookupList; return(lookupList.ClassDef); } } return(null); }
/// <summary> /// Returns the lookup list contents for the property specified /// </summary> /// <param name="propertyName">The property name</param> /// <returns>Returns the lookup list or an empty collection if /// not available</returns> public Dictionary <string, string> GetLookupList(string propertyName) { if (_businessObject != null) { IPropDef propDef = _businessObject.ClassDef.GetPropDef(propertyName, false); if (propDef != null && propDef.LookupList != null && propDef.HasLookupList()) { return(propDef.LookupList.GetLookupList()); } } else { string message = string.Format("The lookup list for '{0}' could not be returned since the business object is null", propertyName); throw new HabaneroDeveloperException(message, message); } return(new Dictionary <string, string>()); }
private static UIControlType GetControlType(IPropDef propDef) { UIControlType type; if (propDef.HasLookupList()) return GetComboBoxControlType(); switch (propDef.PropertyType.Name) { case "String": type = GetTextBoxControlType(); break; case "Boolean": type = GetCheckBoxControlType(); break; case "DateTime": type = GetDateTimeControlType(); break; default: type = GetTextBoxControlType(); break; } return type; }