private string GetUserName(int UserID)
 {
     LPWeb.BLL.Users user = new LPWeb.BLL.Users();
     try
     {
         LPWeb.Model.Users model = user.GetModel(UserID);
         return(model.LastName + ", " + model.FirstName);
     }
     catch
     {
         return(string.Empty);
     }
 }
Exemple #2
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);
        }
    }
Exemple #3
0
    private decimal GetRegionMgrCompRate(int UserID)
    {
        LPWeb.BLL.Users bllUsers = new LPWeb.BLL.Users();

        LPWeb.Model.Users userInfo = bllUsers.GetModel(UserID);

        if (userInfo != null && userInfo.RegionMgrComp != null)
        {
            return(userInfo.RegionMgrComp);
        }
        else
        {
            return(0.000M);
        }
    }
    private void BindGrid()
    {
        //int pageSize = AspNetPager1.PageSize;
        try
        {
            if (CurrUser != null)
            {
                LPWeb.BLL.Users   users = new LPWeb.BLL.Users();
                LPWeb.Model.Users u     = users.GetModel(CurrUser.iUserID);
                if (u != null)
                {
                    //pageSize = u.LoansPerPage;
                    AspNetPager1.PageSize = u.LoansPerPage;
                }
            }
        }
        catch (Exception exception)
        {
            LPLog.LogMessage(exception.Message);
        }

        string sWhere = GetCondition();

        this.MarketingActivitySqlDataSource.ConnectionString = LPWeb.DAL.DbHelperSQL.connectionString;
        string sDbTable = "(select a.*,i.CategoryId, b.CampaignName, f.LastName +', '+ f.FirstName + case when ISNULL(f.MiddleName, '') != '' then ' '+ f.MiddleName else '' end as ClientName, "
                          + " c.Status+'-'+Substring(d.Name,Charindex('\',d.Name,2)+1,len(d.Name)-Charindex('\',d.Name,2)) as LoanName, "
                          + " g.LastName +', '+g.FirstName as StartedByName, h.Success, h.Error "
                          + " from LoanMarketing as a inner join MarketingCampaigns as b on a.CampaignId=b.CampaignId "
                          + " inner join MarketingCategory as i on b.CategoryId=i.CategoryId "
                          + " inner join Loans as c on a.FileId=c.FileId "
                          + " inner join PointFiles as d on c.FileId=d.FileId "
                          + " inner join LoanContacts as e on d.FileId=e.FileId "
                          + " inner join Contacts as f on e.ContactId=f.ContactId "
                          + " left outer join Users as g on a.StartedBy=g.UserId "
                          + " left outer join MarketingLog h on a.LoanMarketingId=h.LoanMarketingId) as t ";

        this.MarketingActivitySqlDataSource.SelectParameters["DbTable"].DefaultValue = sDbTable;
        int iRowCount1 = LPWeb.DAL.DbHelperSQL.Count(this.MarketingActivitySqlDataSource.SelectParameters["DbTable"].DefaultValue, sWhere);

        this.AspNetPager1.RecordCount = iRowCount1;

        this.MarketingActivitySqlDataSource.SelectParameters["Where"].DefaultValue = sWhere;
        this.gridMarketingActivityList.DataBind();
    }
Exemple #5
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);
        }
    }
