public virtual void CopyValueToCurrentValueColumn() { PartnershipHelper partnershipHelper = ClassFactory.Get <PartnershipHelper>(new ConstructorArgument("userConnection", UserConnection)); Guid parameterValueTypeId = Entity.GetTypedColumnValue <Guid>("ParameterValueTypeId"); string columnValueName = partnershipHelper.GetColumnValueNameByType(parameterValueTypeId); switch (columnValueName) { case "BooleanValue": var boolValue = Entity.GetTypedColumnValue <Boolean>(columnValueName); Entity.SetColumnValue("CurrentValue", boolValue ? Yes.ToString() : No.ToString()); break; case "ListItemValue": Guid listItemValueId = Entity.GetTypedColumnValue <Guid>("ListItemValueId"); Guid guidValue = Entity.GetTypedColumnValue <Guid>("GuidValue"); Guid categoryId = Entity.GetTypedColumnValue <Guid>("PartnerParamCategoryId"); Entity.SetColumnValue("CurrentValue", guidValue.Equals(Guid.Empty) ? listItemValueId.ToString() : getLookupDisplayValueByCategory(categoryId, guidValue) ); break; default: Entity.SetColumnValue("CurrentValue", Entity.GetTypedColumnValue <string>(columnValueName)); break; } }
public override bool FillStringValue() { var attributeTypeId = string.Empty; var attributeValue = string.Empty; if (Entity.SiteEventAttributeId == Guid.Empty) { return(true); } ; var esqResult = new EntitySchemaQuery(UserConnection.EntitySchemaManager, "SiteEventAttribute"); esqResult.AddColumn("Type"); var attributeEntity = esqResult.GetEntity(UserConnection, Entity.SiteEventAttributeId); attributeTypeId = attributeEntity.GetTypedColumnValue <string>("TypeId"); // if not string value if (attributeTypeId != "e9da1be2-b0b9-478f-8290-b84a0091ec81") { Entity.SetColumnValue("StringValue", string.Empty); } ; switch (attributeTypeId) { // string type case ("e9da1be2-b0b9-478f-8290-b84a0091ec81"): Entity.SetColumnValue("IntValue", 0); Entity.SetColumnValue("FloatValue", 0.0); Entity.SetColumnValue("BooleanValue", false); Entity.SetColumnValue("ListItemValueId", null); Entity.SetColumnValue("ProductValueId", null); Entity.SetColumnValue("ProductTypeValueId", null); Entity.SetColumnValue("ProductCategoryValueId", null); Entity.SetColumnValue("ProductTradeMarkValueId", null); return(true); // int type case ("30dc6786-9179-4e6c-9e09-3c00b98bd3ef"): attributeValue = Entity.GetTypedColumnValue <string>("IntValue"); Entity.SetColumnValue("FloatValue", 0.0); Entity.SetColumnValue("BooleanValue", false); Entity.SetColumnValue("ListItemValueId", null); Entity.SetColumnValue("ProductValueId", null); Entity.SetColumnValue("ProductTypeValueId", null); Entity.SetColumnValue("ProductCategoryValueId", null); Entity.SetColumnValue("ProductTradeMarkValueId", null); break; // float type case ("21b7b386-0ce4-48d3-9b4d-6616407dedb0"): attributeValue = Entity.GetTypedColumnValue <string>("FloatValue"); Entity.SetColumnValue("IntValue", 0); Entity.SetColumnValue("BooleanValue", false); Entity.SetColumnValue("ListItemValueId", null); Entity.SetColumnValue("ProductValueId", null); Entity.SetColumnValue("ProductTypeValueId", null); Entity.SetColumnValue("ProductCategoryValueId", null); Entity.SetColumnValue("ProductTradeMarkValueId", null); break; // boolean type case ("5762dce0-54fd-4da5-859d-323003b8a9e2"): if (Entity.GetTypedColumnValue <bool>("BooleanValue")) { attributeValue = Yes.ToString(); } else { attributeValue = No.ToString(); } Entity.SetColumnValue("FloatValue", 0.0); Entity.SetColumnValue("IntValue", 0); Entity.SetColumnValue("ListItemValueId", null); Entity.SetColumnValue("ProductValueId", null); Entity.SetColumnValue("ProductTypeValueId", null); Entity.SetColumnValue("ProductCategoryValueId", null); Entity.SetColumnValue("ProductTradeMarkValueId", null); break; // list item value case ("23332960-c76a-4c53-a4e6-f0447b8d0018"): Entity.SetColumnValue("IntValue", 0); Entity.SetColumnValue("FloatValue", 0.0); Entity.SetColumnValue("BooleanValue", false); Entity.SetColumnValue("ProductValueId", null); Entity.SetColumnValue("ProductTypeValueId", null); Entity.SetColumnValue("ProductCategoryValueId", null); Entity.SetColumnValue("ProductTradeMarkValueId", null); attributeValue = GetColumnDisplayValue("SiteEventAttrListItem", Entity.ListItemValueId); break; // product item value case ("28979594-4b11-4bd8-86d2-f2252f508edd"): Entity.SetColumnValue("BooleanValue", false); Entity.SetColumnValue("FloatValue", 0.0); Entity.SetColumnValue("IntValue", 0); Entity.SetColumnValue("ListItemValueId", null); Entity.SetColumnValue("ProductTypeValueId", null); Entity.SetColumnValue("ProductCategoryValueId", null); Entity.SetColumnValue("ProductTradeMarkValueId", null); attributeValue = GetColumnDisplayValue("Product", Entity.ProductValueId); break; // product trademark item value case ("5262af16-0914-4f73-a1e9-20cbebd766f9"): Entity.SetColumnValue("BooleanValue", false); Entity.SetColumnValue("FloatValue", 0.0); Entity.SetColumnValue("IntValue", 0); Entity.SetColumnValue("ListItemValueId", null); Entity.SetColumnValue("ProductTypeValueId", null); Entity.SetColumnValue("ProductTradeMarkValueId", null); attributeValue = GetColumnDisplayValue("ProductCategory", Entity.ProductCategoryValueId); break; // product type item value case ("e29b09bb-0f52-4eb4-847d-3b6235f5424a"): Entity.SetColumnValue("BooleanValue", false); Entity.SetColumnValue("FloatValue", 0.0); Entity.SetColumnValue("IntValue", 0); Entity.SetColumnValue("ListItemValueId", null); Entity.SetColumnValue("ProductCategoryValueId", null); Entity.SetColumnValue("ProductTradeMarkValueId", null); attributeValue = GetColumnDisplayValue("ProductType", Entity.ProductTypeValueId); break; // product trademark item value case ("71fae7e0-2a9c-4aea-9a87-e23eee66b01d"): Entity.SetColumnValue("BooleanValue", false); Entity.SetColumnValue("FloatValue", 0.0); Entity.SetColumnValue("IntValue", 0); Entity.SetColumnValue("ListItemValueId", null); Entity.SetColumnValue("ProductTypeValueId", null); Entity.SetColumnValue("ProductCategoryValueId", null); attributeValue = GetColumnDisplayValue("TradeMark", Entity.ProductTradeMarkValueId); break; default: return(true); } ; Entity.SetColumnValue("StringValue", attributeValue); return(true); }