Пример #1
0
 public static RelationshipEventWrapper GetSample()
 {
     return(new RelationshipEventWrapper
     {
         CanEdit = true,
         Category = HistoryCategoryBaseWrapper.GetSample(),
         Entity = EntityWrapper.GetSample(),
         Contact = ContactBaseWrapper.GetSample(),
         Created = (ApiDateTime)DateTime.UtcNow,
         CreateBy = EmployeeWraper.GetSample(),
         Files = new[] { FileWrapper.GetSample() },
         Content = @"Agreed to meet at lunch and discuss the client commercial offer
                                "
     });
 }
        private EntityWrapper ToEntityWrapper(EntityType entityType, int entityID)
        {
            if (entityID == 0) return null;

            var result = new EntityWrapper
                             {
                                 EntityId = entityID
                             };

            switch (entityType)
            {
                case EntityType.Case:
                    result.EntityType = "case";

                    var cases = DaoFactory.GetCasesDao().GetByID(entityID);

                    if (cases != null)
                        result.EntityTitle = cases.Title;

                    break;
                case EntityType.Opportunity:
                    result.EntityType = "opportunity";

                    var obj = DaoFactory.GetDealDao().GetByID(entityID);

                    if (obj != null)
                        result.EntityTitle = obj.Title;
                    break;
                default:
                    return null;
            }

            return result;
        }