Example #1
0
        protected void gvUserLeads_Sorting(object sender, GridViewSortEventArgs e)
        {
            bool descending = false;

            if (ViewState[e.SortExpression] == null)
            {
                descending = false;
            }
            else
            {
                descending = !(bool)ViewState[e.SortExpression];
            }

            ViewState[e.SortExpression] = descending;

            ViewState["lastSortExpression"] = e.SortExpression;
            ViewState["lastSortDirection"]  = descending;

            Expression <Func <Leads, bool> > predicate = buildPredicate();

            List <LeadView> leads = LeadsManager.GetLeads(predicate);

            //gvUserLeads.DataSource = LeadsManager.GetLeads(predicate, e.SortExpression, descending);
            //gvUserLeads.DataBind();
        }
Example #2
0
        protected void btnSearch_Click(object sender, ImageClickEventArgs e)
        {
            List <LeadView>  leads = null;
            List <UserStaff> users = null;
            int clientID           = 0;

            var predicate = buildPredicate();

            leads = LeadsManager.GetLeads(predicate).ToList();

            if (leads != null && leads.Count > 0)
            {
                gvUserLeads.DataSource = leads;

                gvUserLeads.DataBind();

                // load users
                clientID = SessionHelper.getClientId();

                users = SecUserManager.GetStaff(clientID);
                CollectionManager.FillCollection(ddlUsers, "UserId", "StaffName", users);

                pnlGrid.Visible = true;
                lblError.Text   = string.Empty;

                pnlSearch.Visible = false;
            }
            else
            {
                lblError.Text    = "No results found.";
                lblError.Visible = true;
            }
        }
Example #3
0
        private void DoBind()
        {
            int clientID = 0;

            clientID = SessionHelper.getClientId();

            var predicate = PredicateBuilder.True <CRM.Data.Entities.Leads>();
            int userLead  = Convert.ToInt32(Session["UserId"]);

            if (!String.IsNullOrWhiteSpace(hfFromDate.Value))
            {
                DateTime sDate = new DateTime(Convert.ToInt32(hfFromDate.Value.Trim().Substring(6, 4)), Convert.ToInt32(hfFromDate.Value.Trim().Substring(3, 2)), Convert.ToInt32(hfFromDate.Value.Trim().Substring(0, 2)));

                var datefrom = Convert.ToDateTime(sDate);
                predicate = predicate.And(Lead => Lead.OriginalLeadDate >= datefrom
                                          );
            }
            if (!String.IsNullOrWhiteSpace(hfToDate.Value))
            {
                DateTime sDate = new DateTime(Convert.ToInt32(hfToDate.Value.Trim().Substring(6, 4)), Convert.ToInt32(hfToDate.Value.Trim().Substring(3, 2)), Convert.ToInt32(hfToDate.Value.Trim().Substring(0, 2)));

                var dateto = Convert.ToDateTime(sDate);
                predicate = predicate.And(Lead => Lead.OriginalLeadDate <= dateto
                                          );
            }


            predicate = predicate.And(Lead => Lead.UserId == userLead);

            // 2013-10-22
            predicate = predicate.And(Lead => Lead.LeadPolicy.Any(x => x.IsActive));

            // tortega 2013-08-02 - get lead for client id
            if ((roleID == (int)UserRole.Client || roleID == (int)UserRole.SiteAdministrator) && clientID > 0)
            {
                predicate = predicate.And(Lead => Lead.ClientID == clientID);
            }


            objLead = LeadsManager.GetPredicate(predicate);

            if (objLead != null && objLead.Count > 0)
            {
                gvUserLeads.DataSource = objLead;
                gvUserLeads.DataBind();
            }
            else
            {
                gvUserLeads.DataSource = null;
                gvUserLeads.DataBind();
            }
            bindAllLeads();

            // 2013-07-17
            bindTasks();
        }
Example #4
0
        protected void bindData()
        {
            int   leadID = SessionHelper.getLeadId();
            Leads lead   = null;

            // get claimant name
            lead = LeadsManager.Get(leadID);
            if (lead != null)
            {
                if (lead.LeadPolicy != null && lead.LeadPolicy.Count > 0)
                {
                    Core.CollectionManager.FillCollection(ddlPolicyType, "policyTypeID", "policyTypeDescription", LeadPolicyTypeManager.GetCurrentPolicy(lead), false);
                }
            }
        }
Example #5
0
        private void FillDocumentList(int LeadId)
        {
            Leads objLead = LeadsManager.GetByLeadId(LeadId);

            //if (objLead.LeadId > 0 && objLead.LeadId != null) {

            //     chkInsurancePolicy.Checked = objLead.hasInsurancePolicy == null ? false : objLead.hasInsurancePolicy == false ? false : true;
            //     chkSignedRetainer.Checked = objLead.hasSignedRetainer == null ? false : objLead.hasSignedRetainer == false ? false : true;
            //     chkDamageReport.Checked = objLead.hasDamageReport == null ? false : objLead.hasDamageReport == false ? false : true;
            //     chkDamagePhoto.Checked = objLead.hasDamagePhoto == null ? false : objLead.hasDamagePhoto == false ? false : true;
            //     chkCertifiedInsurancePolicy.Checked = objLead.hasCertifiedInsurancePolicy == null ? false : objLead.hasCertifiedInsurancePolicy == false ? false : true;
            //     chkOwnerContract.Checked = objLead.hasOwnerContract == null ? false : objLead.hasOwnerContract == false ? false : true;
            //     chkContentList.Checked = objLead.hasContentList == null ? false : objLead.hasContentList == false ? false : true;
            //     chkDamageEstimate.Checked = objLead.hasDamageEstimate == null ? false : objLead.hasDamageEstimate == false ? false : true;
            //}
        }
Example #6
0
        protected void loadData()
        {
            int clientID   = SessionHelper.getClientId();
            int openCount  = 0;
            int closeCount = 0;

            if (clientID > 0)
            {
                openCount = LeadsManager.GetOpenLeadCount(clientID);

                closeCount = LeadsManager.GetCloseLeadCount(clientID);

                lblOpenLeadCount.Text = string.Format("{0:n0}", openCount);

                lblCloseLeadCount.Text = string.Format("{0:n0}", closeCount);
            }
        }
Example #7
0
        protected void autoFillLetter(int leadID)
        {
            Leads lead = null;

            string letterTemplatePath = Server.MapPath(templateURL);

            lead = LeadsManager.Get(leadID);

            if (lead != null)
            {
                string finalDocumentaPath = Server.MapPath(string.Format("~/Temp/Notice_To_Insurer_{0}.doc", lead.LeadId));

                Core.MergeDocumentHelper.autoFillDocument(letterTemplatePath, finalDocumentaPath, lead, true);

                ReportHelper.renderToBrowser(finalDocumentaPath);
            }
        }
        private void notifyAdjuster(CRM.Data.Entities.LeadPolicy policy)
        {
            AdjusterMaster adjuster      = null;
            string         clientName    = null;
            string         claimantName  = null;
            string         emailText     = null;
            string         emailPassword = null;
            Leads          lead          = null;
            int            leadID        = 0;

            string[] recipients = null;
            string   userEmail  = null;
            string   subject    = null;

            // get adjuster info
            adjuster = AdjusterManager.Get(policy.AdjusterID ?? 0);

            // retreive lead information
            leadID = SessionHelper.getLeadId();

            lead = LeadsManager.GetByLeadId(leadID);

            if (lead != null && adjuster != null && !string.IsNullOrEmpty(adjuster.email) && (adjuster.isEmailNotification ?? true))
            {
                recipients = new string[] { adjuster.email };

                userEmail     = ConfigurationManager.AppSettings["userID"].ToString();
                emailPassword = ConfigurationManager.AppSettings["Password"].ToString();

                // name of CRM client
                clientName = adjuster.Client == null ? "" : adjuster.Client.BusinessName;

                claimantName = string.Format("{0} {1}", lead.ClaimantFirstName ?? "", lead.ClaimantLastName ?? "");

                subject = string.Format("{0} has assigned {1} to you.", clientName, claimantName);

                emailText = string.Format("<br>Claim # {0} was assigned to you.<br>Please review {1} right away to begin the file.<br><br>Thank you.<br><br>http://app.claimruler.com",
                                          policy.ClaimNumber,
                                          claimantName);

                Core.EmailHelper.sendEmail(adjuster.email, recipients, null, subject, emailText, null, userEmail, emailPassword);
            }
        }
Example #9
0
        protected void gvCarrierPolicy_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            CRM.Data.Entities.LeadPolicy policy = null;
            decimal invoiceAmount = 0;

            int profileID = Convert.ToInt32(ddlInvoiceProfile.SelectedValue);

            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                policy = e.Row.DataItem as CRM.Data.Entities.LeadPolicy;

                Label lblPolicyHolder = e.Row.FindControl("lblPolicyHolder") as Label;
                lblPolicyHolder.Text = LeadsManager.GetLeadName((int)policy.LeadId);

                invoiceAmount = calculateInvoiceAmount(policy);
                Label lblInvoiceAmount = e.Row.FindControl("lblInvoiceAmount") as Label;

                lblInvoiceAmount.Text = string.Format("{0:N2}", invoiceAmount);
            }
        }
        private void FillLeadInfo(int LeadId)
        {
            Lead objLead = LeadsManager.GetByLeadId(LeadId);

            if (objLead.LeadId > 0 && objLead.LeadId != null)
            {
                string LastName = objLead.ClaimantLastName != null ? objLead.ClaimantLastName : "";
                lblClaimantName.Text = objLead.ClaimantFirstName == null ? "" : objLead.ClaimantFirstName.ToString() + " " + LastName;
                lblBusinessName.Text = objLead.BusinessName == null ? "" : objLead.BusinessName.ToString();
                //
                string ClaimantAddress = objLead.LossAddress == null ? "" : objLead.LossAddress.ToString();
                string City            = objLead.CityMaster == null ? "" : objLead.CityMaster.CityName;
                string State           = string.Empty;
                if (objLead.StateMaster != null)
                {
                    State = objLead.StateMaster.StateCode == null ? "" : objLead.StateMaster.StateCode.ToString();
                }
                string zip         = objLead.Zip == null ? "" : objLead.Zip.ToString();
                string fulladdress = ClaimantAddress + ", " + City + ", " + State + ", " + zip;
                lblClaimantAdd.Text = fulladdress;
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            int leadID = 0;

            // check user permission
            //Master.checkPermission();

            if (!Page.IsPostBack)
            {
                leadID = Core.SessionHelper.getLeadId();

                if (leadID > 0)
                {
                    Leads lead = LeadsManager.GetByLeadId(leadID);



                    lblClaimant.Text = lead.ClaimantFirstName + " " + lead.ClaimantLastName;

                    bindTasks();
                }
            }
        }
Example #12
0
        protected void gvSearchResult_Sorting(object sender, GridViewSortEventArgs e)
        {
            Expression <Func <Claim, bool> > predicate = null;

            predicate = buildPredicate();

            IQueryable <LeadView> leads = LeadsManager.SearchClaim(predicate);
            bool descending             = false;

            if (ViewState[e.SortExpression] == null)
            {
                descending = false;
            }
            else
            {
                descending = !(bool)ViewState[e.SortExpression];
            }

            ViewState[e.SortExpression] = descending;

            gvSearchResult.DataSource = leads.orderByExtension(e.SortExpression, descending);

            gvSearchResult.DataBind();
        }
Example #13
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                if (Session["LeadIds"] != null)
                {
                    hfLeadsId.Value = Session["LeadIds"].ToString();
                    FillDocument(Convert.ToInt32(Session["LeadIds"]));
                    FillDocumentList(Convert.ToInt32(Session["LeadIds"]));
                    Session["LeadId"] = Session["LeadIds"].ToString();

                    if (Session["View"] != null)
                    {
                        string view = Session["View"].ToString();
                        if (view != null && view == "1")
                        {
                            dvEdit.Visible  = false;
                            lblheading.Text = "Documents";
                            btnPhotos.Text  = "Photos";


                            //chkInsurancePolicy.Enabled = false;
                            //chkSignedRetainer.Enabled = false;
                            //chkDamageReport.Enabled = false;
                            //chkDamagePhoto.Enabled = false;
                            //chkCertifiedInsurancePolicy.Enabled = false;
                            //chkOwnerContract.Enabled = false;
                            //chkContentList.Enabled = false;
                            //chkDamageEstimate.Enabled = false;


                            //btnSave.Visible = false;
                            hfView.Value = "1";
                            gvDocuments.Columns[2].Visible = false;
                        }
                    }
                }
                Leads objLeadSubmitt = LeadsManager.GetByLeadId(Convert.ToInt32(hfLeadsId.Value));
                if (objLeadSubmitt != null && objLeadSubmitt.IsSubmitted == true)
                {
                    btnGenerateReport.Visible = true;
                }
                else
                {
                    btnGenerateReport.Visible = false;
                }

                if (Session["LeadIds"] != null)
                {
                    hfLeadsId.Value = Session["LeadIds"].ToString();

                    FillDocument(Convert.ToInt32(Session["LeadIds"]));


                    if (Session["Submitted"] != null)
                    {
                        string submitted = Session["submitted"].ToString();
                        if (submitted != null && submitted == "1")
                        {
                            dvEdit.Visible = false;
                        }
                    }
                }
            }
        }
