private bool MoveFile(int nFileId, int nFolderId, out string err)
    {
        string strResultInfo = string.Empty;

        err = string.Empty;

        string sProspectStatus = LoansManager.GetProspectStatusInfo(nFileId);
        string sFileName       = LoansManager.GetProspectFileNameInfo(nFileId); //bug 878

        if (sFileName == "")
        {
            err = "The selected lead does not have a Point file.";
            return(false);
        }

        ServiceManager sm = new ServiceManager();

        using (LP2ServiceClient client = sm.StartServiceClient())
        {
            MoveFileRequest req = new MoveFileRequest();
            req.FileId      = nFileId;
            req.NewFolderId = nFolderId;
            req.hdr         = new ReqHdr();
            req.hdr.UserId  = CurrUser.iUserID;

            MoveFileResponse response = client.MoveFile(req);
            if (response.hdr.Successful)
            {
                return(true);
            }

            // LPLog.LogMessage(LogType.Logerror, string.Format("Failed to move file:{0}", response.hdr.StatusInfo));
            //PageCommon.WriteJsEnd(this, response.hdr.StatusInfo);
            err = response.hdr.StatusInfo;
            return(false);
        }
    }
Example #2
0
    /// <summary>
    ///
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btnDispose_Click(object sender, EventArgs e)
    {
        bool bmove   = false;
        int  nFileId = -1;

        if (!int.TryParse(this.hiSelectedLoan.Value, out nFileId))
        {
            nFileId = -1;
        }
        if (nFileId == -1)
        {
            LPLog.LogMessage(LogType.Logerror, "Invalid file Id: " + this.hiSelectedLoan.Value);
            return;
        }

        int nFolderId = -1;

        if (!int.TryParse(this.hiSelectedFolderId.Value, out nFolderId))
        {
            nFolderId = -1;
        }
        if (nFolderId == -1)
        {
            LPLog.LogMessage(LogType.Logerror, "Invalid folder Id: " + this.hiSelectedFolderId.Value);
            return;
        }


        try
        {
            ServiceManager sm = new ServiceManager();
            using (LP2ServiceClient client = sm.StartServiceClient())
            {
                if (!bmove)
                {
                    DisposeLoanRequest req = new DisposeLoanRequest();
                    req.FileId      = nFileId;
                    req.LoanStatus  = hiSelectedDisposal.Value;
                    req.NewFolderId = nFolderId;
                    req.hdr         = new ReqHdr();
                    req.hdr.UserId  = CurrUser.iUserID;
                    req.StatusDate  = DateTime.Now;

                    DisposeLoanResponse response = client.DisposeLoan(req);
                    if (response.hdr.Successful)
                    {
                        if (WorkflowManager.UpdateLoanStatus(nFileId, hiSelectedDisposal.Value, CurrUser.iUserID))
                        {
                            BindLoanGrid();
                            LPLog.LogMessage(LogType.Loginfo, string.Format("Successfully update loan status, LoanId:{0}, to Status:{1}. ",
                                                                            nFileId, this.hiSelectedDisposal.Value));
                        }
                        else
                        {
                            PageCommon.AlertMsg(this, "Failed to update loan status.");
                            LPLog.LogMessage(LogType.Logerror, string.Format("Failed to update loan status, LoanId:{0}, to Status:{1}.",
                                                                             nFileId, this.hiSelectedDisposal.Value));
                        }
                    }
                    else
                    {
                        LPLog.LogMessage(LogType.Logerror, string.Format("Failed to move file:{0}", response.hdr.StatusInfo));
                        PageCommon.AlertMsg(this, response.hdr.StatusInfo);
                    }
                }
                else
                {
                    MoveFileRequest req = new MoveFileRequest();
                    req.FileId      = nFileId;
                    req.NewFolderId = nFolderId;
                    req.hdr         = new ReqHdr();
                    req.hdr.UserId  = CurrUser.iUserID;

                    MoveFileResponse response = client.MoveFile(req);
                    if (response.hdr.Successful)
                    {
                    }
                    else
                    {
                        LPLog.LogMessage(LogType.Logerror, string.Format("Failed to move file:{0}", response.hdr.StatusInfo));
                        PageCommon.AlertMsg(this, response.hdr.StatusInfo);
                    }
                }
            }
        }
        catch (System.ServiceModel.EndpointNotFoundException ee)
        {
            LPLog.LogMessage(LogType.Logerror, string.Format("Faield to move file:{0}", ee.Message));
            PageCommon.AlertMsg(this, "Failed to move the Point file, reason: Point Manager is not running.");
        }
        catch (Exception ex)
        {
            LPLog.LogMessage(LogType.Logerror, string.Format("Faield to move file:{0}", ex.Message));
            PageCommon.AlertMsg(this, ex.Message);
        }
    }
