Beispiel #1
0
        private void bindData()
        {
            int leadID = 0;
            int claimID = 0;
            Leads lead = null;
            Claim claim = null;
            List<LeadsDocument> leadDocuments = null;
            List<ClaimDocument> claimDocuments = null;
            List<DocumentList> allDocuments = new List<DocumentList>();

            int.TryParse(Core.SecurityManager.DecryptQueryString(Request.Params["q"].ToString()), out claimID);

            if (claimID > 0) {
                claim = ClaimsManager.Get(claimID);
                if (claim != null) {
                    lead = claim.LeadPolicy.Leads;

                    lblName.Text = lead.insuredName;

                    // lead documents
                    leadDocuments = LeadsUploadManager.getLeadsDocumentForExportByLeadID(leadID);
                    if (leadDocuments != null && leadDocuments.Count > 0) {
                        foreach (LeadsDocument leadDocument in leadDocuments) {
                            DocumentList doc = new DocumentList();
                            doc.DocumentName = leadDocument.DocumentName;
                            doc.Description = leadDocument.Description;

                            doc.DocumentPath = string.Format("/LeadsDocument/{0}/{1}/{2}",
                                                leadDocument.LeadId,
                                                leadDocument.LeadDocumentId,		// document id
                                                leadDocument.DocumentName);		// document file name

                            allDocuments.Add(doc);
                        }
                    }

                    // claim documents
                    claimDocuments = ClaimDocumentManager.GetAll(claimID);
                    if (claimDocuments != null && claimDocuments.Count > 0) {
                        foreach (ClaimDocument claimDocument in claimDocuments) {
                            DocumentList doc = new DocumentList();
                            doc.DocumentName = claimDocument.DocumentName;
                            doc.Description = claimDocument.Description;

                            doc.DocumentPath = string.Format("/ClaimDocuments/{0}/{1}/{2}",
                                                claimDocument.ClaimID,
                                                claimDocument.ClaimDocumentID,		// document id
                                                claimDocument.DocumentName);		// document file name
                            allDocuments.Add(doc);
                        }
                    }

                    gvDocument.DataSource = allDocuments;
                    gvDocument.DataBind();
                }
            }
        }
        protected void bindData()
        {
            //AppraiserMaster appraiser = null;
            Claim claim = null;
            //List<LeadContact> contacts = null;
            List<DocumentList> attachments = null;
            //ContractorMaster contractor = null;
            //List<SecUser> users = null;
            Leads lead = null;
            //Data.UmpireMaster umpire = null;
            // get email for user sending email

            CRM.Data.Entities.SecUser user = SecUserManager.GetByUserId(userID);
            if (user != null) {
                txtEmailFrom.Text = user.Email;
                txtEmailCC.Text = user.Email;
                txtSignature.Text = user.emailSignature ?? "";
            }

            claim = ClaimsManager.Get(this.claimID);

            if (claim != null) {
                attachments = new List<DocumentList>();

                lead = claim.LeadPolicy.Leads;

                // build subject line
                txtEmailSubject.Text = string.Format("{0} Claim #: {1}", lead.policyHolderName, claim.AdjusterClaimNumber);

                // load legacy documents
                List<LeadsDocument> documents = LeadsUploadManager.getLeadsDocumentByLeadID((int)claim.LeadPolicy.LeadId);

                if (documents != null && documents.Count > 0) {

                    foreach (LeadsDocument x in documents) {
                        DocumentList attachment = new DocumentList();
                        attachment.DocumentName = x.Description;
                        attachment.DocumentPath = string.Format("LeadsDocument/{0}/{1}/{2}",
                            x.LeadId,
                            x.LeadDocumentId,		// document id
                            x.DocumentName);		// document file name

                        attachments.Add(attachment);
                    }
                }

                // load claim documents
                List<ClaimDocument> claimDocuments = ClaimDocumentManager.GetAll(this.claimID);
                if (claimDocuments != null && claimDocuments.Count > 0) {

                    foreach (ClaimDocument x in claimDocuments) {
                        DocumentList attachment = new DocumentList();

                        attachment.DocumentName = x.Description;
                        attachment.DocumentPath = string.Format("ClaimDocuments/{0}/{1}/{2}",
                            x.ClaimID,
                            x.ClaimDocumentID,		// document id
                            x.DocumentName);		// document file name

                        attachments.Add(attachment);
                    }
                }

                lbxDocuments.DataSource = attachments;
                lbxDocuments.DataBind();

                //// load legacy contacts
                //contacts = LeadContactManager.GetContactByLeadID(leadID);

                //// add adjusters to contact list
                //if (claim.AdjusterMaster != null)
                //	addToContactList(claim.AdjusterMaster.AdjusterName, claim.AdjusterMaster.email, contacts);

                //// add appraiser to contact list
                //if (lead.AppraiserID != null) {
                //	appraiser = AppraiserManager.Get((int)lead.AppraiserID);

                //	contacts.Add(new LeadContact {
                //		Email = appraiser.Email,
                //		ContactName = appraiser.AppraiserName
                //	});
                //}

                //// add contractor to contact list
                //if (lead.ContractorID != null) {
                //	contractor = ContractorManager.Get((int)lead.ContractorID);
                //	contacts.Add(new LeadContact {
                //		Email = lead.ContractorMaster.Email,
                //		ContactName = lead.ContractorMaster.ContractorName
                //	});
                //}

                //// add umpire to contact list
                //if (lead.UmpireID != null) {
                //	umpire = UmpireManager.Get((int)lead.UmpireID);

                //	contacts.Add(new LeadContact {
                //		Email = lead.UmpireMaster.Email,
                //		ContactName = lead.UmpireMaster.UmpireName
                //	});
                //}

                // add users 2013-12-12
                //users = SecUserManager.GetUsers(clientID);
                //if (users != null && users.Count > 0) {

                //	users.ForEach(x =>
                //		contacts.Add(new LeadContact {
                //			Email = x.Email,
                //			ContactName = x.FirstName ?? "" + " " + x.LastName ?? ""
                //		}));
                //}
            }

            //lbxContacts.DataSource = contacts;
            //lbxContacts.DataBind();
        }