Example #14
0
        private void FillForm(string leadId, string view)
        {
            int roleID = SessionHelper.getUserRoleId();

            if (leadId != null && leadId.Trim().Length > 0)
            {
                //hfLeadId.Value = leadId;
            }
            Leads objLead = LeadsManager.GetByLeadId(Convert.ToInt32(ViewState["LeadIds"].ToString()));

            if (objLead.LeadId > 0)
            {
                // 2013-03-11 tortega for ucLeadComments.ascx
                Session["LeadIds"] = objLead.LeadId;

                // save claimant name to display in subsuquent pages
                // remove these these in the near future
                Session["ClaimantFirstName"] = objLead.ClaimantFirstName == null ? "" : objLead.ClaimantFirstName.ToString();
                Session["ClaimantLastName"]  = objLead.ClaimantLastName == null ? "" : objLead.ClaimantLastName.ToString();

                // use this in the future
                Session["InsuredName"] = objLead.InsuredName == null ? "" : objLead.InsuredName;

                lblLastActivityDate.Text = objLead.LastActivityDate == null ? "" : objLead.LastActivityDate.ToString();

                //lblLeadId.Text = objLead.LeadId.ToString();
                //lblDateSubmited.Text = objLead.DateSubmitted == null ? "" : Convert.ToDateTime(objLead.DateSubmitted).ToString("MM/dd/yyyy");
                //txtLFUUId.Text = objLead.LFUUID == null ? "" : objLead.LFUUID.ToString();
                txtOriginalLeadDate.Text = objLead.OriginalLeadDate == null ? "" : Convert.ToDateTime(objLead.OriginalLeadDate).ToString("MM/dd/yyyy");

                //txtLossDate.Text = objLead.LossDate == null ? "" : Convert.ToDateTime(objLead.LossDate).ToString("MM/dd/yyyy");

                txtLossLocation.Text = objLead.LossLocation;

                txtSecondaryLeadSource.Text = objLead.SecondaryLeadSource;

                txtInsuredName.Text = objLead.InsuredName;
                //fill new control
                if (objLead.Birthdate != null)
                {
                    txtBirthdate.Text = Convert.ToString(objLead.Birthdate);
                }
                txtReference.Text      = objLead.Reference;
                txtLanguage.Text       = objLead.Languages;
                txtTitle.Text          = objLead.Title;
                txtlossCountry.Text    = objLead.LossCounty;
                txtMailingCountry.Text = objLead.MailingCounty;

                //txtClaimsNumber.Text = objLead.ClaimsNumber.ToString();
                txtClaimantName.Text       = objLead.ClaimantFirstName == null ? "" : objLead.ClaimantFirstName.ToString();
                txtClaimantLastName.Text   = objLead.ClaimantLastName == null ? "" : objLead.ClaimantLastName.ToString();
                txtSalutation.Text         = objLead.Salutation;
                txtClaimantMiddleName.Text = objLead.ClaimantMiddleName;

                txtBusinessName.Text = objLead.BusinessName == null ? "" : objLead.BusinessName.ToString();

                txtEmail.Text = objLead.EmailAddress == null ? "" : objLead.EmailAddress.ToString();
                ddlLeadSource.SelectedValue        = objLead.LeadSource == null ? "0" : objLead.LeadSource.ToString();
                ddlPrimaryProducer.SelectedValue   = objLead.PrimaryProducerId.ToString();
                ddlSecondaryProducer.SelectedValue = objLead.SecondaryProducerId == null ? "0" : objLead.SecondaryProducerId.ToString();
                txtPhoneNumber.Text = objLead.PhoneNumber == null ? "" : objLead.PhoneNumber.ToString();
                txtMobilePhone.Text = objLead.MobilePhone == null ? "" : objLead.MobilePhone.ToString();

                //string damage = objLead.TypeOfDamage == null ? "0" : objLead.TypeOfDamage.ToString();
                //if (damage != null) {
                //	string[] damg = damage.Split(',');
                //	for (int i = 0; i < damg.Length - 1; i++) {
                //		for (int j = 0; j < chkTypeOfDamage.Items.Count; j++) {
                //			if (chkTypeOfDamage.Items[j].Value == damg[i].ToString()) {
                //				chkTypeOfDamage.Items[j].Selected = true;
                //			}
                //		}
                //	}
                //}


                ///ddlTypeOfProperty.SelectedValue = objLead.TypeOfProperty == null ? "0" : objLead.TypeOfProperty.ToString();
                //txtMarketValue.Text = objLead.MarketValue == null ? "" : objLead.MarketValue.ToString();
                txtLossAddress.Text  = objLead.LossAddress == null ? "" : objLead.LossAddress.ToString();
                txtLossAddress2.Text = objLead.LossAddress2 == null ? "" : objLead.LossAddress2.ToString();


                if (objLead.AppraiserID != null)
                {
                    ddlAppraiser.SelectedValue = objLead.AppraiserID.ToString();
                }

                if (objLead.ContractorID != null)
                {
                    ddlContractor.SelectedValue = objLead.ContractorID.ToString();
                }

                if (objLead.UmpireID != null)
                {
                    ddlUmpire.SelectedValue = objLead.UmpireID.ToString();
                }

                txtCityName.Text = objLead.CityName;

                if (!string.IsNullOrEmpty(objLead.StateName))
                {
                    setLossState(objLead.StateName);
                }

                //if (!string.IsNullOrEmpty(objLead.StateName))
                //	ddlState.SelectedValue = objLead.StateName;

                txtZipCode.Text = objLead.Zip;


                txtMailingAddress.Text  = objLead.MailingAddress;
                txtMailingAddress2.Text = objLead.MailingAddress2;
                txtMailingCity.Text     = objLead.MailingCity;

                if (!string.IsNullOrEmpty(objLead.MailingState))
                {
                    ddlMailingState.SelectedValue = objLead.StateName;
                }

                txtMailingZip.Text = objLead.MailingZip;


                lblHead.Text = "Insured Details";

                //if (objLead.IsSubmitted != null && objLead.IsSubmitted == true) {
                //     btnGenerateReport.Visible = true;
                //}

                ddlOwnerSame.SelectedValue = objLead.OwnerSame == null ? "0" : objLead.OwnerSame.ToString();
                txtOwnerFirstName.Text     = objLead.OwnerFirstName == null ? "" : objLead.OwnerFirstName.ToString();
                txtOwnerLastName.Text      = objLead.OwnerLastName == null ? "" : objLead.OwnerLastName.ToString();
                txtOwnerPhone.Text         = objLead.OwnerPhone == null ? "" : objLead.OwnerPhone.ToString();

                // 2013-03-11 tortega added owner email
                txtOwnerEmail.Text = objLead.OwnerEmail == null ? "" : objLead.OwnerEmail;

                txtSecondaryEmail.Text = objLead.SecondaryEmail == null ? "" : objLead.SecondaryEmail.ToString();
                txtSecondaryPhone.Text = objLead.SecondaryPhone == null ? "" : objLead.SecondaryPhone.ToString();

                int     categoryId = ContactManager.GetContactId("Claimant");
                Contact objcontact = ContactManager.GetLeadContact(objLead.LeadId, categoryId);
                if (objcontact != null)
                {
                    if (!string.IsNullOrEmpty(objcontact.ContactName))
                    {
                        txtThirdPartyName.Text = objcontact.ContactName;
                    }
                    else
                    {
                        txtThirdPartyName.Text = objcontact.FirstName.Trim() + " " + objcontact.LastName.Trim();
                    }

                    txtThirdPartyStreet.Text      = objcontact.Address1;
                    txtThirdPartyCity.Text        = objcontact.CityName;
                    txtThirdPartyState.Text       = objcontact.State;
                    txtThirdPartyPostalCodes.Text = objcontact.ZipCode;
                    txtThirdPartyPhoneNumber.Text = objcontact.Phone;
                }
            }
            else
            {
                // empty lead
                objLead.OriginalLeadDate = DateTime.Now;
            }


            if (view != null && view.Trim().Length > 0)
            {
                controlReadOnly();
                //btnUpload.Visible = true;
                //btnUpload.Text = "View Photos And Docs";
                //btnComments.Visible = true;
            }
        }
