public static void SetName(this LookupProperty property, string name, string namingRegex) { if (!Regex.Match(property.Name, namingRegex).Success) { return; } if (property.Il2CppProperty != null) { property.Il2CppProperty.Name = name; } }
/// <summary> /// Adds the specified name. /// </summary> /// <param name="name">The name.</param> /// <param name="type">The type.</param> /// <param name="value">The value.</param> /// <param name="data">The data.</param> public ICrmAttribute Create(string name, CrmAttributeType type, string value, params string[] data) { Property property = null; switch (type) { case CrmAttributeType.Boolean: property = new CrmBooleanProperty(); break; case CrmAttributeType.Customer: property = new CustomerProperty(); break; case CrmAttributeType.DateTime: property = new CrmDateTimeProperty(); break; case CrmAttributeType.Decimal: property = new CrmDecimalProperty(); break; case CrmAttributeType.Float: property = new CrmFloatProperty(); break; case CrmAttributeType.Integer: property = new CrmNumberProperty(); break; case CrmAttributeType.Lookup: property = new LookupProperty(); break; case CrmAttributeType.Memo: property = new StringProperty(); break; case CrmAttributeType.Money: property = new CrmMoneyProperty(); break; case CrmAttributeType.Owner: property = new OwnerProperty(); break; case CrmAttributeType.Picklist: property = new PicklistProperty(); break; case CrmAttributeType.State: property = new StateProperty(); break; case CrmAttributeType.Status: property = new StatusProperty(); break; case CrmAttributeType.String: property = new StringProperty(); break; case CrmAttributeType.UniqueIdentifier: property = new UniqueIdentifierProperty(); break; case CrmAttributeType.PartyList: property = new DynamicEntityArrayProperty(); break; case CrmAttributeType.Virtual: case CrmAttributeType.CalendarRules: case CrmAttributeType.Internal: case CrmAttributeType.PrimaryKey: break; } this.Add(property); var crmAttributeAdapter = new CrmAttributeAdapter(property) { Name = name }; crmAttributeAdapter.SetValue(value, data); return(crmAttributeAdapter); }
protected bool createPartyListProperties(ArrayList partyListParams) { //loop to create the Boolean properties try { ArrayList paramtab = (ArrayList)partyListParams; createm_workingparam(paramtab[1], paramtab[2], paramtab[3]); DynamicEntity activityParty = new DynamicEntity("activityparty"); LookupProperty partyProperty = new LookupProperty("partyid", new Lookup(paramtab[2].ToString(), new Guid(paramtab[3].ToString()))); activityParty.Properties.Add(partyProperty); DynamicEntityArrayProperty customersProperty = new DynamicEntityArrayProperty(paramtab[1].ToString(), new DynamicEntity[] { activityParty }); m_propertyList.Add(customersProperty); } catch (Exception ex) { throw new ESC_CRM_EX.createPropertyException(ex.Message, " partylist" + m_workingparam); } return true; }
protected override void OnBuild() { QFSLXLookup qfLookup = (QFSLXLookup) QfControl; if (_lookupIdBindingPath != null) { string propertyString = null; try { propertyString = (_isObject ? DataPathTranslator.TranslateReference(_lookupIdBindingPath, _idDataPath.TargetTable, _idDataPath.TargetField) : DataPathTranslator.TranslateField(_lookupIdBindingPath)); } catch (MigrationException ex) { LogError(ex.Message); } if (propertyString != null) { QfControl.DataBindings.Add(new QuickFormPropertyDataBindingDefinition(propertyString, "LookupResultValue")); } } qfLookup.LookupBindingMode = (_isObject ? LookupBindingModeEnum.Object : LookupBindingModeEnum.String); if (_lookup != null) { OrmEntity entity = Context.Entities[_lookup.MainTable]; if (entity != null) { qfLookup.LookupEntityName = entity.Name; qfLookup.LookupEntityTypeName = string.Format("Sage.Entity.Interfaces.{0}, Sage.Entity.Interfaces, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null", entity.InterfaceName); if (_nameDataPath != null) { if (entity.DisplayProperty == null && _nameDataPath.Joins.Count == 0) { string targetField = _nameDataPath.TargetField; if (targetField.StartsWith("@")) { targetField = targetField.Substring(1); } entity.DisplayProperty = entity.Properties.GetFieldPropertyByFieldName(targetField); entity.Validate(); entity.Save(); } string nameString = null; try { nameString = DataPathTranslator.TranslateField(_nameDataPath); } catch (MigrationException ex) { LogError(ex.Message); } if (!string.IsNullOrEmpty(nameString)) { nameString = string.Format("${{{0}}}", nameString); var stringExpression = entity.GetStringExpression(); if (stringExpression != nameString) { if (string.IsNullOrEmpty(stringExpression) || nameString.Length < stringExpression.Length) { entity.SetStringExpression(nameString); entity.Validate(); entity.Save(); } else { LogWarning("Multiple string expressions for entity '{0}' found", entity.Name); } } } } } else { LogWarning("Unable to resolve the entity for '{0}' table", _lookup.MainTable); } for (int i = 0; i < _columns.Count; i++) { ColumnDefinition column = _columns[i]; DataPath dataPath = _dataPaths[i]; string propertyString = null; try { propertyString = DataPathTranslator.TranslateField(dataPath, _columnPrefixPath); } catch (MigrationException ex) { LogError(ex.Message); } if (propertyString != null) { LookupProperty prop = new LookupProperty(propertyString, column.Caption); switch (column.FormatType) { case FormatType.Phone: prop.PropertyFormat = PropertyFormatEnum.Phone; break; case FormatType.User: prop.PropertyFormat = PropertyFormatEnum.User; break; case FormatType.PickListItem: prop.PropertyFormat = PropertyFormatEnum.PickList; break; } qfLookup.LookupProperties.Add(prop); } } } }
public Property CreateProperty(string name, CRMSecurityProvider.Sources.Attribute.CrmAttributeType type, string value, params string[] data) { Property property = null; switch (type) { case CRMSecurityProvider.Sources.Attribute.CrmAttributeType.Boolean: property = new CrmBooleanProperty(); break; case CRMSecurityProvider.Sources.Attribute.CrmAttributeType.Customer: property = new CustomerProperty(); break; case CRMSecurityProvider.Sources.Attribute.CrmAttributeType.DateTime: property = new CrmDateTimeProperty(); break; case CRMSecurityProvider.Sources.Attribute.CrmAttributeType.Decimal: property = new CrmDecimalProperty(); break; case CRMSecurityProvider.Sources.Attribute.CrmAttributeType.Float: property = new CrmFloatProperty(); break; case CRMSecurityProvider.Sources.Attribute.CrmAttributeType.Integer: property = new CrmNumberProperty(); break; case CRMSecurityProvider.Sources.Attribute.CrmAttributeType.Lookup: property = new LookupProperty(); break; case CRMSecurityProvider.Sources.Attribute.CrmAttributeType.Memo: property = new StringProperty(); break; case CRMSecurityProvider.Sources.Attribute.CrmAttributeType.Money: property = new CrmMoneyProperty(); break; case CRMSecurityProvider.Sources.Attribute.CrmAttributeType.Owner: property = new OwnerProperty(); break; case CRMSecurityProvider.Sources.Attribute.CrmAttributeType.Picklist: property = new PicklistProperty(); break; case CRMSecurityProvider.Sources.Attribute.CrmAttributeType.State: property = new StateProperty(); break; case CRMSecurityProvider.Sources.Attribute.CrmAttributeType.Status: property = new StatusProperty(); break; case CRMSecurityProvider.Sources.Attribute.CrmAttributeType.String: property = new StringProperty(); break; case CRMSecurityProvider.Sources.Attribute.CrmAttributeType.UniqueIdentifier: property = new UniqueIdentifierProperty(); break; case CRMSecurityProvider.Sources.Attribute.CrmAttributeType.PartyList: property = new DynamicEntityArrayProperty(); break; case CRMSecurityProvider.Sources.Attribute.CrmAttributeType.Virtual: case CRMSecurityProvider.Sources.Attribute.CrmAttributeType.CalendarRules: case CRMSecurityProvider.Sources.Attribute.CrmAttributeType.Internal: case CRMSecurityProvider.Sources.Attribute.CrmAttributeType.PrimaryKey: break; } if (property != null) { SetPropertyValue(property, value, data); } return(property); }
/// <summary> /// Creates the instance. /// </summary> /// <param name="propertyName">Name of the property.</param> /// <param name="value">The value.</param> /// <returns></returns> /// <exception cref="ArgumentException">value</exception> public virtual Property GetProperty(string propertyName, object value) { Property property; if (string.IsNullOrEmpty(propertyName)) { throw new ArgumentException("Property name must be non null.", "propertyName"); } if (value == null) { throw new ArgumentNullException("Property value must be non null.", "value"); } if (string.Compare(propertyName, "StateCode", true, CultureInfo.InvariantCulture) == 0) { property = new StateProperty { Value = (string)value }; } else if (value is string) { property = new StringProperty { Value = (string)value }; } else if (value is UniqueIdentifier) { property = new UniqueIdentifierProperty { Value = (UniqueIdentifier)value }; } else if (value is Status) { property = new StatusProperty { Value = (Status)value }; } else if (value is Picklist) { property = new PicklistProperty { Value = (Picklist)value }; } else if (value is Owner) { property = new OwnerProperty { Value = (Owner)value }; } else if (value is Lookup) { property = new LookupProperty { Value = (Lookup)value }; } else if (value is CrmCampaignIntegration.Services.Key) { property = new KeyProperty { Value = (CrmCampaignIntegration.Services.Key)value }; } else if (value is EntityNameReference) { property = new EntityNameReferenceProperty { Value = (EntityNameReference)value }; } else if (value is DynamicEntity[]) { property = new DynamicEntityArrayProperty { Value = (DynamicEntity[])value }; } else if (value is Customer) { property = new CustomerProperty { Value = (Customer)value }; } else if (value is CrmCampaignIntegration.Services.CrmNumber) { property = new CrmNumberProperty { Value = (CrmCampaignIntegration.Services.CrmNumber)value }; } else if (value is CrmMoney) { property = new CrmMoneyProperty { Value = (CrmMoney)value }; } else if (value is CrmCampaignIntegration.Services.CrmFloat) { property = new CrmFloatProperty { Value = (CrmCampaignIntegration.Services.CrmFloat)value }; } else if (value is CrmDecimal) { property = new CrmDecimalProperty { Value = (CrmDecimal)value }; } else if (value is CrmCampaignIntegration.Services.CrmDateTime) { property = new CrmDateTimeProperty { Value = (CrmCampaignIntegration.Services.CrmDateTime)value }; } else if (value is CrmCampaignIntegration.Services.CrmBoolean) { property = new CrmBooleanProperty { Value = (CrmCampaignIntegration.Services.CrmBoolean)value }; } else { throw new NotSupportedException(string.Format("Unknown value type: {0}", value.GetType())); } property.Name = propertyName; return(property); }