Example #1
0
    protected void lbtnSendWeekly_Click(object sender, EventArgs e)
    {
        try
        {
            string   ContactIDs    = this.hfContactIDs.Value;
            string[] Ids           = ContactIDs.Split(",".ToCharArray());
            string   ReturnMessage = string.Empty;
            foreach (string cid in Ids)
            {
                string ContactID = string.Empty;
                if (cid.Contains("User"))
                {
                    ContactID = cid.Replace("User", "");

                    LPWeb.BLL.Users blluser = new LPWeb.BLL.Users();
                    var             userMod = blluser.GetModel(int.Parse(ContactID));

                    if (string.IsNullOrEmpty(userMod.EmailAddress))
                    {
                        PageCommon.AlertMsg(this, "The selected recipient " + userMod.LastName + "," + userMod.FirstName + " does not have an email address.");
                        return;
                    }

                    UpdateEmailSettings(0, int.Parse(ContactID), 2, true, 1);
                }
                else if (cid.Contains("Contract"))
                {
                    ContactID = cid.Replace("Contract", "");

                    LPWeb.BLL.Contacts bllcontacts = new LPWeb.BLL.Contacts();
                    var contactMod = bllcontacts.GetModel(int.Parse(ContactID));
                    if (string.IsNullOrEmpty(contactMod.Email))
                    {
                        PageCommon.AlertMsg(this, "The selected recipient " + contactMod.LastName + "," + contactMod.FirstName + " does not have an email address.");
                        return;
                    }

                    UpdateEmailSettings(int.Parse(ContactID), 0, 2, true, 1);
                }
            }

            PageCommon.WriteJsEnd(this, "The report has been scheduled successfully!", PageCommon.Js_RefreshSelf);
        }
        catch (Exception ex)
        {
            PageCommon.AlertMsg(this, "The operation is Failed .");
            LPLog.LogMessage(LogType.Logerror, "Failed to schedule the report , exception: " + ex.Message);

            PageCommon.WriteJsEnd(this, "Failed to schedule the report, error:" + ex.Message, PageCommon.Js_RefreshSelf);
        }
    }