Example #15
0
        protected void btnSaveAndContinue_Click(object sender, EventArgs e)
        {
            bool  isDuplicate = false;
            Leads objLead     = null;

            lblError.Text      = string.Empty;
            lblError.Visible   = false;
            lblSave.Text       = string.Empty;
            lblSave.Visible    = false;
            lblMessage.Visible = false;
            lblMessage.Text    = string.Empty;
            bool isNew = false;

            Page.Validate("NewLead");

            if (!Page.IsValid)
            {
                return;
            }

            try {
                if (ViewState["LeadIds"] == null)
                {
                    // new lead/claim
                    objLead = new Leads();

                    objLead.UserId = Convert.ToInt32(Session["UserId"]);

                    // 2013-07-19

                    objLead.ClientID = Convert.ToInt32(Session["ClientId"]);

                    objLead.DateSubmitted = DateTime.Now;

                    objLead.Status = 1;

                    isNew = true;
                }
                else
                {
                    objLead = LeadsManager.GetByLeadId(Convert.ToInt32(ViewState["LeadIds"].ToString()));
                }

                //int claimsNumber = 0;

                objLead.Longitude = Convert.ToDouble(hf_Longitude.Value);
                objLead.Latitude  = Convert.ToDouble(hf_Latitude.Value);

                DateTime?originalLeadDate = null;
                if (!string.IsNullOrEmpty(txtOriginalLeadDate.Text.Trim()))
                {
                    originalLeadDate = Convert.ToDateTime(txtOriginalLeadDate.Text.Trim());
                }
                //DateTime.TryParse(txtOriginalLeadDate.Text.Trim(), out originalLeadDate);

                DateTime?lastContactDate = null;

                DateTime?siteSurveyDate = null;

                objLead.OriginalLeadDate = originalLeadDate;



                //DateTime? lossDate = null;
                //if (!string.IsNullOrEmpty(txtLossDate.Text.Trim()))
                //	lossDate = Convert.ToDateTime(txtLossDate.Text.Trim());
                //objLead.LossDate = lossDate;

                // 2013-10-29 tortega
                objLead.LossLocation = txtLossLocation.Text.Trim();

                //objLead.ClaimsNumber = claimsNumber;
                objLead.InsuredName = txtInsuredName.Text.Trim();

                objLead.ClaimantFirstName  = txtClaimantName.Text.Trim();;
                objLead.ClaimantLastName   = txtClaimantLastName.Text.Trim();
                objLead.ClaimantMiddleName = txtClaimantMiddleName.Text.Trim();
                objLead.Salutation         = txtSalutation.Text.Trim();

                objLead.BusinessName = txtBusinessName.Text;

                objLead.SecondaryLeadSource = txtSecondaryLeadSource.Text;


                if (Convert.ToInt32(ddlUmpire.SelectedValue) != 0)
                {
                    objLead.UmpireID = Convert.ToInt32(ddlUmpire.SelectedValue);
                }
                if (Convert.ToInt32(ddlContractor.SelectedValue) != 0)
                {
                    objLead.ContractorID = Convert.ToInt32(ddlContractor.SelectedValue);
                }
                if (Convert.ToInt32(ddlAppraiser.SelectedValue) != 0)
                {
                    objLead.AppraiserID = Convert.ToInt32(ddlAppraiser.SelectedValue);
                }

                // mailing address
                objLead.MailingAddress  = txtMailingAddress.Text.Trim();
                objLead.MailingAddress2 = txtMailingAddress2.Text.Trim();
                objLead.MailingCity     = txtMailingCity.Text.Trim();

                if (ddlMailingState.SelectedIndex > 0)
                {
                    objLead.MailingState = ddlMailingState.SelectedValue;
                }

                objLead.MailingZip = txtMailingZip.Text.Trim();

                // Loss Address
                objLead.LossAddress  = txtLossAddress.Text;
                objLead.LossAddress2 = txtLossAddress2.Text;

                if (ddlState.SelectedIndex > 0)
                {
                    objLead.StateName = ddlState.SelectedValue;
                }

                objLead.CityName = txtCityName.Text;
                objLead.Zip      = txtZipCode.Text;

                // check for duplicate name/address
                isDuplicate = LeadsManager.CheckForDuplicate(objLead);
                if (isDuplicate)
                {
                    lblError.Text    = "Duplicate clients not allowed.";
                    lblError.Visible = true;
                    return;
                }

                objLead.EmailAddress = txtEmail.Text;
                if (Convert.ToInt32(ddlLeadSource.SelectedValue) != 0)
                {
                    objLead.LeadSource = Convert.ToInt32(ddlLeadSource.SelectedValue);
                }
                if (Convert.ToInt32(ddlPrimaryProducer.SelectedValue) != 0)
                {
                    objLead.PrimaryProducerId = Convert.ToInt32(ddlPrimaryProducer.SelectedValue);
                }
                if (Convert.ToInt32(ddlSecondaryProducer.SelectedValue) != 0)
                {
                    objLead.SecondaryProducerId = Convert.ToInt32(ddlSecondaryProducer.SelectedValue);
                }

                objLead.PhoneNumber = txtPhoneNumber.Text;
                objLead.MobilePhone = txtMobilePhone.Text;

                //string Damagetxt = string.Empty;
                //string DamageId = string.Empty;
                //for (int j = 0; j < chkTypeOfDamage.Items.Count; j++) {
                //	if (chkTypeOfDamage.Items[j].Selected == true) {
                //		Damagetxt += chkTypeOfDamage.Items[j].Text + ',';
                //		DamageId += chkTypeOfDamage.Items[j].Value + ',';
                //	}
                //}
                //if (Damagetxt != string.Empty && DamageId != string.Empty) {
                //	objLead.TypeOfDamage = DamageId;
                //	objLead.TypeofDamageText = Damagetxt;
                //}

                //if (Convert.ToInt32(ddlTypeOfProperty.SelectedValue) != 0) {
                //	objLead.TypeOfProperty = Convert.ToInt32(ddlTypeOfProperty.SelectedValue);
                //}



                objLead.IsSubmitted = true;



                objLead.SiteSurveyDate  = siteSurveyDate;
                objLead.LastContactDate = lastContactDate;
                if (Convert.ToInt32(ddlOwnerSame.SelectedValue) != 0)
                {
                    objLead.OwnerSame = Convert.ToInt32(ddlOwnerSame.SelectedValue);
                }
                objLead.OwnerFirstName = txtOwnerFirstName.Text.Trim();
                objLead.OwnerLastName  = txtOwnerLastName.Text.Trim();
                objLead.OwnerPhone     = txtOwnerPhone.Text.Trim();

                // 2013-03-11 tortega added owner email
                objLead.OwnerEmail = txtOwnerEmail.Text.Trim();

                objLead.SecondaryEmail = txtSecondaryEmail.Text.Trim();
                objLead.SecondaryPhone = txtSecondaryPhone.Text.Trim();
                //save new fields
                if (!string.IsNullOrEmpty(txtBirthdate.Text))
                {
                    objLead.Birthdate = Convert.ToDateTime(txtBirthdate.Text);
                }
                objLead.Reference     = txtReference.Text;
                objLead.Languages     = txtLanguage.Text;
                objLead.Title         = txtTitle.Text;
                objLead.LossCounty    = txtlossCountry.Text;
                objLead.MailingCounty = txtMailingCountry.Text;

                Leads ins = LeadsManager.Save(objLead);


                if (ins.LeadId > 0)
                {
                    int      categoryId = ContactManager.GetContactId("Claimant");;
                    Contact  objcontact = ContactManager.GetLeadContact(objLead.LeadId, categoryId);
                    string[] name       = txtThirdPartyName.Text.Split(' ');
                    int      nameLength = name.Length;
                    string   firstName  = string.Empty;
                    string   lastName   = string.Empty;
                    firstName = firstName.Trim();
                    if (nameLength > 1)
                    {
                        for (int count = 0; count <= nameLength - 2; count++)
                        {
                            firstName = firstName + " " + name[count];
                        }
                        lastName = name[nameLength - 1];
                    }
                    else
                    {
                        firstName = name[0];
                    }

                    Contact contact = null;
                    contact = new Contact();
                    if (objcontact != null)
                    {
                        contact.ContactID = objcontact.ContactID;
                    }
                    contact.LeadId      = ins.LeadId;
                    contact.ClientID    = SessionHelper.getClientId();
                    contact.UserID      = SessionHelper.getUserId();
                    contact.IsActive    = true;
                    contact.FirstName   = firstName.Trim();
                    contact.LastName    = lastName.Trim();
                    contact.ContactName = firstName.Trim() + " " + lastName.Trim();;
                    contact.Address1    = txtThirdPartyStreet.Text;
                    contact.CityName    = txtThirdPartyCity.Text;
                    contact.State       = txtThirdPartyState.Text;
                    contact.ZipCode     = txtThirdPartyPostalCodes.Text;
                    contact.Phone       = txtThirdPartyPhoneNumber.Text;

                    contact.CategoryID = categoryId;
                    if (objcontact == null)
                    {
                        contact = ContactManager.SaveContact(contact);
                        //Contact contactupdate = new Contact();
                        //contactupdate.ContactID = contact.ContactID;
                        //contactupdate.ContactName = contact.ContactName;
                        //contact = ContactManager.UpdateContact(contactupdate);
                    }
                    else
                    {
                        contact = ContactManager.Update(contact);
                    }



                    Session["LeadIds"] = ins.LeadId;

                    ViewState["LeadIds"] = ins.LeadId;

                    //savePolicy();

                    //SaveLeadLog(objLead);

                    showControls(true);

                    lblSave.Text = "Claim/Lead information saved successfully.";

                    lblSave.Visible = true;

                    //// repopulate policy info after saving a new lead
                    //if (isNew) {
                    //	fillPolicy(ins.LeadId);
                    //}
                }
            }
            catch (Exception ex) {
                lblError.Text    = "Your update could not be saved for the following reason(s):<br />" + ex.ToString();
                lblError.Visible = true;
            }
        }
Example #16
0
        protected void Page_Load(object sender, EventArgs e)
        {
            int leadID = 0;

            // set default button
            Page.Form.DefaultButton = btnSaveAndContinue1.UniqueID;
            Page.Form.DefaultFocus  = txtOriginalLeadDate.UniqueID;

            if (!IsPostBack)
            {
                bindProducer();

                bindState();

                bindDDL();

                if (this.Context.Items["selectedleadid"] != null && this.Context.Items["selectedleadid"].ToString().Length > 0 &&
                    Convert.ToInt32(this.Context.Items["selectedleadid"]) > 0 &&
                    this.Context.Items["view"] != null)
                {
                    //hfLeadId.Value = this.Context.Items["selectedleadid"].ToString();

                    Session["LeadIds"] = this.Context.Items["selectedleadid"].ToString();

                    ViewState["LeadIds"] = this.Context.Items["selectedleadid"].ToString();

                    hfAdminView.Value = this.Context.Items["view"].ToString();

                    // reset page for photos
                    Session["pageIndex"] = 0;

                    // update last activity date
                    LeadsManager.UpdateLastActivityDate(Convert.ToInt32(this.Context.Items["selectedleadid"]));

                    FillForm(ViewState["LeadIds"].ToString(), hfAdminView.Value);

                    bindTasks();
                }
                else
                {
                    // new lead/claim
                    pnlTasks.Visible = false;

                    txtOriginalLeadDate.Value = DateTime.Today;

                    //tr_taskPanel.Visible = false;

                    checkForTrialAccount();
                }
            }



            // 2013-07-27 tortega - refresh tasks
            if (ViewState["LeadIds"] != null && int.TryParse(ViewState["LeadIds"].ToString(), out leadID) && leadID > 0)
            {
                //bindTasks();

                pnlTasks.Visible = true;

                //buildLeadMenu();

                showControls(true);
            }
            else
            {
                showControls(false);
            }

            if (Request.Params["t"] != null)
            {
                tabContainer.ActiveTabIndex = Convert.ToInt16(Request.Params["t"]);
            }
        }
        public DataAccessResponseType RemoveLabel(string accountNameKey, string labelName, string requesterId, RequesterType requesterType, string sharedClientKey)
        {
            // Ensure the clients are certified.
            if (sharedClientKey != Sahara.Core.Platform.Requests.RequestManager.SharedClientKey)
            {
                return(null);
            }

            //Get ACCOUNT
            var account = AccountManager.GetAccount(accountNameKey, true, AccountManager.AccountIdentificationType.AccountName);

            #region Validate Request

            var requesterName  = string.Empty;
            var requesterEmail = string.Empty;

            var requestResponseType = RequestManager.ValidateRequest(requesterId,
                                                                     requesterType, out requesterName, out requesterEmail,
                                                                     Sahara.Core.Settings.Platform.Users.Authorization.Roles.Manager,
                                                                     Sahara.Core.Settings.Accounts.Users.Authorization.Roles.Manager);

            if (!requestResponseType.isApproved)
            {
                //Request is not approved, send results:
                return(new DataAccessResponseType {
                    isSuccess = false, ErrorMessage = requestResponseType.requestMessage
                });
            }

            #endregion

            var result = LeadsManager.RemoveLabel(account, labelName);

            #region Log Account Activity

            /*
             * if (result.isSuccess)
             * {
             *  try
             *  {
             *
             *      //Object Log ---------------------------
             *      AccountLogManager.LogActivity(
             *          accountId,
             *          CategoryType.Inventory,
             *          ActivityType.Inventory_PropertyCreated,
             *          "Property '" + propertyName + "' created",
             *          requesterName + " created '" + propertyName + "' property",
             *          requesterId,
             *          requesterName,
             *          requesterEmail,
             *          null,
             *          null,
             *          result.SuccessMessage);
             *  }
             *  catch { }
             * }
             */
            #endregion


            return(result);
        }