Exemple #6
0
    public void BindData()
    {
        LPWeb.BLL.Loans    bllLoans    = new LPWeb.BLL.Loans();
        LPWeb.BLL.LoanTeam bllLoanTeam = new LPWeb.BLL.LoanTeam();
        LPWeb.BLL.Users    bllUsers    = new LPWeb.BLL.Users();
        LPWeb.Model.Loans  loanInfo    = bllLoans.GetModel(LoanID);

        DataTable LoanInfo_datatable = bllLoans.GetLoanInfo(LoanID);
        decimal   loanAmount         = 0;

        LoanPointFields LoanPointFieldsMgr = new LoanPointFields();

        //LPWeb.Model.LoanPointFields PointFieldInfo = LoanPointFieldsMgr.GetPointFieldInfo(LoanID, 21017);
        LPWeb.Model.LoanPointFields PointFieldInfo = LoanPointFieldsMgr.GetModel(LoanID, 21017);
        if (PointFieldInfo != null && !string.IsNullOrEmpty(PointFieldInfo.CurrentValue))
        {
            decimal.TryParse(PointFieldInfo.CurrentValue, out loanAmount);
        }
        if (loanAmount <= 0 && LoanInfo_datatable != null && LoanInfo_datatable.Rows.Count > 0)
        {
            loanAmount = LoanInfo_datatable.Rows[0]["LoanAmount"] == DBNull.Value ? 0 : (decimal)LoanInfo_datatable.Rows[0]["LoanAmount"];
        }
        this.labLoanamount.Text = loanAmount.ToString("n2");

        var list = new List <ViewCompDetail>();

        var Lo = new ViewCompDetail();

        Lo.Type = "Loan Officer";
        var LOUserId = bllLoanTeam.GetLoanOfficerID(LoanID);

        Lo.Name   = bllLoanTeam.GetLoanOfficer(LoanID);
        Lo.Rate   = GetUserCompRate(LOUserId);
        Lo.Amount = Lo.Rate * loanAmount / 100.00M;
        list.Add(Lo);


        loanInfo.BranchID = loanInfo.BranchID != null ? loanInfo.BranchID : 0;
        var branchM = new ViewCompDetail();

        branchM.Type = "Branch Manager";
        LPWeb.BLL.BranchManagers bllbranM = new LPWeb.BLL.BranchManagers();
        var branchUserId = 0;
        var branchObj    = bllbranM.GetModelList("BranchId =" + loanInfo.BranchID).FirstOrDefault();

        if (branchObj != null)
        {
            branchUserId = branchObj.BranchMgrId;
        }

        LPWeb.Model.Users userBrM = bllUsers.GetModel(branchUserId);
        if (userBrM != null && userBrM.UserId == branchUserId)
        {
            branchM.Name   = userBrM.LastName + "," + userBrM.FirstName;
            branchM.Rate   = GetBranchMgrCompRate(LOUserId);
            branchM.Amount = branchM.Rate * loanAmount / 100.00M;
        }
        list.Add(branchM);


        loanInfo.DivisionID = loanInfo.DivisionID != null ? loanInfo.DivisionID : 0;
        var divisionM = new ViewCompDetail();

        divisionM.Type = "Division Manager";
        LPWeb.BLL.DivisionExecutives bllDivM = new LPWeb.BLL.DivisionExecutives();
        var DivMUserId = 0;
        var divobj     = bllDivM.GetModelList("DivisionId =" + loanInfo.DivisionID).FirstOrDefault();

        if (divobj != null)
        {
            DivMUserId = divobj.ExecutiveId;
        }

        LPWeb.Model.Users userDivM = bllUsers.GetModel(DivMUserId);
        if (userDivM != null && userDivM.UserId == DivMUserId)
        {
            divisionM.Name   = userDivM.LastName + "," + userDivM.FirstName;
            divisionM.Rate   = GetDivisionMgrCompRate(LOUserId);
            divisionM.Amount = divisionM.Rate * loanAmount / 100.00M;
        }
        list.Add(divisionM);

        loanInfo.RegionID = loanInfo.RegionID != null ? loanInfo.RegionID : 0;
        var RegionM = new ViewCompDetail();

        RegionM.Type = "Region Manager";
        LPWeb.BLL.RegionExecutives bllRegionM = new LPWeb.BLL.RegionExecutives();
        var RegionMUserId = 0;
        var regionObj     = bllRegionM.GetModelList("RegionId =" + loanInfo.RegionID).FirstOrDefault();

        if (regionObj != null)
        {
            RegionMUserId = regionObj.ExecutiveId;
        }

        LPWeb.Model.Users userRegionM = bllUsers.GetModel(RegionMUserId);
        if (userRegionM != null && userRegionM.UserId == RegionMUserId)
        {
            RegionM.Name   = userRegionM.LastName + "," + userRegionM.FirstName;
            RegionM.Rate   = GetRegionMgrCompRate(LOUserId);
            RegionM.Amount = RegionM.Rate * loanAmount / 100.00M;
        }
        list.Add(RegionM);


        gvCompDetail.DataSource = list;
        gvCompDetail.DataBind();
    }