コード例 #1
0
ファイル: LoanTeam.cs プロジェクト: PulseCRM/Pulse
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List <LPWeb.Model.LoanTeam> DataTableToList(DataTable dt)
        {
            List <LPWeb.Model.LoanTeam> modelList = new List <LPWeb.Model.LoanTeam>();
            int rowsCount = dt.Rows.Count;

            if (rowsCount > 0)
            {
                LPWeb.Model.LoanTeam model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new LPWeb.Model.LoanTeam();
                    if (dt.Rows[n]["FileId"].ToString() != "")
                    {
                        model.FileId = int.Parse(dt.Rows[n]["FileId"].ToString());
                    }
                    if (dt.Rows[n]["RoleId"].ToString() != "")
                    {
                        model.RoleId = int.Parse(dt.Rows[n]["RoleId"].ToString());
                    }
                    if (dt.Rows[n]["UserId"].ToString() != "")
                    {
                        model.UserId = int.Parse(dt.Rows[n]["UserId"].ToString());
                    }
                    modelList.Add(model);
                }
            }
            return(modelList);
        }
コード例 #2
0
    protected void btnSave_Click(object sender, EventArgs e)
    {
        if (this.CurrentFileId == 0)
        {
            return;
        }
        ServiceManager sm          = new ServiceManager();
        bool           bSuccessful = false;

        using (LP2ServiceClient service = sm.StartServiceClient())
        {
            ReassignLoanRequest req = new ReassignLoanRequest();
            req.hdr = new ReqHdr();
            req.hdr.SecurityToken = "SecurityToken"; //todo:check dummy data
            req.hdr.UserId        = CurrentUser.iUserID;
            ReassignUserInfo uInfo = new ReassignUserInfo();

            uInfo.FileId = this.CurrentFileId;
            uInfo.RoleId = int.Parse(ddlRole.SelectedValue);
            if (ddlUsers.SelectedValue != "")
            {
                uInfo.NewUserId = int.Parse(ddlUsers.SelectedValue);
            }
            else
            {
                uInfo.NewUserId = 0;
            }
            List <ReassignUserInfo> uList = new List <ReassignUserInfo>();
            uList.Add(uInfo);
            req.reassignUsers = uList.ToArray();
            ReassignLoanResponse respone = null;
            try
            {
                ReassignProspect(service);

                respone = service.ReassignLoan(req);

                if (respone.hdr.Successful)
                {
                    LPWeb.Model.LoanTeam lcModel = new LPWeb.Model.LoanTeam();
                    lcModel.FileId = CurrentFileId;
                    lcModel.RoleId = uInfo.RoleId;
                    lcModel.UserId = uInfo.NewUserId;

                    LPWeb.Model.LoanTeam oldlcModel = new LPWeb.Model.LoanTeam();
                    oldlcModel.FileId = CurrentFileId;
                    oldlcModel.RoleId = oldRoleID;
                    oldlcModel.UserId = oldUserID;

                    LPWeb.BLL.LoanTeam lc = new LoanTeam();

                    //lc.Reassign(oldlcModel, lcModel, req.hdr.UserId, ddlRole.SelectedItem.Text, ddlUsers.SelectedItem.Text);
                    lc.Reassign(oldlcModel, lcModel, req.hdr.UserId);

                    bSuccessful = true;
                }
                else
                {
                    bSuccessful = false;
                }
                if (bSuccessful)
                {
                    PageCommon.WriteJsEnd(this, "Reassigned loan successfully", "window.parent.RefreshPage();" + this.hdnCloseDialogCodes.Value);
                }
                else
                {
                    PageCommon.WriteJsEnd(this, string.Format("Failed to reassign loan, reason:{0}.", respone.hdr.StatusInfo), PageCommon.Js_RefreshSelf);
                }
            }
            catch (System.ServiceModel.EndpointNotFoundException ex)
            {
                LPLog.LogMessage(ex.Message);
                PageCommon.WriteJsEnd(this, "Failed to reassign loan, reason: Point Manager is not running.", PageCommon.Js_RefreshSelf);
            }
            catch (Exception exception)
            {
                LPLog.LogMessage(exception.Message);
                PageCommon.WriteJsEnd(this, string.Format("Failed to reassign loan, reason:{0}.", exception.Message), PageCommon.Js_RefreshSelf);
            }
        }
    }
コード例 #3
0
ファイル: LoanTeam.cs プロジェクト: PulseCRM/Pulse
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public void Update(LPWeb.Model.LoanTeam model)
 {
     dal.Update(model);
 }
コード例 #4
0
ファイル: LoanTeam.cs プロジェクト: PulseCRM/Pulse
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public void Add(LPWeb.Model.LoanTeam model)
 {
     dal.Add(model);
 }