Example #18
0
        protected void bindData()
        {
            int invoiceID = 0;
            int policyID  = 0;

            CRM.Data.Entities.LeadInvoice invoice        = null;
            List <LeadInvoiceDetail>      invoiceDetails = null;

            // get id for current lead
            int leadID = Core.SessionHelper.getLeadId();

            // get client id
            int clientID = Core.SessionHelper.getClientId();

            // get current policy
            policyID = Core.SessionHelper.getPolicyID();

            // check for new invoice or edit invoice
            ViewState["InvoiceID"] = Request.Params["id"] == null ? "0" : Request.Params["id"].ToString();

            int.TryParse(ViewState["InvoiceID"].ToString(), out invoiceID);

            // get lead/claim
            Leads lead = LeadsManager.Get(leadID);

            if (lead != null)
            {
                bindBillTo(lead);

                lblClient.Text = string.Format("<b>{0} {1}<br/>{2}<br/>{3}<br/>{4}, {5} {6}</b>",
                                               lead.ClaimantFirstName ?? "", //0
                                               lead.ClaimantLastName ?? "",  //1
                                               lead.LossAddress ?? "",       //2
                                               lead.LossAddress2 ?? "",      //3
                                               lead.CityName ?? "",          //4
                                               lead.StateName ?? "",         // 5
                                               lead.Zip ?? ""                //6
                                               );
            }


            if (invoiceID == 0)
            {
                // new invoice
                txtInvoiceDate.Text = DateTime.Now.ToShortDateString();

                invoiceDetails = new List <LeadInvoiceDetail>();
                invoiceDetails.Add(new LeadInvoiceDetail());

                gvInvoiceLines.DataSource = invoiceDetails;

                gvInvoiceLines.DataBind();


                // hide empty row
                gvInvoiceLines.Rows[0].Visible = false;

                // hide print button
                //btnPrint.Visible = false;

                // hiden invoice number
                pnlInvoiceNumber.Visible = false;
            }
            else
            {
                // edit invoice
                invoice = LeadInvoiceManager.Get(invoiceID);

                // show print button
                //btnPrint.Visible = true;

                if (invoice != null && invoice.LeadInvoiceDetail != null)
                {
                    txtInvoiceDate.Text = string.Format("{0:MM/dd/yyyy}", invoice.InvoiceDate);
                    txtDueDate.Text     = string.Format("{0:MM/dd/yyyy}", invoice.DueDate);

                    txtBillTo.Text         = invoice.BillToName;
                    txtBillToAddress1.Text = invoice.BillToAddress1;
                    txtBillToAddress2.Text = invoice.BillToAddress2;
                    txtBillToAddress3.Text = invoice.BillToAddress3;

                    // reference
                    txtReferenceNumber.Text = invoice.AdjusterInvoiceNumber;

                    // show total
                    txtTotalAmount.Text = string.Format("{0:N2}", invoice.TotalAmount);


                    // sort line items by date
                    gvInvoiceLines.DataSource = invoice.LeadInvoiceDetail.OrderBy(x => x.LineDate);

                    gvInvoiceLines.DataBind();

                    // show invoice numebr
                    pnlInvoiceNumber.Visible = true;


                    txtInvoiceNumber.Text = string.Format("{0:N0}", invoice.InvoiceNumber ?? 0);
                }
            }


            bindInvoiceServices();
        }
Example #19
0
        protected void btnGenerateRepLetter_Click(object sender, EventArgs e)
        {
            int LeadId = Convert.ToInt32(hfLeadsId.Value);

            if (LeadId > 0)
            {
                var _leads = LeadsManager.GetByLeadId(LeadId);

                if (!validateForm((Leads)_leads))
                {
                    lblError.Text    = "All or some of the Insurance Information is missing. Please verify information.";
                    lblError.Visible = true;
                    return;
                }

                string InsurancecompanyName = null;            // _leads.InsuranceCompanyName == null ? "" : _leads.InsuranceCompanyName.ToString();
                string InsuranceContactName = null;            // _leads.InsuranceContactName == null ? "" : _leads.InsuranceContactName.ToString();
                string InsuranceAddress     = null;            // _leads.InsuranceAddress == null ? "" : _leads.InsuranceAddress.ToString();
                string iCity = _leads.CityMaster == null ? "" : _leads.CityMaster.CityName;

                string iState = "";
                if (_leads.StateMaster != null)
                {
                    iState = _leads.StateMaster.StateCode == null ? "" : _leads.StateMaster.StateCode.ToString();
                }
                string zip            = _leads.Zip == null ? "" : _leads.Zip.ToString();
                string izip           = null;      // leads.InsuranceZipCode == null ? "" : _leads.InsuranceZipCode;
                string insfulladdress = iState + " " + zip;

                string _firstName      = _leads.ClaimantFirstName == null ? "" : _leads.ClaimantFirstName.ToString();
                string _lastName       = _leads.ClaimantLastName == null ? "" : _leads.ClaimantLastName.ToString();
                string Claimant_Name   = _firstName + ' ' + _lastName;
                string BusinessName    = _leads.BusinessName == null ? "" : _leads.BusinessName.ToString();
                string ClaimantAddress = _leads.LossAddress == null ? "" : _leads.LossAddress.ToString();

                string City  = _leads.CityMaster == null ? "" : _leads.CityMaster.CityName;
                string State = "";
                if (_leads.StateMaster != null)
                {
                    State = _leads.StateMaster.StateCode == null ? "" : _leads.StateMaster.StateCode;
                }

                string fulladdress = State + " " + izip;

                string policy = null;                // _leads.InsurancePolicyNumber == null ? "" : _leads.InsurancePolicyNumber.ToString();



                StringBuilder sb = new StringBuilder();

                string url = string.Empty;
                url = "http://demo.claimruler.com/images/claim_ruler_logo.jpg";
                //url = "http://csg.sandyclaims.org/images/lg.jpg";
                //url = Request.PhysicalApplicationPath + "Images/lg.jpg";



                //string url = string.Empty;
                //string domain1;
                //Uri urls = HttpContext.Current.Request.Url;
                //domain1 = urls.AbsoluteUri.Replace(urls.PathAndQuery, string.Empty);
                //url = domain1 + "/Images/";

                sb.Append("<html>");
                sb.Append("<head>");
                //sb.Append("<style type='text/css'>");
                //sb.Append("body {margin:5%;width:90%;}");
                //sb.Append("</style>");
                sb.Append("</head>");
                sb.Append("<body  >");
                sb.Append("<form>");
                sb.Append("<div align='center'>");
                //sb.Append("<p style='width: 20px; height: 20px;'><img src='" + url + "lg.jpg' style='height: 20px; width: 20px' /></p>");
                sb.Append("<p style='width: 20px; height: 20px;'><img src='" + url + "' style='height: 20px; width: 20px' /></p>");
                sb.Append("<p style='font-family: Times New Roman; font-size: 14px;'>");
                sb.Append("401 East Las Olas Blvd #130-356<br />");
                sb.Append(" Fort Lauderdale, FL 33301");
                sb.Append("</p>");
                sb.Append("</div>");
                sb.Append("<div style='height: 25px'>");
                sb.Append(" &nbsp;</div>");
                sb.Append("<div style='text-align: center;'>");
                sb.Append("<p style='font-family: Times New Roman; font-size: 16px; font-weight: bold;'>");
                sb.Append("Notice of Representation and Lien on Claim</p>");
                sb.Append("</div>");
                sb.Append("<div style='font-family: Times New Roman; font-size: 16px;'>");
                sb.Append("" + DateTime.Now.Date.ToString("MMMM dd, yyyy") + "<br />");
                sb.Append("<br />");
                sb.Append("" + InsurancecompanyName + "<br />");
                sb.Append("" + InsuranceAddress + "<br />");
                sb.Append("" + City + ", " + fulladdress + "<br />");
                //sb.Append(""+insfulladdress+"<br />");
                //sb.Append("" + fulladdress + "<br />");

                // 2013-03-11 tortega
                sb.Append("<p>Insurance Company Contact:<br/>");
                //sb.Append(_leads.InsuranceContactName + "<br/>");
                //sb.Append(_leads.InsuranceContactPhone + "<br/>");
                //sb.Append(_leads.InsuranceContactEmail + "<br/>");
                sb.Append("</p>");

                sb.Append("</div>");
                sb.Append("<div style='height: 30px;'>");
                sb.Append("&nbsp;</div>");
                sb.Append("<div style='font-family: Times New Roman; margin-left: 35px; font-size: 16px;'>");
                sb.Append("<label style='font-weight: bold;'>");
                sb.Append("Re:&nbsp;&nbsp;</label>" + Claimant_Name + "<br/>");
                sb.Append(ClaimantAddress + "<br />");

                if (!string.IsNullOrEmpty(_leads.LossAddress2))
                {
                    sb.Append(_leads.LossAddress2 + "<br/>");
                }

                sb.Append(iCity + ", " + insfulladdress + "<br />");
                //sb.Append("" + fulladdress + "");
                //sb.Append("" + insfulladdress + "");

                sb.Append("</div>");
                sb.Append("<div style='font-family: Times New Roman; font-size: 16px;'>");
                sb.Append("<br />");
                sb.Append("<label style='font-weight: bold;'>");
                sb.Append("Insurance Co:&nbsp;&nbsp;</label>" + InsurancecompanyName);
                sb.Append("<br />");
                sb.Append("<label style='font-weight: bold;'>Policy #:&nbsp;&nbsp;</label>" + policy + "");
                sb.Append("<br />");
                sb.Append("<label style='font-weight: bold; margin-left:187px;'>Claim #:&nbsp;&nbsp;</label>" + _leads.ClaimsNumber);
                sb.Append("</div>");
                sb.Append("<div style='font-family: Times New Roman; font-size: 16px;'>");
                sb.Append("<p>");
                sb.Append("Please be advised that we represent the above named client with regard to damages and claim<br />");
                sb.Append("arising from Superstorm Sandy.  Attached is a copy of our Contract For Services.");
                sb.Append("</p>");

                // 2013-03-11 tortega
                sb.Append("<p>");
                sb.Append("Please be advised that Claims Strategies Group has a lien to the extent of its fees on all<br/>");
                sb.Append("proceeds and agreement with the client that it be named as a party on all payments.<br/>");
                sb.Append("The correct title of the company to be named is: <b>Claim Ruler Example Public Adjsuter</b>");
                sb.Append("</p>");

                sb.Append("<p>");
                sb.Append("At this time we have not completed our review of or estimate of the client’s claim.<br />");
                sb.Append("We understand that your adjuster has attended the property.  Please provide the following<br />");
                sb.Append("information at the earliest time:");
                sb.Append("</p>");
                sb.Append("<p style='margin-left:20px;'>");
                sb.Append("1&nbsp;&nbsp;&nbsp;A complete copy of the policy of insurance.<br />");
                sb.Append("2&nbsp;&nbsp;&nbsp;A complete copy of the application for insurance.<br />");
                sb.Append("3&nbsp;&nbsp;&nbsp;A complete copy of any estimates completed and photographs taken.<br />");
                sb.Append("4&nbsp;&nbsp;&nbsp;The name and contact information for your adjuster who will be appointed for any<br />");
                sb.Append("&nbsp;&nbsp;&nbsp;&nbsp;re-inspection necessary or the handling adjuster so we may correspond further.");

                sb.Append("</p>");
                sb.Append("<p>");
                sb.Append("If you have any questions, please contact us:<br />");
                sb.Append("<br />");
                sb.Append("Thank you,");

                sb.Append("</p>");
                sb.Append("</div>");
                sb.Append("<div style='height:25px;'></div>");
                sb.Append("<div style='font-family: Times New Roman; font-size: 16px;'>");
                sb.Append("Jane Doe<br />");
                sb.Append("Claims Processor<br />");
                sb.Append("Office: +1 (732) 555-1212<br />");
                sb.Append("Fax +1 (866) 555-1212<br />");
                sb.Append("E-mail:<a href='#' >[email protected]</a><br />");
                sb.Append("Web: <a href='#' > http://www.examplepublicadjuster.com</a><br />");
                sb.Append("</div>");
                sb.Append("</form>");
                sb.Append("</body>");
                sb.Append("</html>");



                Response.AppendHeader("Content-Type", "application/msword");
                Response.AppendHeader("Content-disposition", "attachment; filename=Rep Letter .doc");
                Response.Write(sb);
            }
        }
