Пример #1
0
        /// <summary>
        /// Bind email template gridview
        /// </summary>
        private void BindGrid()
        {
            int pageSize  = AspNetPager1.PageSize;
            int pageIndex = 1;

            if (isReset == true)
            {
                pageIndex = AspNetPager1.CurrentPageIndex = 1;
            }
            else
            {
                pageIndex = AspNetPager1.CurrentPageIndex;
            }

            string strWhare    = GetSqlWhereClause();
            int    recordCount = 0;

            DataSet listData = null;

            try
            {
                listData = prospectActivities.GetListForGridView(pageSize, pageIndex, strWhare, out recordCount, OrderName, OrderType, Convert.ToInt32(Request.QueryString["ContactID"]));
            }
            catch (Exception exception)
            {
                LPLog.LogMessage(exception.Message);
            }

            AspNetPager1.PageSize    = pageSize;
            AspNetPager1.RecordCount = recordCount;
            LoanActivities bLoanActivities = new LoanActivities();

            if (listData.Tables[0].Rows.Count > 0)
            {
                foreach (DataRow dr in listData.Tables[0].Rows)
                {
                    if (dr["ActivityType"].ToString() == "Prospect Activity")
                    {
                        dr["ActivityFile"] = "";
                    }
                    string sProspectPerformaBy = prospectActivities.GetProformedBy(" and ProspectActivityId=" + dr["ActivityId"].ToString()).Rows.Count > 0 ? prospectActivities.GetProformedBy(" and ProspectActivityId=" + dr["ActivityId"].ToString()).Rows[0]["PerformedBy"].ToString() : "System";
                    string sLoanPerformaBy     = bLoanActivities.GetProformedBy(" and ActivityId=" + dr["ActivityId"].ToString()).Rows.Count > 0 ? bLoanActivities.GetProformedBy(" and ActivityId=" + dr["ActivityId"].ToString()).Rows[0]["PerformedBy"].ToString() : "System";

                    dr["PerformedBy"] = (dr["form"].ToString() == "1") ? sProspectPerformaBy : sLoanPerformaBy;
                }
                listData.Tables[0].AcceptChanges();
            }
            listData.AcceptChanges();

            gridList.DataSource = listData;
            gridList.DataBind();
        }
Пример #2
0
        private string ImportLoansAndSubmitLoan(int iLoanID, string sProgram, string sType)
        {
            string         ReturnMessage = string.Empty;
            ServiceManager sm            = new ServiceManager();

            int[] FileIDs = new int[1];
            FileIDs.SetValue(iLoanID, 0);
            using (LP2ServiceClient service = sm.StartServiceClient())
            {
                ImportLoansRequest req = new ImportLoansRequest();
                req.hdr = new ReqHdr();
                req.hdr.SecurityToken = "SecurityToken"; //todo:check dummy data
                req.hdr.UserId        = this.CurrUser.iUserID;
                req.FileIds           = FileIDs;

                ImportLoansResponse respone = null;
                try
                {
                    respone = service.ImportLoans(req);

                    if (respone.hdr.Successful)
                    {
                        ReturnMessage = string.Empty;
                    }
                    else
                    {
                        ReturnMessage = respone.hdr.StatusInfo;
                    }
                }
                catch (System.ServiceModel.EndpointNotFoundException)
                {
                    string sExMsg = string.Format("Failed to ImportLoans, reason: ImportLoans Manager is not running.");
                    LPLog.LogMessage(LogType.Logerror, sExMsg);

                    return(ReturnMessage);
                }
                catch (Exception ex)
                {
                    string sExMsg = string.Format("Failed toImportLoans, error: {0}", ex.Message);
                    LPLog.LogMessage(LogType.Logerror, sExMsg);

                    return(ReturnMessage);
                }


                DT_SubmitLoanRequest reqDT = new DT_SubmitLoanRequest();
                reqDT.hdr = new ReqHdr();
                reqDT.hdr.SecurityToken = "SecurityToken"; //todo:check dummy data
                reqDT.hdr.UserId        = this.CurrUser.iUserID;
                reqDT.FileId            = iLoanID;
                reqDT.Loan_Program      = sProgram;
                reqDT.Originator_Type   = sType;

                DT_SubmitLoanResponse responeDT = null;
                try
                {
                    responeDT = service.DTSubmitLoan(reqDT);

                    if (responeDT.hdr.Successful)
                    {
                        ReturnMessage = string.Empty;
                    }
                    else
                    {
                        ReturnMessage = responeDT.hdr.StatusInfo;
                    }
                }
                catch (System.ServiceModel.EndpointNotFoundException)
                {
                    string sExMsg = string.Format("Failed to ImportLoans, reason: ImportLoans Manager is not running.");
                    LPLog.LogMessage(LogType.Logerror, sExMsg);

                    return(ReturnMessage);
                }
                catch (Exception ex)
                {
                    string sExMsg = string.Format("Failed to ImportLoans, error: {0}", ex.Message);
                    LPLog.LogMessage(LogType.Logerror, sExMsg);

                    return(ReturnMessage);
                }

                try
                {
                    LoanActivities       _bLoanActivities = new LoanActivities();
                    Model.LoanActivities _mLoanActivities = new Model.LoanActivities();
                    _mLoanActivities.FileId       = iLoanID;
                    _mLoanActivities.UserId       = this.CurrUser.iUserID;
                    _mLoanActivities.ActivityName = "The loan has been submitted to DataTrac by " + this.CurrUser.sFullName;
                    _mLoanActivities.ActivityTime = DateTime.Now;
                    int iNew = _bLoanActivities.Add(_mLoanActivities);
                }
                catch (Exception ex)
                {
                    string sExMsg = string.Format("Failed to Update LoanActivities, error: {0}", ex.Message);
                    LPLog.LogMessage(LogType.Logerror, sExMsg);

                    return(ReturnMessage);
                }

                return(ReturnMessage);
            }
        }