コード例 #5
0
ファイル: LoanTeam.cs プロジェクト: PulseCRM/Pulse
 public void Reassign(LPWeb.Model.LoanTeam oldModel, LPWeb.Model.LoanTeam model, int UserId)
 {
     dal.Reassign(oldModel, model, UserId);
 }
コード例 #6
0
    private bool SaveLocal(ref string errMsg)
    {
        if (!string.IsNullOrEmpty(FileName) && FileName.Length > 0 && !FileName.ToUpper().EndsWith(".PRS") && !FileName.ToUpper().EndsWith(".BRW"))
        {
            errMsg = "The filename must end with “.PRS” or “.BRW”. ";
            return(false);
        }

        try
        {
            #region Save BranchId
            Loans             bllLoans = new Loans();
            LPWeb.Model.Loans loanInfo = new LPWeb.Model.Loans();
            loanInfo = bllLoans.GetModel(iFileID);
            if (loanInfo != null)
            {
                loanInfo.BranchID = BranchId;
                bllLoans.Update(loanInfo);
            }
            #endregion

            //Save Loan Officer

            #region Loan Officer

            LoanTeam bllLoanTeam   = new LoanTeam();
            Users    bllUsers      = new Users();
            var      loanOfficer   = bllLoanTeam.GetLoanOfficer(iFileID);
            var      loanOfficerId = bllLoanTeam.GetLoanOfficerID(iFileID);

            #region Loan Officer RolesID   =loanOfficerRolesId
            Roles bllRoles           = new Roles();
            int   loanOfficerRolesId = 3;//default;
            try
            {
                loanOfficerRolesId = bllRoles.GetModelList(" Name = 'Loan Officer' ").FirstOrDefault().RoleId;
            }
            catch { }
            #endregion

            if (LoanOfficerId != loanOfficerId)
            {
                var loanTeamInfo = bllLoanTeam.GetModel(iFileID, loanOfficerRolesId, loanOfficerId);

                if (loanTeamInfo == null)
                {
                    loanTeamInfo = new LPWeb.Model.LoanTeam();
                }
                else
                {
                    bllLoanTeam.Delete(iFileID, loanOfficerRolesId, loanOfficerId);
                }
                loanTeamInfo.FileId = iFileID;
                loanTeamInfo.RoleId = loanOfficerRolesId;
                loanTeamInfo.UserId = LoanOfficerId;


                bllLoanTeam.Add(loanTeamInfo);
            }

            #endregion

            #region Local PointFile  ----pointFileInfo and  pointFolderInfo

            PointFiles   bllPointFile    = new PointFiles();
            PointFolders bllPointFolders = new PointFolders();


            LPWeb.Model.PointFiles pointFileInfo = bllPointFile.GetModel(iFileID);
            var IsAddPointFile = false;
            if (pointFileInfo == null)
            {
                IsAddPointFile = true;
                pointFileInfo  = new LPWeb.Model.PointFiles();
            }
            else
            {
                IsAddPointFile = false;
            }

            pointFileInfo.FileId = iFileID;
            if (FolderId > 0)
            {
                pointFileInfo.FolderId = FolderId;
            }
            if (FileName.Length > 0)
            {
                pointFileInfo.Name = FileName;
            }


            if (IsAddPointFile)
            {
                bllPointFile.Add(pointFileInfo);
            }
            else
            {
                bllPointFile.UpdateBase(pointFileInfo);
            }

            #endregion
        }
        catch (Exception ex)
        {
            errMsg = ex.Message;
            return(false);
        }
        return(true);
    }