Example #20
0
        //protected void bindBillTo(Lead lead) {
        //	ListItem billToItem = null;
        //	string itemValue = null;
        //	string claimantName = null;

        //	ddlBillTo.Items.Add(new ListItem("Select One", "0"));

        //	if (lead != null && lead.LeadPolicies != null && lead.LeadPolicies.Count > 0) {

        //		// add insurance company policy
        //		foreach (LeadPolicy policy in lead.LeadPolicies) {
        //			if (!string.IsNullOrEmpty(policy.InsuranceCompanyName)) {
        //				itemValue = string.Format("{0}|{1}", policy.PolicyType, policy.CarrierID ?? 0);

        //				billToItem = new ListItem(policy.InsuranceCompanyName, itemValue);

        //				ddlBillTo.Items.Add(billToItem);
        //			}
        //		}

        //		// add client mailing address as option
        //		claimantName = string.Format("{0} {1}", lead.ClaimantFirstName ?? "", lead.ClaimantLastName ?? "");

        //		itemValue = string.Format("{0}|{1}|{2}|{3}|{4}|{5}",
        //					1,			// homeowners
        //					claimantName,
        //					lead.MailingAddress ?? "",
        //					lead.MailingCity ?? "",
        //					lead.MailingState ?? "",
        //					lead.MailingZip ?? ""
        //					);
        //		ddlBillTo.Items.Add(new ListItem("Policyholder - Mailing Address", itemValue));

        //		// add client loss address as option
        //		claimantName = string.Format("{0} {1}", lead.ClaimantFirstName ?? "", lead.ClaimantLastName ?? "");

        //		itemValue = string.Format("{0}|{1}|{2}|{3}|{4}|{5}",
        //					1,			// homeowners
        //					claimantName,
        //					(lead.LossAddress ?? "") + (lead.LossAddress2 ?? ""),
        //					lead.CityName ?? "",
        //					lead.StateName ?? "",
        //					lead.Zip ?? ""
        //					);
        //		ddlBillTo.Items.Add(new ListItem("Policyholder - Loss Address", itemValue));
        //	}
        //}

        protected void bindData()
        {
            int    claimID      = 0;
            int    clientID     = 0;
            int    invoiceID    = 0;
            int    leadID       = 0;
            int    policyID     = 0;
            string dencryptedID = null;

            Invoice              invoice        = null;
            InvoiceDetail        invoiceDetail  = null;
            List <InvoiceDetail> invoiceDetails = null;

            // get id for current lead
            claimID = Core.SessionHelper.getClaimID();

            // get id for current lead
            leadID = Core.SessionHelper.getLeadId();

            // get client id
            clientID = Core.SessionHelper.getClientId();

            // get current policy
            policyID = Core.SessionHelper.getPolicyID();

            // check for new invoice or edit invoice
            if (Request.Params["q"] != null)
            {
                dencryptedID           = Core.SecurityManager.DecryptQueryString(Request.Params["q"].ToString());
                ViewState["InvoiceID"] = dencryptedID;
            }
            else
            {
                ViewState["InvoiceID"] = "0";
            }


            int.TryParse(ViewState["InvoiceID"].ToString(), out invoiceID);

            // get lead/claim
            Leads lead = LeadsManager.GetByLeadId(leadID);

            // get policy type
            lblPolicyType.Text = LeadPolicyManager.GetPolicyTypeDescription(policyID);

            // get policy number
            lblPolicyNumber.Text = LeadPolicyManager.GetPolicyNumber(policyID);

            // get insurer claim number
            lblInsurerClaimNumber.Text = ClaimsManager.getInsurerClaimNumber(claimID);

            // get policy information
            if (lead != null)
            {
                lblClient.Text = string.Format("<b>{0} {1}<br/>{2}<br/>{3}<br/>{4}, {5} {6}</b>",
                                               lead.ClaimantFirstName ?? "",            //0
                                               lead.ClaimantLastName ?? "",             //1
                                               lead.LossAddress ?? "",                  //2
                                               lead.LossAddress2 ?? "",                 //3
                                               lead.CityName ?? "",                     //4
                                               lead.StateName ?? "",                    //5
                                               lead.Zip ?? ""                           //6
                                               );
            }



            if (invoiceID == 0)
            {
                // new invoice
                txtInvoiceDate.Text = DateTime.Now.ToShortDateString();

                invoiceDetail          = new InvoiceDetail();
                invoiceDetail.LineDate = DateTime.Now;

                invoiceDetails = new List <InvoiceDetail>();
                invoiceDetails.Add(invoiceDetail);

                gvInvoiceLines.DataSource = invoiceDetails;

                gvInvoiceLines.DataBind();


                // hide empty row
                gvInvoiceLines.Rows[0].Visible = false;

                // hide print button
                //btnPrint.Visible = false;

                // hiden invoice number
                //pnlInvoiceNumber.Visible = false;
            }
            else
            {
                // edit invoice
                invoice = InvoiceManager.Get(invoiceID);

                // show print button
                //btnPrint.Visible = true;

                if (invoice != null && invoice.InvoiceDetail != null)
                {
                    txtInvoiceDate.Text = string.Format("{0:MM/dd/yyyy}", invoice.InvoiceDate);
                    txtDueDate.Text     = string.Format("{0:MM/dd/yyyy}", invoice.DueDate);

                    txtBillTo.Text         = invoice.BillToName;
                    txtBillToAddress1.Text = invoice.BillToAddress1;
                    txtBillToAddress2.Text = invoice.BillToAddress2;
                    txtBillToAddress3.Text = invoice.BillToAddress3;

                    // reference
                    txtReferenceNumber.Text = (invoice.InvoiceNumber ?? 0).ToString();

                    // show total
                    txtTotalAmount.Text = string.Format("{0:N2}", invoice.TotalAmount);


                    // sort line items by date
                    gvInvoiceLines.DataSource = invoice.InvoiceDetail.OrderBy(x => x.LineDate);

                    gvInvoiceLines.DataBind();

                    // show invoice numebr
                    //pnlInvoiceNumber.Visible = true;


                    txtInvoiceNumber.Text = string.Format("{0:N0}", invoice.InvoiceNumber ?? 0);
                }
            }


            bindInvoiceServices();
        }
        protected void btnSend_Click(object sender, EventArgs e)
        {
            string[] attachments = null;
            int      clientID    = 0;

            string[]      recipient = null;
            List <string> emails    = null;

            CRM.Data.Entities.SecUser user = null;
            string decryptedPassword       = null;

            string fromEmail = null;
            string subject   = txtEmailSubject.Text.Trim();
            string bodyText  = txtEmailText.Text.Trim();

            user = SecUserManager.GetByUserId(SessionHelper.getUserId());

            if (user == null)
            {
                return;
            }

            int roleID = SessionHelper.getUserRoleId();

            if (roleID == (int)UserRole.Client || roleID == (int)UserRole.SiteAdministrator)
            {
                clientID = SessionHelper.getClientId();

                emails = LeadsManager.GetLeadEmails(clientID);
            }
            else
            {
                emails = LeadsManager.GetLeadEmails();
            }

            fromEmail          = user.Email;
            txtEmailText.Text += "\n\n" + user.emailSignature ?? "";

            decryptedPassword = Core.SecurityManager.Decrypt(user.emailPassword);

            if (fileUpload.HasFile && fileUpload.PostedFile.ContentLength > 0)
            {
                attachments = new string[] { Path.GetFullPath(fileUpload.PostedFile.FileName) };
            }

            if (emails != null && emails.Count > 0)
            {
                try {
                    foreach (string email in emails)
                    {
                        recipient = new string[] { email };

                        Core.EmailHelper.sendEmail(fromEmail, recipient, null, subject, bodyText, attachments, user.Email, decryptedPassword);
                    }
                    lblMessage.Text     = "Email broadcast complete.";
                    lblMessage.CssClass = "ok";
                }
                catch (Exception ex) {
                    lblMessage.Text     = "Email broadcast failed.";
                    lblMessage.CssClass = "error";
                }
            }
        }
