Пример #1
0
 public override int GetHashCode()
 {
     return(InnerEvent.GetHashCode(fingerprint, InnerTypeId));
 }
Пример #2
0
        public object Deserialize <T>(Mediachase.Ibn.Core.Business.EntityObject entity)
        {
            if (entity.PrimaryKeyId != null)
            {
                InnerEvent.UID = new Text(entity.PrimaryKeyId.Value.ToString());
            }
            foreach (EntityObjectProperty entityProp in entity.Properties)
            {
                iCal2EntityMapping.MappingResult mapRes = iCal2EntityMapping.EntityProp2iCalProp <T>(entityProp.Name);
                //Пропускаем пустые свойства
                if (entityProp.Value == null || mapRes == null)
                {
                    continue;
                }

                if (mapRes.Name.StartsWith("X-"))
                {
                    InnerEvent.AddProperty(mapRes.Name, entityProp.Value.ToString());
                    continue;
                }

                switch (mapRes.Name)
                {
                case "CATEGORIES":
                    InnerEvent.Categories = new TextCollection[] { new TextCollection(entityProp.Value.ToString()) };
                    break;

                case "DTSTART":
                    InnerEvent.DTStart = (DateTime)entityProp.Value;
                    break;

                case "DTEND":
                    InnerEvent.DTEnd = (DateTime)entityProp.Value;
                    break;

                case "DTSTART.TZID":
                case "DTEND.TZID":
                    if (entityProp.Name == CalendarEventEntity.FieldEndTimeZoneOffset)
                    {
                        InnerEvent.DTEnd.AddParameter(mapRes.Name, entityProp.Value.ToString());
                    }
                    else
                    {
                        InnerEvent.DTStart.AddParameter(mapRes.Name, entityProp.Value.ToString());
                    }
                    break;

                case "PRIORITY":
                    InnerEvent.Priority = new Integer((int)entityProp.Value);
                    break;

                case "CLASS":
                    InnerEvent.Class = new Text(entityProp.Value.ToString());
                    break;

                case "SUMMARY":
                    InnerEvent.Summary = new Text(entityProp.Value.ToString());
                    break;

                case "LOCATION":
                    InnerEvent.Location = new Text(entityProp.Value.ToString());
                    break;

                case "DESCRIPTION":
                    InnerEvent.Description = new Text(entityProp.Value.ToString());
                    break;

                case "RECURRENCE-ID":
                    InnerEvent.Recurrence_ID = new iCalDateTime(entityProp.Value.ToString());
                    break;
                }
            }
            return(InnerEvent);
        }