コード例 #7
0
    protected void Page_Load(object sender, EventArgs e)
    {
        // json示例
        // {"ExecResult":"Success","ErrorMsg":""}
        // {"ExecResult":"Failed","ErrorMsg":"错误信息"}

        int iFileID     = 0;
        int iUserID     = 0;
        int iLoanRoleID = 0;

        int iCurrrentUserID = this.CurrUser.iUserID;

        #region 校验页面参数

        bool bIsValid = PageCommon.ValidateQueryString(this, "FileID", QueryStringType.ID);
        if (bIsValid == false)
        {
            this.Response.Write("{\"ExecResult\":\"Failed\",\"ErrorMsg\":\"Missing required query string.\"}");
            this.Response.End();
        }
        string sFileID = this.Request.QueryString["FileID"];
        iFileID = Convert.ToInt32(sFileID);

        bIsValid = PageCommon.ValidateQueryString(this, "UserID", QueryStringType.ID);
        if (bIsValid == false)
        {
            this.Response.Write("{\"ExecResult\":\"Failed\",\"ErrorMsg\":\"Missing required query string.\"}");
            this.Response.End();
        }
        string sUserID = this.Request.QueryString["UserID"];
        iUserID = Convert.ToInt32(sUserID);

        bIsValid = PageCommon.ValidateQueryString(this, "LoanRoleID", QueryStringType.ID);
        if (bIsValid == false)
        {
            this.Response.Write("{\"ExecResult\":\"Failed\",\"ErrorMsg\":\"Missing required query string.\"}");
            this.Response.End();
        }
        string sLoanRoleID = this.Request.QueryString["LoanRoleID"];
        iLoanRoleID = Convert.ToInt32(sLoanRoleID);

        #endregion

        ServiceManager sm = new ServiceManager();
        using (LP2ServiceClient service = sm.StartServiceClient())
        {
            #region 调用ReassignProspect

            #region Build ReassignProspectRequest

            ReassignProspectRequest rpq = new ReassignProspectRequest();
            rpq.hdr    = new ReqHdr();
            rpq.FileId = new int[1] {
                iFileID
            };
            rpq.hdr.SecurityToken = "SecurityToken"; //todo:check dummy data
            rpq.hdr.UserId        = iCurrrentUserID;
            rpq.FromUser          = 0;
            rpq.ToUser            = iUserID;
            rpq.ContactId         = null;
            rpq.UserId            = null;

            #endregion

            #region invoke ReassignProspect

            bool   bSuccess = false;
            string sError   = string.Empty;
            try
            {
                ReassignProspectResponse rpp = service.ReassignProspect(rpq);
                bSuccess = rpp.hdr.Successful;

                if (bSuccess == false)
                {
                    sError = "Failed to invoke API ReassignProspect.";
                }
            }
            catch (System.ServiceModel.EndpointNotFoundException ex)
            {
                bSuccess = false;
                sError   = "Exception happened: Point Manager is not running.";

                LPLog.LogMessage(ex.Message);
            }
            catch (Exception exception)
            {
                bSuccess = false;
                sError   = "Exception happened when invoke API ReassignProspect.";

                LPLog.LogMessage(exception.Message);
            }
            finally
            {
                if (bSuccess == false)
                {
                    this.Response.Write("{\"ExecResult\":\"Failed\",\"ErrorMsg\":\"" + sError + "\"}");
                    this.Response.End();
                }
            }

            #endregion

            #endregion

            #region 调用ReassignLoan

            #region Build ReassignLoanRequest

            ReassignLoanRequest req = new ReassignLoanRequest();
            req.hdr = new ReqHdr();
            req.hdr.SecurityToken = "SecurityToken"; //todo:check dummy data
            req.hdr.UserId        = iCurrrentUserID;

            List <ReassignUserInfo> UserList = new List <ReassignUserInfo>();

            ReassignUserInfo UserInfo = new ReassignUserInfo();
            UserInfo.FileId    = iFileID;
            UserInfo.RoleId    = iLoanRoleID;
            UserInfo.NewUserId = iUserID;
            UserList.Add(UserInfo);

            req.reassignUsers = UserList.ToArray();

            #endregion

            #region invoke api
            bSuccess = false;
            sError   = string.Empty;
            try
            {
                ReassignLoanResponse respone = service.ReassignLoan(req);
                bSuccess = respone.hdr.Successful;

                if (bSuccess == false)
                {
                    sError = "Failed to invoke API ReassignLoan.";
                }
            }
            catch (System.ServiceModel.EndpointNotFoundException ex)
            {
                LPLog.LogMessage(ex.Message);

                bSuccess = false;
                sError   = "Exception happened: Point Manager is not running.";
            }
            catch (Exception exception)
            {
                LPLog.LogMessage(exception.Message);

                bSuccess = false;
                sError   = "Exception happened when invoke API ReassignLoan.";
            }
            finally
            {
                if (bSuccess == false)
                {
                    this.Response.Write("{\"ExecResult\":\"Failed\",\"ErrorMsg\":\"" + sError + "\"}");
                    this.Response.End();
                }
            }
            #endregion

            #endregion
        }

        #region Reassign Loan Team

        LPWeb.Model.LoanTeam lcModel = new LPWeb.Model.LoanTeam();
        lcModel.FileId = iFileID;
        lcModel.RoleId = iLoanRoleID;
        lcModel.UserId = iUserID;

        LPWeb.Model.LoanTeam oldlcModel = new LPWeb.Model.LoanTeam();
        oldlcModel.FileId = iFileID;
        oldlcModel.RoleId = 0;
        oldlcModel.UserId = 0;

        LPWeb.BLL.LoanTeam LoanTeam1 = new LPWeb.BLL.LoanTeam();
        LoanTeam1.Reassign(oldlcModel, lcModel, iCurrrentUserID);

        #endregion

        this.Response.Write("{\"ExecResult\":\"Success\",\"ErrorMsg\":\"\"}");
        this.Response.End();
    }