Example #22
0
        //protected void saveCoverages(int policyID) {
        //	LeadPolicyCoverage coverage = null;
        //	decimal deductible = 0;

        //	foreach (GridViewRow row in gvCoverages.Rows) {
        //		if (row.RowType == DataControlRowType.DataRow) {
        //			TextBox txtCoverage = row.FindControl("txtCoverage") as TextBox;
        //			TextBox txtLimit = row.FindControl("txtLimit") as TextBox;
        //			WebTextEditor txtDeductible = row.FindControl("txtDeductible") as WebTextEditor;
        //			TextBox txtCoinsuranceForm = row.FindControl("txtCoinsuranceForm") as TextBox;

        //			// skip empty rows
        //			if (string.IsNullOrEmpty(txtCoverage.Text) && string.IsNullOrEmpty(txtLimit.Text) && string.IsNullOrEmpty(txtDeductible.Text))
        //				continue;

        //			coverage = new LeadPolicyCoverage();

        //			coverage.LeadPolicyID = policyID;
        //			decimal.TryParse(txtDeductible.Text, out deductible);
        //			coverage.Deductible = deductible;
        //			coverage.Description = txtCoverage.Text.Trim();

        //			LeadPolicyCoverageManager.Save(coverage);

        //		}
        //	}
        //}

        protected Leads saveLead()
        {
            Leads          lead     = new Leads();
            AdjusterMaster adjuster = null;

            lead.ClientID = clientID;
            lead.UserId   = userID;
            lead.Status   = 1;

            //if (roleID == (int)UserRole.Adjuster) {
            //	// assign adjuster
            //	adjuster = AdjusterManager.GetAdjusterByUserID(userID);
            //	if (adjuster != null)
            //		lead.Adjuster = adjuster.AdjusterId;
            //}

            lead.ClaimantFirstName = txtInsuredFirstName.Text.Trim();
            lead.ClaimantLastName  = txtInsuredLastName.Text.Trim();

            #region insured loss address
            lead.LossAddress  = txtInsuredLossAddressLine.Text.Trim();
            lead.LossAddress2 = txtInsuredLossAddressLine2.Text.Trim();

            if (ddlInsuredLossState.SelectedIndex > 0)
            {
                lead.StateId   = Convert.ToInt32(ddlInsuredLossState.SelectedValue);
                lead.StateName = ddlInsuredLossState.SelectedItem.Text;
            }

            if (this.ddlInsuredLossCity.SelectedIndex > 0)
            {
                lead.CityId   = Convert.ToInt32(ddlInsuredLossCity.SelectedValue);
                lead.CityName = ddlInsuredLossCity.SelectedItem.Text;
            }

            if (this.ddlInsuredLossZipCode.SelectedIndex > 0)
            {
                lead.Zip = ddlInsuredLossZipCode.SelectedItem.Text;
            }
            #endregion

            #region insured mailing address
            lead.MailingAddress = txtInsuredMailingAddress.Text.Trim();

            if (ddlInsuredMailingCity.SelectedIndex > 0)
            {
                lead.MailingCity = ddlInsuredMailingCity.SelectedItem.Text;
            }

            if (ddlInsuredMailingState.SelectedIndex > 0)
            {
                lead.MailingState = ddlInsuredMailingState.SelectedItem.Text;
            }

            if (ddlInsuredMailingZipCode.SelectedIndex > 0)
            {
                lead.MailingZip = ddlInsuredMailingZipCode.SelectedItem.Text;
            }
            #endregion

            lead.OriginalLeadDate = DateTime.Now;
            lead.PhoneNumber      = txtInsuredPhone.Text.Trim();
            lead.EmailAddress     = txtInsuredEmail.Text.Trim();
            lead.SecondaryPhone   = txtInsuredFax.Text.Trim();

            if (ddlTypeOfProperty.SelectedIndex > 0)
            {
                lead.TypeOfProperty = Convert.ToInt32(ddlTypeOfProperty.SelectedValue);
            }

            #region damage type
            string Damagetxt = string.Empty;
            string DamageId  = string.Empty;
            for (int j = 0; j < chkTypeOfDamage.Items.Count; j++)
            {
                if (chkTypeOfDamage.Items[j].Selected == true)
                {
                    Damagetxt += chkTypeOfDamage.Items[j].Text + ',';
                    DamageId  += chkTypeOfDamage.Items[j].Value + ',';
                }
            }
            if (Damagetxt != string.Empty && DamageId != string.Empty)
            {
                lead.TypeOfDamage     = DamageId;
                lead.TypeofDamageText = Damagetxt;
            }
            #endregion

            lead = LeadsManager.Save(lead);

            return(lead);
        }
Example #23
0
        private Leads createLead(DataRow dataRow)
        {
            Leads  lead          = null;
            string userFieldName = null;
            int    clientID      = SessionHelper.getClientId();
            int    userID        = SessionHelper.getUserId();
            string insuredName   = null;
            string strValue      = null;

            // insured name
            userFieldName = Core.CSVHelper.getUserFieldName(this.mappedFields, "Insured Name");

            if (!string.IsNullOrEmpty(userFieldName) && dataRow[userFieldName] != null)
            {
                insuredName = dataRow[userFieldName].ToString().Trim();
            }

            if (string.IsNullOrEmpty(insuredName))
            {
                return(null);
            }

            lead                  = new Leads();
            lead.ClientID         = clientID;
            lead.UserId           = userID;
            lead.Status           = 1;
            lead.OriginalLeadDate = DateTime.Now;

            lead.InsuredName = insuredName;

            // mailing address 1
            userFieldName = Core.CSVHelper.getUserFieldName(this.mappedFields, "Mailing Address");
            if (!string.IsNullOrEmpty(userFieldName) && dataRow[userFieldName] != null)
            {
                strValue = dataRow[userFieldName].ToString().Trim();

                lead.MailingAddress = strValue.Length > 50 ? strValue.Substring(0, 50) : strValue;
                lead.LossAddress    = lead.MailingAddress;
            }

            // mailing address 2
            userFieldName = Core.CSVHelper.getUserFieldName(this.mappedFields, "Mailing Address2");
            if (!string.IsNullOrEmpty(userFieldName) && dataRow[userFieldName] != null)
            {
                strValue = dataRow[userFieldName].ToString().Trim();

                lead.MailingAddress2 = strValue.Length > 50 ? strValue.Substring(0, 50) : strValue;
                lead.LossAddress2    = lead.MailingAddress2;
            }

            // mailing city
            userFieldName = Core.CSVHelper.getUserFieldName(this.mappedFields, "Mailing City");
            if (!string.IsNullOrEmpty(userFieldName) && dataRow[userFieldName] != null)
            {
                strValue = dataRow[userFieldName].ToString().Trim();

                lead.MailingCity = strValue.Length > 50 ? strValue.Substring(0, 50) : strValue;
                lead.CityName    = lead.MailingCity;
            }

            // mailing state
            userFieldName = Core.CSVHelper.getUserFieldName(this.mappedFields, "Mailing State");
            if (!string.IsNullOrEmpty(userFieldName) && dataRow[userFieldName] != null)
            {
                strValue = dataRow[userFieldName].ToString().Trim();

                lead.MailingState = strValue.Length > 20 ? strValue.Substring(0, 20) : strValue;
                lead.StateName    = lead.MailingState;
            }

            // mailing zip
            userFieldName = Core.CSVHelper.getUserFieldName(this.mappedFields, "Mailing Zip");
            if (!string.IsNullOrEmpty(userFieldName) && dataRow[userFieldName] != null)
            {
                strValue = dataRow[userFieldName].ToString().Trim();

                lead.MailingZip = strValue.Length > 10 ? strValue.Substring(0, 10) : strValue;
                lead.Zip        = lead.MailingZip;
            }

            // mailing county
            userFieldName = Core.CSVHelper.getUserFieldName(this.mappedFields, "Mailing County");
            if (!string.IsNullOrEmpty(userFieldName) && dataRow[userFieldName] != null)
            {
                strValue = dataRow[userFieldName].ToString().Trim();

                lead.MailingCounty = strValue.Length > 50 ? strValue.Substring(0, 50) : strValue;
                lead.LossCounty    = lead.MailingCounty;
            }

            // Business Phone Number
            userFieldName = Core.CSVHelper.getUserFieldName(this.mappedFields, "Business Phone Number");
            if (!string.IsNullOrEmpty(userFieldName) && dataRow[userFieldName] != null)
            {
                strValue            = dataRow[userFieldName].ToString().Trim();
                lead.SecondaryPhone = strValue.Length > 35 ? strValue.Substring(0, 35) : strValue;
            }

            // Home Phone Number
            userFieldName = Core.CSVHelper.getUserFieldName(this.mappedFields, "Home Phone Number");
            if (!string.IsNullOrEmpty(userFieldName) && dataRow[userFieldName] != null)
            {
                strValue         = dataRow[userFieldName].ToString().Trim();
                lead.PhoneNumber = strValue.Length > 35 ? strValue.Substring(0, 35) : strValue;
            }

            lead = LeadsManager.Save(lead);

            return(lead);
        }
Example #24
0
        public void bindData(int invoiceID)
        {
            int                  claimID        = 0;
            int                  clientID       = 0;
            int                  leadID         = 0;
            int                  policyID       = 0;
            Claim                claim          = null;
            Invoice              invoice        = null;
            InvoiceDetail        invoiceDetail  = null;
            Leads                lead           = null;
            List <InvoiceDetail> invoiceDetails = null;

            // save invoice id
            ViewState["InvoiceID"] = invoiceID.ToString();

            invoice = InvoiceManager.Get(invoiceID);

            if (invoice != null)
            {
                claimID = invoice.ClaimID;
                claim   = ClaimsManager.Get(claimID);

                policyID = claim.PolicyID;

                leadID = claim.LeadPolicy.Leads.LeadId;
                lead   = claim.LeadPolicy.Leads;

                clientID = (int)lead.ClientID;

                // get policy type
                if (claim.LeadPolicy != null && claim.LeadPolicy.LeadPolicyType != null)
                {
                    lblPolicyType.Text = claim.LeadPolicy.LeadPolicyType.Description;
                }

                // get policy number
                if (claim.LeadPolicy != null)
                {
                    lblPolicyNumber.Text = claim.LeadPolicy.PolicyNumber;
                }

                // get insurer claim number
                lblInsurerClaimNumber.Text = claim.InsurerClaimNumber;
            }
            else
            {
                // new invoice
                // get id for current lead
                claimID = Core.SessionHelper.getClaimID();

                // get id for current lead
                leadID = Core.SessionHelper.getLeadId();

                // get client id
                clientID = Core.SessionHelper.getClientId();

                // get current policy
                policyID = Core.SessionHelper.getPolicyID();

                // get lead/claim
                lead = LeadsManager.GetByLeadId(leadID);

                // get policy type
                lblPolicyType.Text = LeadPolicyManager.GetPolicyTypeDescription(policyID);

                // get policy number
                lblPolicyNumber.Text = LeadPolicyManager.GetPolicyNumber(policyID);

                // get insurer claim number
                lblInsurerClaimNumber.Text = ClaimsManager.getInsurerClaimNumber(claimID);
            }


            // get policy information
            if (lead != null)
            {
                lblClient.Text = string.Format("<b>{0} {1}<br/>{2}<br/>{3}<br/>{4}, {5} {6}</b>",
                                               lead.ClaimantFirstName ?? "",            //0
                                               lead.ClaimantLastName ?? "",             //1
                                               lead.LossAddress ?? "",                  //2
                                               lead.LossAddress2 ?? "",                 //3
                                               lead.CityName ?? "",                     //4
                                               lead.StateName ?? "",                    //5
                                               lead.Zip ?? ""                           //6
                                               );
            }

            if (invoiceID == 0)
            {
                // new invoice
                txtInvoiceDate.Text = DateTime.Now.ToShortDateString();

                invoiceDetail          = new InvoiceDetail();
                invoiceDetail.LineDate = DateTime.Now;

                invoiceDetails = new List <InvoiceDetail>();
                invoiceDetails.Add(invoiceDetail);

                gvInvoiceLines.DataSource = invoiceDetails;

                gvInvoiceLines.DataBind();


                // hide empty row
                gvInvoiceLines.Rows[0].Visible = false;

                // hide print button
                //btnPrint.Visible = false;

                // hiden invoice number
                //pnlInvoiceNumber.Visible = false;
            }
            else
            {
                // edit invoice

                // show print button
                btnPrint.Visible  = true;
                lbtnEmail.Visible = true;

                if (invoice != null && invoice.InvoiceDetail != null)
                {
                    txtInvoiceDate.Text = string.Format("{0:MM/dd/yyyy}", invoice.InvoiceDate);
                    txtDueDate.Text     = string.Format("{0:MM/dd/yyyy}", invoice.DueDate);

                    txtBillTo.Text         = invoice.BillToName;
                    txtBillToAddress1.Text = invoice.BillToAddress1;
                    txtBillToAddress2.Text = invoice.BillToAddress2;
                    txtBillToAddress3.Text = invoice.BillToAddress3;

                    // reference
                    txtReferenceNumber.Text = (invoice.InvoiceNumber ?? 0).ToString();

                    // show total
                    txtTotalAmount.Text = string.Format("{0:N2}", invoice.TotalAmount);


                    // sort line items by date
                    gvInvoiceLines.DataSource = invoice.InvoiceDetail.OrderBy(x => x.LineDate);

                    gvInvoiceLines.DataBind();

                    // show invoice numebr
                    //pnlInvoiceNumber.Visible = true;


                    txtInvoiceNumber.Text = string.Format("{0:N0}", invoice.InvoiceNumber ?? 0);
                }
            }


            bindInvoiceServices();

            contractGrid.DataBind();
        }
