Beispiel #1
0
        public bool CompareEntity(EntityObject otherEntity)
        {
            bool retVal = true;

            foreach (string propName in _usedProperties)
            {
                EntityObjectProperty leftProp  = _entity.Properties[propName];
                EntityObjectProperty rightProp = otherEntity.Properties[propName];
                object leftValue  = leftProp != null ? leftProp.Value : null;
                object rightValue = rightProp.Value != null ? rightProp.Value : null;
                if (leftValue != null && rightValue != null)
                {
                    if (!leftValue.Equals(rightValue))
                    {
                        Trace.WriteLine(String.Format("Entity {0}[{1}:{2}] != {3}[{1}:{4}]", _entity.MetaClassName, propName, leftProp.Value, otherEntity.MetaClassName, rightProp.Value));
                        retVal = false;
                        break;
                    }
                }
                else if (leftValue != rightValue)
                {
                    Trace.WriteLine(String.Format("Entity {0}[{1}:{2}] != {3}[{1}:{4}]", _entity.MetaClassName, propName, leftProp.Value, otherEntity.MetaClassName, rightProp.Value));
                    retVal = false;
                    break;
                }
            }

            return(retVal);
        }
Beispiel #2
0
        private static FilterElement[] ConstructFilterByEntity(EntityObject entity)
        {
            AndBlockFilterElement retVal = new AndBlockFilterElement();

            foreach (string propName in CalendarEventResourceEntity.ComparedProperties)
            {
                EntityObjectProperty property = entity.Properties[propName];
                if (property != null && property.Value != null)
                {
                    retVal.ChildElements.Add(new FilterElement(propName, FilterElementType.Equal, property.Value));
                }
            }
            return(new FilterElement[] { retVal });
        }
Beispiel #3
0
        private string GetMetaPropertyValue(EntityObjectProperty eop, string fieldName)
        {
            MetaField field = Mediachase.Ibn.Web.UI.Controls.Util.FormController.GetMetaField(ClassName, fieldName);
            string    value = String.Empty;

            if (field == null)
            {
                return(value);
            }
            if (field.IsMultivalueEnum)
            {
                MetaFieldType type = field.GetMetaType();

                int[] idList = (int[])eop.Value;
                foreach (int id in idList)
                {
                    if (value != String.Empty)
                    {
                        value += "<br />";
                    }
                    value += CHelper.GetResFileString(MetaEnum.GetFriendlyName(type, id));
                }
            }
            else if (field.IsEnum)
            {
                value = CHelper.GetResFileString(MetaEnum.GetFriendlyName(field.GetMetaType(), (int)eop.Value));
            }
            //else if (field.IsReference)
            //{
            //    string sReferencedClass = field.Attributes.GetValue<string>(McDataTypeAttribute.ReferenceMetaClassName);
            //    EntityObject obj = BusinessManager.Load(sReferencedClass, (PrimaryKeyId)eop.Value);
            //    MetaClass mcRef = Mediachase.Ibn.Core.MetaDataWrapper.GetMetaClassByName(sReferencedClass);
            //    value = obj.Properties[mcRef.TitleFieldName].Value.ToString();
            //}

            //dvs: hot-fix (IBNPORTAL_ERROR-008286-27094)
            else if (field.Name == "CreatorId" || field.Name == "ModifierId")
            {
                value = CommonHelper.GetUserStatusPureName((int)eop.Value);
            }
            else
            {
                value = eop.Value.ToString();
            }


            return(value);
        }