private LocationPropertyData GetOrCreatePropertyData(string PropertyAlias) { //First, Lookup property type information var locTypeProp = Repositories.LocationTypePropertyRepo.GetByAlias(PropertyAlias); if (locTypeProp == null) { throw new Exception("Provided property alias does not match a valid property for this location type."); } else { //Now check for existing prop data Guid LocationKey = this.Key; var existingPropertyData = Repositories.LocationPropertyDataRepo.GetByAlias(PropertyAlias, LocationKey); if (existingPropertyData != null) { return(existingPropertyData); } else { var newPropData = new LocationPropertyData(this.Key, locTypeProp.Key); Repositories.LocationPropertyDataRepo.Insert(newPropData); return(newPropData); } } }
/// <summary> /// Initializes a new instance of the <see cref="PropertyValue"/> class using actual LocationPropertyData /// </summary> /// <param name="PropertyData"> /// The property data. /// </param> public PropertyValue(LocationPropertyData PropertyData) { switch (PropertyData.DatabaseType) { case CmsDataType.DbType.Date: this._dataDate = PropertyData.dataDate; _dataObject = PropertyData.dataDate; this.Type = ValueType.Date; break; case CmsDataType.DbType.Integer: this._dataInt = PropertyData.dataInt; _dataObject = PropertyData.dataInt; this.Type = ValueType.Int; break; case CmsDataType.DbType.Ntext: this._dataString = PropertyData.dataNtext; _dataObject = PropertyData.dataNtext; this.Type = ValueType.String; break; case CmsDataType.DbType.Nvarchar: this._dataString = PropertyData.dataNvarchar; _dataObject = PropertyData.dataNvarchar; this.Type = ValueType.String; break; } }
internal IndexedPropertyData(LocationPropertyData Prop) { if (Prop != null) { this.Key = Prop.Key; this.PropAlias = Prop.PropertyAlias; this.PropData = Prop.Value.ValueObject; } }
public JsonPropertyData(LocationPropertyData Prop) { if (Prop != null) { this.Key = Prop.Key; this.PropAlias = Prop.PropertyAlias; this.PropData = Prop.Value.ValueObject; } }
public LocationPropertyDataDto ToLocationPropertyDataDto(LocationPropertyData entity) { var dto = new LocationPropertyDataDto() { Key = entity.Key, LocationKey = entity.LocationKey, LocationTypePropertyKey = entity.LocationTypePropertyKey, dataInt = entity.dataInt, dataDate = entity.dataDate, dataNvarchar = entity.dataNvarchar, dataNtext = entity.dataNtext, UpdateDate = entity.UpdateDate, CreateDate = entity.CreateDate }; return dto; }
internal IEnumerable <LocationPropertyData> GetPropertyData() { var finalPropData = new List <LocationPropertyData>(); //Get list of properties which should be represented var propsList = GetLocTypeProperties(); //Get current properties var currentPropData = Repositories.LocationPropertyDataRepo.GetByLocation(this.Key); if (!currentPropData.Any()) { //no data, so add all loctype props foreach (var locTypeProp in propsList) { var newProp = new LocationPropertyData(this.Key, locTypeProp.Key); finalPropData.Add(newProp); } } else { //compare lists of props foreach (var locTypeProp in propsList) { var prop = currentPropData.Where(p => p.LocationTypePropertyKey == locTypeProp.Key).FirstOrDefault(); if (prop != null) { finalPropData.Add(prop); } else { var newProp = new LocationPropertyData(this.Key, locTypeProp.Key); finalPropData.Add(newProp); } } } return(finalPropData); }
public LocationPropertyData ToLocationPropertyDataEntity(LocationPropertyDataDto dto) { var Entity = new LocationPropertyData() { Key = dto.Key, LocationKey = dto.LocationKey, LocationTypePropertyKey = dto.LocationTypePropertyKey, dataInt = dto.dataInt, dataDate = dto.dataDate, dataNvarchar = dto.dataNvarchar, dataNtext = dto.dataNtext, UpdateDate = dto.UpdateDate, CreateDate = dto.CreateDate }; return Entity; }
private LocationPropertyData GetOrCreatePropertyData(string PropertyAlias) { //First, Lookup property type information var locTypeProp = Repositories.LocationTypePropertyRepo.GetByAlias(PropertyAlias); if (locTypeProp == null) { throw new Exception("Provided property alias does not match a valid property for this location type."); } else { //Now check for existing prop data Guid LocationKey = this.Key; var existingPropertyData = Repositories.LocationPropertyDataRepo.GetByAlias(PropertyAlias, LocationKey); if (existingPropertyData != null) { return existingPropertyData; } else { var newPropData = new LocationPropertyData(this.Key, locTypeProp.Key); Repositories.LocationPropertyDataRepo.Insert(newPropData); return newPropData; } } }
internal IEnumerable<LocationPropertyData> GetPropertyData() { var finalPropData = new List<LocationPropertyData>(); //Get list of properties which should be represented var propsList = GetLocTypeProperties(); //Get current properties var currentPropData = Repositories.LocationPropertyDataRepo.GetByLocation(this.Key); if (!currentPropData.Any()) { //no data, so add all loctype props foreach (var locTypeProp in propsList) { var newProp = new LocationPropertyData(this.Key, locTypeProp.Key); finalPropData.Add(newProp); } } else { //compare lists of props foreach (var locTypeProp in propsList) { var prop = currentPropData.Where(p => p.LocationTypePropertyKey == locTypeProp.Key).FirstOrDefault(); if (prop != null) { finalPropData.Add(prop); } else { var newProp = new LocationPropertyData(this.Key, locTypeProp.Key); finalPropData.Add(newProp); } } } return finalPropData; }