Example #25
0
        public void SortGrid(string expression, bool fromSort, string Grid)
        {
            int userLead  = Convert.ToInt32(Session["UserId"]);
            var predicate = PredicateBuilder.True <CRM.Data.Entities.Leads>();

            if (!String.IsNullOrWhiteSpace(hfFromDate.Value))
            {
                DateTime sDate = new DateTime(Convert.ToInt32(hfFromDate.Value.Trim().Substring(6, 4)), Convert.ToInt32(hfFromDate.Value.Trim().Substring(3, 2)), Convert.ToInt32(hfFromDate.Value.Trim().Substring(0, 2)));

                var datefrom = Convert.ToDateTime(sDate);
                predicate = predicate.And(Lead => Lead.OriginalLeadDate >= datefrom
                                          );
            }
            if (!String.IsNullOrWhiteSpace(hfToDate.Value))
            {
                DateTime sDate = new DateTime(Convert.ToInt32(hfToDate.Value.Trim().Substring(6, 4)), Convert.ToInt32(hfToDate.Value.Trim().Substring(3, 2)), Convert.ToInt32(hfToDate.Value.Trim().Substring(0, 2)));

                var dateto = Convert.ToDateTime(sDate);
                predicate = predicate.And(Lead => Lead.OriginalLeadDate <= dateto
                                          );
            }


            predicate = predicate.And(Lead => Lead.Status != 0);
            if (Grid == "gvUser")
            {
                predicate = predicate.And(Lead => Lead.UserId == userLead);
            }
            else
            {
                predicate = predicate.And(Lead => Lead.UserId == 0);
            }
            var objLead1 = LeadsManager.GetPredicate(predicate).ToList().AsEnumerable();

            string sortExpression = expression;
            string direction      = string.Empty;

            if (fromSort)
            {
                if (SortDirection == SortDirection.Ascending)
                {
                    SortDirection = SortDirection.Descending;
                }
                else
                {
                    SortDirection = SortDirection.Ascending;
                }
            }


            if (SortDirection == SortDirection.Ascending)
            {
                if (objLead1 != null)
                {
                    switch (expression)
                    {
                    case "SecUser.UserName":
                        objLead1 = objLead1.OrderBy(x => x.SecUser != null ? x.SecUser.UserName : "").ToList();
                        break;

                    case "OriginalLeadDate":
                        objLead1 = objLead1.OrderBy(x => x.OriginalLeadDate).ToList();
                        break;

                    case "ClaimsNumber":
                        objLead1 = objLead1.OrderBy(x => x.ClaimsNumber).ToList();
                        break;
                    //////////////////////////////////////
                    //case "StatusMaster.StatusName":

                    //	objLead1 = objLead1.OrderBy(x => x.StatusMaster != null ? x.StatusMaster.StatusName : "").ToList();
                    //	break;
                    //case "SubStatusMaster.SubStatusName":
                    //	objLead1 = objLead1.OrderBy(x => x.SubStatusMaster != null ? x.SubStatusMaster.SubStatusName : "").ToList();
                    //	break;
                    case "SiteSurveyDate":
                        objLead1 = objLead1.OrderBy(x => x.SiteSurveyDate).ToList();
                        break;

                    //case "AllDocumentsOnFile":
                    //	objLead1 = objLead1.OrderBy(x => x.AllDocumentsOnFile).ToList();
                    //	break;
                    case "ClaimantFirstName":
                        objLead1 = objLead1.OrderBy(x => x.ClaimantFirstName).ToList();
                        break;

                    case "ClaimantLastName":
                        objLead1 = objLead1.OrderBy(x => x.ClaimantLastName).ToList();
                        break;

                    case "CityMaster_1.CityName":
                        objLead1 = objLead1.OrderBy(x => x.CityMaster != null ? x.CityMaster.CityName : "").ToList();
                        break;

                    case "StateMaster1.StateCode":
                        objLead1 = objLead1.OrderBy(x => x.StateMaster != null ? x.StateMaster.StateCode : "").ToList();
                        break;

                    case "Zip":
                        objLead1 = objLead1.OrderBy(x => x.Zip).ToList();
                        break;

                    case "LeadSourceMaster.LeadSourceName":
                        objLead1 = objLead1.OrderBy(x => x.LeadSourceMaster != null ? x.LeadSourceMaster.LeadSourceName : "").ToList();
                        break;

                    case "TypeOfDamageText":
                        objLead1 = objLead1.OrderBy(x => x.TypeofDamageText).ToList();
                        break;

                    case "TypeOfPropertyMaster.TypeOfProperty":
                        objLead1 = objLead1.OrderBy(x => x.TypeOfPropertyMaster != null ? x.TypeOfPropertyMaster.TypeOfProperty : "").ToList();
                        break;
                    }
                }
            }
            else
            {
                if (objLead1 != null)
                {
                    switch (expression)
                    {
                    case "SecUser.UserName":

                        objLead1 = objLead1.OrderByDescending(x => x.SecUser != null ? x.SecUser.UserName : "").ToList();
                        break;

                    case "OriginalLeadDate":
                        objLead1 = objLead1.OrderByDescending(x => x.OriginalLeadDate).ToList();
                        break;

                    case "ClaimsNumber":
                        objLead1 = objLead1.OrderByDescending(x => x.ClaimsNumber).ToList();
                        break;

                    //case "StatusMaster.StatusName":
                    //	objLead1 = objLead1.OrderByDescending(x => x.StatusMaster != null ? x.StatusMaster.StatusName : "").ToList();
                    //	break;
                    //case "SubStatusMaster.SubStatusName":
                    //	objLead1 = objLead1.OrderByDescending(x => x.SubStatusMaster != null ? x.SubStatusMaster.SubStatusName : "").ToList();
                    //	break;
                    case "SiteSurveyDate":
                        objLead1 = objLead1.OrderByDescending(x => x.SiteSurveyDate).ToList();
                        break;

                    //case "AllDocumentsOnFile":
                    //	objLead1 = objLead1.OrderByDescending(x => x.AllDocumentsOnFile).ToList();
                    //	break;
                    case "ClaimantFirstName":
                        objLead1 = objLead1.OrderByDescending(x => x.ClaimantFirstName).ToList();
                        break;

                    case "ClaimantLastName":
                        objLead1 = objLead1.OrderByDescending(x => x.ClaimantLastName).ToList();
                        break;

                    case "CityMaster_1.CityName":
                        objLead1 = objLead1.OrderByDescending(x => x.CityMaster != null ? x.CityMaster.CityName : "").ToList();
                        break;

                    case "StateMaster1.StateCode":
                        objLead1 = objLead1.OrderByDescending(x => x.StateMaster != null ? x.StateMaster.StateCode : "").ToList();
                        break;

                    case "Zip":
                        objLead1 = objLead1.OrderByDescending(x => x.Zip).ToList();
                        break;

                    case "LeadSourceMaster.LeadSourceName":
                        objLead1 = objLead1.OrderByDescending(x => x.LeadSourceMaster != null ? x.LeadSourceMaster.LeadSourceName : "").ToList();
                        break;

                    case "TypeOfDamageText":
                        objLead1 = objLead1.OrderByDescending(x => x.TypeofDamageText).ToList();
                        break;

                    case "TypeOfPropertyMaster.TypeOfProperty":
                        objLead1 = objLead1.OrderBy(x => x.TypeOfPropertyMaster != null ? x.TypeOfPropertyMaster.TypeOfProperty : "").ToList();
                        break;
                    }
                }
            }
            if (Grid == "gvUser")
            {
                gvUserLeads.DataSource = objLead1;
                gvUserLeads.DataBind();
            }
            else
            {
                grdAllLead.DataSource = objLead1;
                grdAllLead.DataBind();
            }
        }
 public LeadsController()
 {
     leadsManager = new LeadsManager();
     taskManager  = new CRM_Task_Manager();
 }
Example #27
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            lblError.Text      = string.Empty;
            lblError.Visible   = false;
            lblSave.Text       = string.Empty;
            lblSave.Visible    = false;
            lblMessage.Visible = false;
            lblMessage.Text    = string.Empty;
            try {
                bool  isnew   = false;
                Leads objLead = new Leads();
                if (hfLeadsId.Value == "0")
                {
                    isnew = true;
                }
                else
                {
                    objLead = LeadsManager.GetByLeadId(Convert.ToInt32(hfLeadsId.Value));
                }
                if (isnew)
                {
                }
                else
                {
                    /*New Fields*/
                    //objLead.hasInsurancePolicy = chkInsurancePolicy.Checked == true ? true : false;
                    //objLead.hasSignedRetainer = chkSignedRetainer.Checked == true ? true : false;
                    //objLead.hasDamageReport = chkDamageReport.Checked == true ? true : false;
                    //objLead.hasDamagePhoto = chkDamagePhoto.Checked == true ? true : false;
                    //objLead.hasCertifiedInsurancePolicy = chkCertifiedInsurancePolicy.Checked == true ? true : false;
                    //objLead.hasOwnerContract = chkOwnerContract.Checked == true ? true : false;
                    //objLead.hasContentList = chkContentList.Checked == true ? true : false;
                    //objLead.hasDamageEstimate = chkDamageEstimate.Checked == true ? true : false;
                    //if (chkInsurancePolicy.Checked == true && chkSignedRetainer.Checked == true && chkDamageReport.Checked == true && chkDamagePhoto.Checked == true &&
                    //    chkCertifiedInsurancePolicy.Checked == true && chkOwnerContract.Checked == true && chkContentList.Checked == true && chkDamageEstimate.Checked == true) {
                    //     objLead.AllDocumentsOnFile = true;
                    //}
                    //else {
                    //     objLead.AllDocumentsOnFile = false;
                    //}
                    /**/
                    Leads ins = LeadsManager.Save(objLead);

                    //if (ins.LeadId > 0) {
                    //	LeadLog objLeadlog = new LeadLog();
                    //	//objLeadlog.hasInsurancePolicy = chkInsurancePolicy.Checked == true ? true : false;
                    //	//objLeadlog.hasSignedRetainer = chkSignedRetainer.Checked == true ? true : false;
                    //	//objLeadlog.hasDamageReport = chkDamageReport.Checked == true ? true : false;
                    //	//objLeadlog.hasDamagePhoto = chkDamagePhoto.Checked == true ? true : false;
                    //	//objLeadlog.hasCertifiedInsurancePolicy = chkCertifiedInsurancePolicy.Checked == true ? true : false;
                    //	//objLeadlog.hasOwnerContract = chkOwnerContract.Checked == true ? true : false;
                    //	//objLeadlog.hasContentList = chkContentList.Checked == true ? true : false;
                    //	//objLeadlog.hasDamageEstimate = chkDamageEstimate.Checked == true ? true : false;
                    //	//if (chkInsurancePolicy.Checked == true && chkSignedRetainer.Checked == true && chkDamageReport.Checked == true && chkDamagePhoto.Checked == true &&
                    //	//    chkCertifiedInsurancePolicy.Checked == true && chkOwnerContract.Checked == true && chkContentList.Checked == true && chkDamageEstimate.Checked == true) {
                    //	//     objLeadlog.AllDocumentsOnFile = true;
                    //	//}
                    //	//else {
                    //	//     objLeadlog.AllDocumentsOnFile = false;
                    //	//}

                    //	/**/
                    //	LeadLog insLog = LeadsManager.SaveLeadLog(objLeadlog);
                    //	FillDocumentList(Convert.ToInt32(hfLeadsId.Value));
                    //	lblSave.Text = "Data Saved Sucessfully.";
                    //	lblSave.Visible = true;
                    //}
                }
            }
            catch (Exception ex) {
                lblError.Text    = "Data Not Saved.";
                lblError.Visible = true;
            }
        }
