예제 #1
0
        public static ContactBaseWrapper ToContactBaseWrapperQuick(Contact contact)
        {
            var result = new ContactBaseWrapper(contact.ID);

            result.DisplayName = contact.GetTitle();
            result.IsPrivate   = CRMSecurity.IsPrivate(contact);
            result.IsShared    = contact.ShareType == ShareType.ReadWrite || contact.ShareType == ShareType.Read;
            result.ShareType   = contact.ShareType;

            if (result.IsPrivate)
            {
                result.AccessList = CRMSecurity.GetAccessSubjectTo(contact)
                                    .Select(item => EmployeeWraper.Get(item.Key));
            }
            result.Currency = !String.IsNullOrEmpty(contact.Currency) ?
                              new CurrencyInfoWrapper(CurrencyProvider.Get(contact.Currency)) :
                              null;

            result.SmallFotoUrl  = String.Format("{0}HttpHandlers/filehandler.ashx?action=contactphotoulr&cid={1}&isc={2}&ps=1", PathProvider.BaseAbsolutePath, contact.ID, contact is Company);
            result.MediumFotoUrl = String.Format("{0}HttpHandlers/filehandler.ashx?action=contactphotoulr&cid={1}&isc={2}&ps=2", PathProvider.BaseAbsolutePath, contact.ID, contact is Company);
            result.IsCompany     = contact is Company;
            result.CanEdit       = CRMSecurity.CanEdit(contact);
            //result.CanDelete = CRMSecurity.CanDelete(contact);

            return(result);
        }
예제 #2
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"
     });
 }
 public static RelationshipEventWrapper GetSample()
 {
     return(new RelationshipEventWrapper
     {
         CanEdit = true,
         Category = HistoryCategoryWrapper.GetSample(),
         Entity = EntityWrapper.GetSample(),
         Contact = ContactBaseWrapper.GetSample(),
         Created = (ApiDateTime)DateTime.UtcNow,
         CreateBy = EmployeeWraper.GetSample(),
         Files = new[] { FileWrapper.GetSample() },
         Content = @"Договорились встретиться с клиентом за обедом и обсудить коммерческое предложение
                                "
     });
 }
예제 #4
0
 public static OpportunityWrapper GetSample()
 {
     return(new OpportunityWrapper(0)
     {
         CreateBy = EmployeeWraper.GetSample(),
         Created = ApiDateTime.GetSample(),
         Responsible = EmployeeWraper.GetSample(),
         Title = "Hotel catalogue",
         Description = "",
         ExpectedCloseDate = ApiDateTime.GetSample(),
         Contact = ContactBaseWrapper.GetSample(),
         IsPrivate = false,
         SuccessProbability = 65,
         BidType = BidType.FixedBid,
         Stage = DealMilestoneBaseWrapper.GetSample()
     });
 }
예제 #5
0
 public static OpportunityWrapper GetSample()
 {
     return(new OpportunityWrapper(0)
     {
         CreateBy = EmployeeWraper.GetSample(),
         Created = (ApiDateTime)DateTime.UtcNow,
         Responsible = EmployeeWraper.GetSample(),
         Title = "Каталог отелей",
         Description = "",
         ExpectedCloseDate = (ApiDateTime)DateTime.UtcNow.AddDays(10),
         Contact = ContactBaseWrapper.GetSample(),
         IsPrivate = false,
         SuccessProbability = 65,
         BidType = BidType.FixedBid,
         Stage = DealMilestoneWrapper.GetSample()
     });
 }
예제 #6
0
        public static ContactBaseWrapper ToContactBaseWrapperQuick(Contact contact)
        {
            var result = new ContactBaseWrapper(contact.ID);

            result.DisplayName = contact.GetTitle();
            result.IsPrivate = CRMSecurity.IsPrivate(contact);
            result.IsShared = contact.ShareType == ShareType.ReadWrite || contact.ShareType == ShareType.Read;
            result.ShareType = contact.ShareType;

            if (result.IsPrivate)
            {
                result.AccessList = CRMSecurity.GetAccessSubjectTo(contact)
                                        .Select(item => EmployeeWraper.Get(item.Key));
            }
            result.Currency = !String.IsNullOrEmpty(contact.Currency) ?
                new CurrencyInfoWrapper(CurrencyProvider.Get(contact.Currency)) :
                null;

            result.SmallFotoUrl = String.Format("{0}HttpHandlers/filehandler.ashx?action=contactphotoulr&cid={1}&isc={2}&ps=1", PathProvider.BaseAbsolutePath, contact.ID, contact is Company).ToLower();
            result.MediumFotoUrl = String.Format("{0}HttpHandlers/filehandler.ashx?action=contactphotoulr&cid={1}&isc={2}&ps=2", PathProvider.BaseAbsolutePath, contact.ID, contact is Company).ToLower();
            result.IsCompany = contact is Company;
            result.CanEdit = CRMSecurity.CanEdit(contact);
            //result.CanDelete = CRMSecurity.CanDelete(contact);

            return result;
        }