Example #2
0
    protected void lbtnSendNow_Click(object sender, EventArgs e)
    {
        try
        {
            string   ContactIDs    = this.hfContactIDs.Value;
            string[] Ids           = ContactIDs.Split(",".ToCharArray());
            string   ReturnMessage = string.Empty;
            foreach (string cid in Ids)
            {
                int  ContactID = 0;
                bool External  = true;
                if (cid.Contains("User"))
                {
                    ContactID = int.Parse(cid.Replace("User", ""));
                    LPWeb.BLL.Users blluser = new LPWeb.BLL.Users();
                    var             userMod = blluser.GetModel(ContactID);

                    if (string.IsNullOrEmpty(userMod.EmailAddress))
                    {
                        PageCommon.AlertMsg(this, "The selected recipient " + userMod.LastName + "," + userMod.FirstName + " does not have an email address.");
                        return;
                    }

                    External       = true;
                    ReturnMessage += SendLSREmail(0, string.Empty, string.Empty, ContactID, userMod.EmailAddress, userMod.FirstName + " " + userMod.LastName, External, null);
                    //ReturnMessage = SendExternalReport(0,ContactID, External);
                }
                else if (cid.Contains("Contract"))
                {
                    ContactID = int.Parse(cid.Replace("Contract", ""));

                    LPWeb.BLL.Contacts bllcontacts = new LPWeb.BLL.Contacts();
                    var contactMod = bllcontacts.GetModel(ContactID);
                    if (string.IsNullOrEmpty(contactMod.Email))
                    {
                        PageCommon.AlertMsg(this, "The selected recipient " + contactMod.LastName + "," + contactMod.FirstName + " does not have an email address.");
                        return;
                    }


                    External       = true;
                    ReturnMessage += SendLSREmail(ContactID, contactMod.Email, contactMod.FirstName + ' ' + contactMod.LastName, 0, string.Empty, string.Empty, External, null);
                    //ReturnMessage = SendExternalReport(ContactID,0, External);
                }

                if (string.IsNullOrEmpty(ReturnMessage))
                {
                    PageCommon.AlertMsg(this, "The report has been sent successfully!");
                }
                else
                {
                    PageCommon.AlertMsg(this, "Failed to send the report, error:" + ReturnMessage);
                    return;
                }
            }
        }
        catch (Exception ex)
        {
            PageCommon.AlertMsg(this, "Failed to disable the selected contact role(s).");
            LPLog.LogMessage(LogType.Logerror, "Failed to disable the selected contact role(s), exception: " + ex.Message);
            PageCommon.AlertMsg(this, "Failed to send the report, error:" + ex.Message);
        }
    }
    private void FillLabels()
    {
        if (iContactID == 0)
        {
            return;
        }
        try
        {
            LPWeb.BLL.Contacts   contact = new LPWeb.BLL.Contacts();
            LPWeb.Model.Contacts cModel  = contact.GetModel(iContactID);
            lbClient.Text   = cModel.LastName + ", " + cModel.FirstName + " " + cModel.MiddleName;
            lbNikeName.Text = cModel.NickName;
            if (cModel.DOB.HasValue)
            {
                lbDOB.Text = cModel.DOB.Value.ToShortDateString();
            }
            else
            {
                lbDOB.Text = string.Empty;
            }
            lbGenCode.Text = cModel.GenerationCode;
            lbSSN.Text     = cModel.SSN;
            lbTitle.Text   = cModel.Title;
            if (cModel.Experian.HasValue)
            {
                lbExperScore.Text = cModel.Experian.Value.ToString();
            }
            if (cModel.TransUnion.HasValue)
            {
                lbTranScore.Text = cModel.TransUnion.Value.ToString();
            }
            if (cModel.Equifax.HasValue)
            {
                lbEquifax.Text = cModel.Equifax.Value.ToString();
            }
            lbHomePhone.Text     = cModel.HomePhone;
            lbCellPhone.Text     = cModel.CellPhone;
            lbBusinessPhone.Text = cModel.BusinessPhone;
            lbFax.Text           = cModel.Fax;
            lbEmail.Text         = cModel.Email;
            lbAddress.Text       = cModel.MailingAddr;
            lbAddress1.Text      = cModel.MailingCity + ", " + cModel.MailingState + " " + cModel.MailingZip;
        }
        catch
        { }
        try
        {
            LPWeb.BLL.Prospect   prospect = new LPWeb.BLL.Prospect();
            LPWeb.Model.Prospect pModel   = prospect.GetModel(iContactID);
            lbStatus.Text     = pModel.Status;
            lbLeadSource.Text = pModel.LeadSource;//Get referral contact name
            if (pModel.Loanofficer.HasValue)
            {
                lbLoanOfficer.Text = GetUserName(pModel.Loanofficer.Value);
            }
            if (pModel.Created.HasValue)
            {
                lbCreatedOn.Text = pModel.Created.Value.ToShortDateString();
            }
            if (pModel.CreatedBy.HasValue)
            {
                lbCreatedBy.Text = GetUserName(pModel.CreatedBy.Value);
            }
            if (pModel.Modifed.HasValue)
            {
                lbLastModified.Text = pModel.Modifed.Value.ToShortDateString();
            }
            if (pModel.ModifiedBy.HasValue)
            {
                lbModifiedBy.Text = GetUserName(pModel.ModifiedBy.Value);
            }

            int iReferralId = 0;

            if (pModel.Referral != null)
            {
                iReferralId = (int)pModel.Referral;

                LPWeb.BLL.Contacts contact = new LPWeb.BLL.Contacts();
                lbReferral.Text = contact.GetContactName(iReferralId);
            }

            this.lbPreferredContact.Text = pModel.PreferredContact;
            this.lbCreditRanking.Text    = pModel.CreditRanking;
        }
        catch
        { }
    }