Example #3
0
        protected void btnSel_Click(object sender, EventArgs e)
        {
            string sFolderID = "0";

            // return selected record as XML
            foreach (GridViewRow row in gvFolder.Rows)
            {
                CheckBox ckbSelected = row.FindControl("ckbSelected") as CheckBox;
                if (ckbSelected.Checked)
                {
                    if (!string.IsNullOrEmpty(_strPstatus) && _strPstatus == "1")
                    {
                        //ClientFun("callback", string.Format("callBack('{0}','{1}');", gvFolder.DataKeys[row.RowIndex].Value, _strPstatus));
                        sFolderID = gvFolder.DataKeys[row.RowIndex].Value.ToString();
                        //return;
                    }
                    //ClientFun("callback", string.Format("callBack('{0}');", gvFolder.DataKeys[row.RowIndex].Value.ToString()));
                    sFolderID = gvFolder.DataKeys[row.RowIndex].Value.ToString();
                    //return;
                }
            }

            BLL.Loans LoansManager = new BLL.Loans();

            string sProspectStatus = "";

            try
            {
                sProspectStatus = LoansManager.GetProspectStatusInfo(Convert.ToInt32(this.strFileId));
                string sFileName = LoansManager.GetProspectFileNameInfo(Convert.ToInt32(this.strFileId));  //bug 878
                if (sFileName == "")
                {
                    //PageCommon.AlertMsg(this, string.Format("The selected loan does not have a Point file. Please export the loan to a Point file using the Lead Detail page and try again."));
                    PageCommon.WriteJsEnd(this, "The selected loan does not have a Point file. Please export the loan to a Point file using the Lead Detail page and try again.", "window.parent.CloseGlobalPopup();");
                    return;
                }
            }
            catch
            {
                LPLog.LogMessage(LogType.Logerror, "Invalid loan status: " + sProspectStatus);
                return;
            }
            try
            {
                ServiceManager sm = new ServiceManager();
                using (LP2ServiceClient client = sm.StartServiceClient())
                {
                    MoveFileRequest req = new MoveFileRequest();
                    req.FileId = Convert.ToInt32(this.strFileId);
                    //           req.LoanStatus = lse;
                    req.NewFolderId = Convert.ToInt32(sFolderID);
                    req.hdr         = new ReqHdr();
                    req.hdr.UserId  = CurrUser.iUserID;
                    //           req.StatusDate = DateTime.Now;

                    MoveFileResponse response = client.MoveFile(req);
                    if (response.hdr.Successful)
                    {
                        PageCommon.WriteJsEnd(this, "", "window.parent.CloseGlobalPopup();");
                    }
                    else
                    {
                        LPLog.LogMessage(LogType.Logerror, string.Format("Failed to move file:{0}", response.hdr.StatusInfo));
                        //PageCommon.AlertMsg(this, response.hdr.StatusInfo);
                        //ClientFun("callback", "");
                        PageCommon.WriteJsEnd(this, response.hdr.StatusInfo, "window.parent.CloseGlobalPopup();");
                    }
                }
            }
            catch (System.ServiceModel.EndpointNotFoundException ee)
            {
                LPLog.LogMessage(LogType.Logerror, string.Format("Faield to move file:{0}", ee.Message));
                //PageCommon.AlertMsg(this, "Failed to move the Point file, reason: Point Manager is not running.");
                //ClientFun("callback", "");
                PageCommon.WriteJsEnd(this, "Failed to move the Point file, reason: Point Manager is not running.", "window.parent.CloseGlobalPopup();");
            }
            catch (Exception ex)
            {
                LPLog.LogMessage(LogType.Logerror, string.Format("Faield to move file:{0}", ex.Message));
                PageCommon.WriteJsEnd(this, ex.Message, "window.parent.CloseGlobalPopup();");
            }
        }