Пример #1
0
 private void ShowSelectedContactTabs(MemberModel member)
 {
     if (member != null)
     {
         _originalMember = member.Clone();
         if (CanViewContactDetails)
         {
             ContactDetailsContent = new ContactDetailsView(member.Contact, true, member);
         }
         if (CanViewCorrespondence)
         {
             CorrespondenceContent = new CorrespondenceView(member.Contact, "Member");
         }
         if (CanViewActivity)
         {
             ActivityContent = new ActivityView(member.Contact);
         }
         if (CanViewAccounts)
         {
             AccountsContent = new AccountsView(member.Contact);
         }
         if (CanViewMemberDetails)
         {
             MemberDetailsContent = new MemberDetailsView(member);
         }
         if (CanViewNoteDetails)
         {
             MemberNotesContent = new MemberNotesView(member);
         }
         if (CanViewUpdateDetails)
         {
             MemberUpdateDetailsContent = new MemberUpdateDetailsView(member);
         }
     }
 }
Пример #2
0
 private void ShowSelectedContactTabs(ContactModel model)
 {
     if (model != null)
     {
         if (CanViewContactDetails)
         {
             ContactDetailsContent = new ContactDetailsView(model);
         }
         if (CanViewCorrespondence)
         {
             CorrespondenceContent = new CorrespondenceView(model, "Contact");
         }
         if (CanViewActivity)
         {
             ActivityContent = new ActivityView(model);
         }
         if (CanViewAccounts)
         {
             AccountsContent = new AccountsView(model);
         }
     }
 }
        public List <CorrespondenceView> GetNotesForClientByUserId(string clientUserId, int noteType)
        {
            List <CorrespondenceView> result = new List <CorrespondenceView>();
            var client           = db.Clients.SingleOrDefault(c => c.ClientId == clientUserId);
            var clientId         = db.Clients.SingleOrDefault(c => c.ClientId == clientUserId).ClientId;
            var relevantNoteType = noteType;

            foreach (var note in db.Notes.Where(n => n.ClientId == clientId &&
                                                n.NoteType == relevantNoteType && db.NoteLinks.Where(l => l.NoteId2 == n.NoteId).Count() == 0))
            {
                var adviser  = db.Advisers.FirstOrDefault(ad => ad.AdviserId.ToString() == note.AccountId);
                var resource = note.Attachments.FirstOrDefault();
                #region create correspondence payload skeleton first
                CorrespondenceView item = new CorrespondenceView()
                {
                    adviserId       = adviser.AdviserNumber.ToString(),
                    adviserName     = adviser.FirstName + " " + adviser.LastName,
                    clientId        = note.ClientId,
                    clientName      = client.ClientType == BusinessLayerParameters.clientType_person ? client.FirstName + " " + client.LastName : client.EntityName,
                    date            = note.DateCreated,
                    noteId          = note.NoteId,
                    path            = resource == null ? "" : System.Web.VirtualPathUtility.ToAbsolute(resource.Path),
                    subject         = note.Subject,
                    typeName        = CommonHelpers.GetEnumDescription((NoteTypes)note.NoteType),
                    type            = resource == null ? "" : resource.AttachmentType,
                    conversations   = new List <CorrespondenceConversation>(),
                    actionsRequired = note.FollowupActions,
                    assetClass      = note.AssetClass,
                    completionDate  = note.DateCompleted,
                    productClass    = note.ProductClass
                };
                #endregion
                #region inject the initial conversation

                CorrespondenceConversation initial = new CorrespondenceConversation()
                {
                    content    = note.Body,
                    createdOn  = note.DateCreated,
                    senderRole = note.SenderRole,
                    senderName = note.SenderRole == BusinessLayerParameters.correspondenceSenderRole_adviser ? adviser.FirstName + " " + adviser.LastName
                    : (client.ClientType == BusinessLayerParameters.clientType_person ? client.FirstName + " " + client.LastName : client.EntityName)
                };
                item.conversations.Add(initial);
                #endregion
                #region insert all other conversations
                foreach (var subnote in db.NoteLinks.Where(n => n.NoteId1 == note.NoteId))
                {
                    var subNoteContent = db.Notes.SingleOrDefault(n => n.NoteId == subnote.NoteId2);
                    CorrespondenceConversation conversation = new CorrespondenceConversation()
                    {
                        content    = subNoteContent.Body,
                        senderRole = subNoteContent.SenderRole,
                        createdOn  = subNoteContent.DateCreated,
                        senderName = subNoteContent.SenderRole == BusinessLayerParameters.correspondenceSenderRole_adviser ? adviser.FirstName + " " + adviser.LastName
                        : (client.ClientType == BusinessLayerParameters.clientType_person ? client.FirstName + " " + client.LastName : client.EntityName)
                    };
                    item.conversations.Add(conversation);
                }


                #endregion
                item.conversations = item.conversations.OrderBy(s => s.createdOn).ToList();
                result.Add(item);
            }
            return(result);
        }