Example #28
0
        protected void emailDocumentLink(string finalReportPath, string emailTo)
        {
            int userID = Core.SessionHelper.getUserId();

            string bodyText = null;
            int    leadID   = Convert.ToInt32(Session["LeadIds"]);
            string password = null;
            int    port     = 0;

            string[] recipients = null;
            string   subject    = null;

            Leads  lead           = null;
            string encryptedQuery = null;

            System.Text.StringBuilder html = new System.Text.StringBuilder();

            CRM.Data.Entities.SecUser user = SecUserManager.GetByUserId(userID);
            if (user != null && user.Email != null && user.emailHost != null && user.emailHostPort != null)
            {
                if (string.IsNullOrEmpty(emailTo))
                {
                    recipients = new string[] { user.Email }
                }
                ;
                else
                {
                    recipients = emailTo.Split(new char[] { ',', ';' }, StringSplitOptions.RemoveEmptyEntries);
                }

                lead = LeadsManager.GetByLeadId(leadID);

                if (lead != null)
                {
                    encryptedQuery = Core.SecurityManager.EncryptQueryString(leadID.ToString());


                    subject = string.Format("{0} {1} wants to share {2} {3} Public Adjuster Claim File with you",
                                            user.FirstName, user.LastName, lead.ClaimantFirstName, lead.ClaimantLastName);

                    html.Append("<table cellpadding=\"0\" cellspacing=\"0\" style=\"border-left:1px #b9e1fb solid;border-right:1px #b9e1fb solid;border-bottom:1px #b9e1fb solid;border-top:1px #b9e1fb solid;border-radius:0px 0px 4px 4px\" border=\"0\" align=\"center\">");
                    html.Append("<tbody><tr><td colspan=\"3\" height=\"36\"></td></tr>");
                    html.Append("<tr><td width=\"36\"></td>");
                    html.Append("<td width=\"454\" style=\"font-size:14px;color:#444444;font-family:'Open Sans','Lucida Grande','Segoe UI',Arial,Verdana,'Lucida Sans Unicode',Tahoma,'Sans Serif';border-collapse:collapse\" align=\"left\" valign=\"top\">");


                    html.Append(string.Format("{0} {1} invited you to a Claim Ruler Software shared file called \"{2} {3}.\"",
                                              user.FirstName, user.LastName, lead.ClaimantFirstName, lead.ClaimantLastName));

                    string css = "border-radius:3px;border-left:1px #18639a solid;font-size:16px;border-bottom:1px #0f568b solid;padding:14px 7px 14px 7px;border-top:1px #2270ab solid;display:block;max-width:210px;font-family:'Open Sans','lucida grande','Segoe UI',arial,verdana,'lucida sans unicode',tahoma,sans-serif;text-align:center;background-image:-webkit-gradient(linear,0% 0%,0% 100%,from(rgb(55,163,235)),to(rgb(33,129,207)));width:210px;text-decoration:none;color:white;border-right:1px #18639a solid;font-weight:600;margin:0px auto 0px auto;background-color:#33a0e8";


                    html.Append(string.Format("<br/><br/><center><a style=\"{0}\" href=\"{1}/Temp/{2}.pdf\">View Report</a></center>",
                                              css, ConfigurationManager.AppSettings["appURL"], leadID));

                    html.Append(string.Format("<br/><br/><center><a style=\"{0}\" href=\"{1}/Content/SharedDocuments.aspx?q={2}\">View Files</a></center></td>",
                                              css, ConfigurationManager.AppSettings["appURL"], encryptedQuery));

                    html.Append("<td width='36'></td></tr><tr><td colspan='3' height='36'></td></tr></tbody></table>");

                    port = Convert.ToInt32(user.emailHostPort);

                    password = SecurityManager.Decrypt(user.emailPassword);

                    bodyText = html.ToString();

                    Core.EmailHelper.sendEmail(user.Email, recipients, null, subject, bodyText, null, user.emailHost, port, user.Email, password, user.isSSL ?? false);
                }
            }
        }
Example #29
0
        protected void grdAllLead_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            if (e.CommandName == "DoView")
            {
                this.Context.Items.Add("selectedleadid", e.CommandArgument.ToString());
                this.Context.Items.Add("view", "U");
                Server.Transfer("~/protected/admin/newlead.aspx");
            }
            if (e.CommandName == "DoEdit")
            {
                this.Context.Items.Add("selectedleadid", e.CommandArgument.ToString());
                this.Context.Items.Add("view", "");
                Server.Transfer("~/protected/admin/newlead.aspx");
            }
            if (e.CommandName == "DoCopy")
            {
                int LId = Convert.ToInt32(e.CommandArgument);
                try {
                    var   list    = LeadsManager.GetByLeadId(LId);
                    Leads objlead = new Leads();                    // CRM.Web.Utilities.cln.Clone(list);

                    //objlead.Adjuster = list.Adjuster;
                    //objlead.AllDocumentsOnFile = list.AllDocumentsOnFile;
                    objlead.BusinessName      = list.BusinessName;
                    objlead.CityId            = list.CityId;
                    objlead.ClaimantAddress   = list.ClaimantAddress;
                    objlead.ClaimantComments  = list.ClaimantComments;
                    objlead.ClaimantFirstName = list.ClaimantFirstName;
                    objlead.ClaimantLastName  = list.ClaimantLastName;
                    objlead.ClaimsNumber      = list.ClaimsNumber;
                    objlead.DateSubmitted     = list.DateSubmitted;
                    objlead.EmailAddress      = list.EmailAddress;
                    //objlead.FloodPolicy = list.FloodPolicy;
                    //objlead.Habitable = list.Habitable;
                    objlead.hasCertifiedInsurancePolicy = list.hasCertifiedInsurancePolicy;
                    objlead.hasContentList     = list.hasContentList;
                    objlead.hasDamageEstimate  = list.hasDamageEstimate;
                    objlead.hasDamagePhoto     = list.hasDamagePhoto;
                    objlead.hasDamageReport    = list.hasDamageReport;
                    objlead.hasInsurancePolicy = list.hasInsurancePolicy;
                    objlead.hasOwnerContract   = list.hasOwnerContract;
                    objlead.hasSignedRetainer  = list.hasSignedRetainer;
                    objlead.HearAboutUsDetail  = list.HearAboutUsDetail;
                    objlead.InspectorCell      = list.InspectorCell;
                    objlead.InspectorEmail     = list.InspectorEmail;
                    objlead.InspectorName      = list.InspectorName;
                    //objlead.InsuranceAddress = list.InsuranceAddress;
                    //objlead.InsuranceCity = list.InsuranceCity;
                    //objlead.InsuranceCompanyName = list.InsuranceCompanyName;
                    //objlead.InsuranceContactEmail = list.InsuranceContactEmail;
                    //objlead.InsuranceContactName = list.InsuranceContactName;
                    //objlead.InsuranceContactPhone = list.InsuranceContactPhone;
                    //objlead.InsurancePolicyNumber = list.InsurancePolicyNumber;
                    //objlead.InsuranceState = list.InsuranceState;
                    //objlead.InsuranceZipCode = list.InsuranceZipCode;
                    objlead.IsSubmitted     = list.IsSubmitted;
                    objlead.LastContactDate = list.LastContactDate;
                    // objlead.LeadComments = list.LeadComments;
                    objlead.LeadSource = list.LeadSource;
                    //objlead.LeadStatus = list.LeadStatus;
                    objlead.LFUUID                  = list.LFUUID;
                    objlead.LossAddress             = list.LossAddress;
                    objlead.MarketValue             = list.MarketValue;
                    objlead.OriginalLeadDate        = list.OriginalLeadDate;
                    objlead.OtherSource             = list.OtherSource;
                    objlead.OwnerFirstName          = list.OwnerFirstName;
                    objlead.OwnerLastName           = list.OwnerLastName;
                    objlead.OwnerPhone              = list.OwnerPhone;
                    objlead.OwnerSame               = list.OwnerSame;
                    objlead.PhoneNumber             = list.PhoneNumber;
                    objlead.PrimaryProducerId       = list.PrimaryProducerId;
                    objlead.PropertyDamageEstimate  = list.PropertyDamageEstimate;
                    objlead.ReporterToInsurer       = list.ReporterToInsurer;
                    objlead.SecondaryEmail          = list.SecondaryEmail;
                    objlead.SecondaryPhone          = list.SecondaryPhone;
                    objlead.SecondaryProducerId     = list.SecondaryProducerId;
                    objlead.SiteInspectionCompleted = list.SiteInspectionCompleted;
                    objlead.SiteLocation            = list.SiteLocation;
                    objlead.SiteSurveyDate          = list.SiteSurveyDate;
                    objlead.StateId                 = list.StateId;
                    objlead.Status                  = list.Status;
                    //objlead.SubStatus = list.SubStatus;
                    objlead.TypeOfDamage     = list.TypeOfDamage;
                    objlead.TypeofDamageText = list.TypeofDamageText;
                    objlead.TypeOfProperty   = list.TypeOfProperty;
                    objlead.UserId           = list.UserId;
                    objlead.WebformSource    = list.WebformSource;
                    //objlead.WindPolicy = list.WindPolicy;
                    objlead.Zip = list.Zip;

                    LeadsManager.Save(objlead);



                    lblSave.Text    = "Record Copyed Sucessfully.";
                    lblSave.Visible = true;
                    DoBind();
                }
                catch (Exception ex) {
                    lblError.Text    = "Record Not Copyed.";
                    lblError.Visible = true;
                }
            }
        }
Example #30
0
        protected void btnSave_click(object sender, EventArgs e)
        {
            int           userID        = 0;
            Leads         lead          = null;
            int           leadID        = 0;
            StringBuilder claimList     = new StringBuilder();
            int           transferCount = 0;

            userID = Convert.ToInt32(ddlUsers.SelectedValue);

            if (userID > 0)
            {
                try {
                    using (TransactionScope scope = new TransactionScope()) {
                        foreach (GridViewRow row in gvUserLeads.Rows)
                        {
                            if (row.RowType == DataControlRowType.DataRow)
                            {
                                CheckBox cbx = row.FindControl("cbxLead") as CheckBox;
                                if (cbx != null && cbx.Checked)
                                {
                                    leadID = (int)gvUserLeads.DataKeys[row.RowIndex].Value;

                                    lead = LeadsManager.GetByLeadId(leadID);

                                    if (lead != null)
                                    {
                                        lead.UserId = userID;

                                        LeadsManager.Save(lead);

                                        ++transferCount;

                                        claimList.Append(string.Format("<tr align=\"center\"><td>{0}</td>", lead.insuredName));
                                        claimList.Append(string.Format("<td>{0}</td>", lead.LossAddress ?? ""));
                                        claimList.Append(string.Format("<td>{0}</td>", lead.CityName ?? ""));
                                        claimList.Append(string.Format("<td>{0}</td>", lead.StateName ?? ""));
                                        claimList.Append(string.Format("<td>{0:MM/dd/yyyy}</td></tr>", lead.LossDate));
                                    }
                                }
                            }
                        }                         //	foreach

                        scope.Complete();
                    }                           // using

                    // send email notification to assigned use
                    //notifyUser(userID, claimList);

                    // reset search
                    //resetSearch();

                    lblSave.Text    = "Transfer completed successfully.";
                    lblSave.Visible = true;
                }
                catch (Exception ex) {
                    lblError.Text    = "Transfer was not completed due to error.";
                    lblError.Visible = true;

                    Core.EmailHelper.emailError(ex);
                }
            }
        }