Example #1
0
    private String GetLikeUserName(string key)
    {
        PointFiles pf = new PointFiles();
        DataSet    ds = pf.GetList(10, "[name] like '%" + key + "%'", " [name] ");

        if (ds == null || ds.Tables.Count < 1 || ds.Tables[0].Rows.Count < 1)
        {
            return(string.Empty);
        }
        DataTable dt = ds.Tables[0];

        System.Text.StringBuilder sbstr = new System.Text.StringBuilder("[");
        for (int i = 0; i < dt.Rows.Count; i++)
        {
            sbstr.Append("\"" + dt.Rows[i]["Name"].ToString().Replace(@"\", @"\\") + "\"");
            if (i == dt.Rows.Count - 1)
            {
                sbstr.Append("]");
            }
            else
            {
                sbstr.Append(",");
            }
        }

        return(sbstr.ToString());
    }
        private void Judge(string filePath)
        {
            var featureClass = filePath.GetShpFeatureClass();

            if (featureClass == null)
            {
                var index = featureClass.Fields.FindField("TCMC");
                if (index != -1)
                {
                    switch (featureClass.ShapeType)
                    {
                    case ESRI.ArcGIS.Geometry.esriGeometryType.esriGeometryPoint:
                        PointFiles.Add(filePath);
                        break;

                    case ESRI.ArcGIS.Geometry.esriGeometryType.esriGeometryPolygon:
                        PolygonFiles.Add(filePath);
                        break;

                    case ESRI.ArcGIS.Geometry.esriGeometryType.esriGeometryPolyline:
                        PolylineFiles.Add(filePath);
                        break;
                    }
                }
            }
        }
Example #3
0
    private String GetLikeUserName1(string key)
    {
        PointFiles pf = new PointFiles();
        DataSet    ds = pf.GetList(10, "[name] like '%" + key + "%'", " [name] ");

        if (ds == null || ds.Tables.Count < 1 || ds.Tables[0].Rows.Count < 1)
        {
            return(string.Empty);
        }
        DataTable dt = ds.Tables[0];

        System.Text.StringBuilder sbstr = new System.Text.StringBuilder("[");
        for (int i = 0; i < dt.Rows.Count; i++)
        {
            //{ name: "Peter Pan", to: "*****@*****.**" },
            // json: [{"label":"Name1","value":"2"},{"label":"Name2","value":"2"},{"label":"Name3","value":"3"}]
            sbstr.Append("{\"label\":\"");
            sbstr.Append(dt.Rows[i]["Name"].ToString().Replace(@"\", @"\\") + "   " + GetBorrower(int.Parse(dt.Rows[i]["FileID"].ToString())));
            sbstr.Append("\", \"value\":\"");
            sbstr.Append(dt.Rows[i]["Name"].ToString().Replace(@"\", @"\\"));
            sbstr.Append("\"}");
            if (i == dt.Rows.Count - 1)
            {
                sbstr.Append("]");
            }
            else
            {
                sbstr.Append(",");
            }
        }

        return(sbstr.ToString());
    }
Example #4
0
    private void BindPoint(int FileID)
    {
        try
        {
            //btnExport.Enabled = false;
            PointFiles             file      = new PointFiles();
            LPWeb.Model.PointFiles fileModel = new LPWeb.Model.PointFiles();
            fileModel = file.GetModel(iFileID);

            if (fileModel == null)
            {
                return;
            }
            txbPointFileName.Text = fileModel.Name;

            PointFolders             folder      = new PointFolders();
            LPWeb.Model.PointFolders folderModel = new LPWeb.Model.PointFolders();
            folderModel = folder.GetModel(fileModel.FolderId);
            if (folderModel != null && folderModel.Name.Length > 0)
            {
                ddlPointFolder.Text = folderModel.Name;
            }
            if (txbPointFileName.Text.Length > 0 && ddlPointFolder.Text.Length > 0)
            {
                //btnExport.Enabled = true;
            }
        }
        catch
        { }
    }
    private LPWeb.Model.PointFiles GetPointFileInfo(int iFileId)
    {
        PointFiles PointFilesMgr = new PointFiles();

        LPWeb.Model.PointFiles PointFileInfo = PointFilesMgr.GetModel(this.iLoanID);

        return(PointFileInfo);
    }
Example #6
0
    private void BindPoint(int FileID)
    {
        try
        {
            //btnExport.Enabled = false;
            PointFiles             file      = new PointFiles();
            LPWeb.Model.PointFiles fileModel = new LPWeb.Model.PointFiles();
            fileModel = file.GetModel(iFileID);

            if (fileModel == null)
            {
                return;
            }
            txbPointFileName.Text = fileModel.Name;
            PointFolders folder = new PointFolders();
            if (fileModel.FolderId > 0)
            {
                LPWeb.Model.PointFolders folderModel = new LPWeb.Model.PointFolders();
                folderModel = folder.GetModel(fileModel.FolderId);
                if (folderModel != null && folderModel.Name.Length > 0)
                {
                    ListItem item = new ListItem(folderModel.Name, folderModel.FolderId.ToString());
                    ddlPointFolder.Items.Insert(0, item);
                }
                ddlPointFolder.Enabled = false;
            }
            else
            if (ddlPointFolder.Items.Count > 1)
            {
                ddlPointFolder.Enabled = true;
            }

            if (txbPointFileName.Text.Length > 0 && ddlPointFolder.Text.Length > 0)
            {
                if (!txbPointFileName.Text.ToUpper().EndsWith(".PRS") &&
                    !txbPointFileName.Text.ToUpper().EndsWith(".BRW"))
                {
                    //btnExport.Enabled = false;
                    return;
                }
                string filename = System.IO.Path.GetFileName(txbPointFileName.Text);
                if (txbPointFileName.Text.ToUpper().EndsWith(".PRS"))
                {
                    txbPointFileName.Text = @"\PROSPECT\" + filename;
                }
                else
                {
                    txbPointFileName.Text = @"\BORROWER\" + filename;
                }
                ///btnExport.Enabled = true;
            }
        }
        catch (Exception ex)
        {
            LPLog.LogMessage(ex.Message);
        }
    }
Example #7
0
        /// <summary>
        /// Import PointFiles
        /// </summary>
        /// <returns></returns>
        private int ImportPointFiles()
        {
            PointFiles bPointFiles = new PointFiles();

            Model.PointFiles mPointFiles = new Model.PointFiles();

            //PointFolders bPointFolders = new PointFolders();
            //DataSet dsFolder = bPointFolders.GetList("BranchID=" + BranchId + " and Enabled='true' order by FolderId");
            //if (dsFolder != null && dsFolder.Tables[0].Rows.Count > 0)
            //{
            //    mPointFiles.FolderId = Convert.ToInt32(dsFolder.Tables[0].Rows[0]["FolderId"]);
            //}
            mPointFiles.FolderId      = 0;
            mPointFiles.FirstImported = DateTime.Now;
            mPointFiles.Success       = true;
            //mPointFiles.CurrentImage = Convert.ToByte("");
            // mPointFiles.PreviousImage = Convert.ToByte("");
            int iFileID = bPointFiles.Add(mPointFiles);

            return(iFileID);
        }
Example #8
0
    private int GetFileID(string FileName)
    {
        int FileID = 0;

        try
        {
            PointFiles files = new PointFiles();
            DataSet    ds    = files.GetList(" [Name] = '" + FileName + "' ");
            if (ds == null || ds.Tables.Count < 1 || ds.Tables[0].Rows.Count < 1)
            {
                FileID = 0;
            }
            else
            {
                FileID = int.Parse(ds.Tables[0].Rows[0]["FileID"].ToString());
            }
        }
        catch
        { }
        return(FileID);
    }
    private bool UpdatePointNote(int fileId, DateTime dtNow, string senderName, out string err)
    {
        bool exported = false;

        err = string.Empty;
        try
        {
            LPWeb.BLL.PointFiles   pfMgr   = new PointFiles();
            LPWeb.Model.PointFiles pfModel = pfMgr.GetModel(fileId);
            if (pfModel == null || pfModel.FolderId <= 0 || string.IsNullOrEmpty(pfModel.Name) || string.IsNullOrEmpty(pfModel.CurrentImage))
            {
                exported = true;
                return(exported);
            }
            var req = new AddNoteRequest
            {
                FileId   = fileId,
                Created  = dtNow,//DateTime.Now,
                NoteTime = dtNow,
                Note     = this.txtNote.Text.Trim(),
                Sender   = senderName,
                hdr      = new ReqHdr
                {
                    UserId = this.CurrUser.iUserID
                }
            };
            ServiceManager sm = new ServiceManager();
            using (LP2ServiceClient client = sm.StartServiceClient())
            {
                AddNoteResponse res = client.AddNote(req);
                exported = !res.hdr.Successful ? false : true;
                err      = res.hdr.StatusInfo;
            }
        }
        catch (Exception ex)
        {
            return(exported);
        }
        return(exported);
    }
Example #10
0
    private string CompleteTask(int iLoanTaskId)
    {
        #region complete task

        string sErrorMsg        = string.Empty;
        int    iEmailTemplateId = 0;
        bool   bIsSuccess       = LPWeb.DAL.WorkflowManager.CompleteTask(iLoanTaskId, this.CurrUser.iUserID, ref iEmailTemplateId);

        if (bIsSuccess == false)
        {
            sErrorMsg = "Failed to invoke WorkflowManager.CompleteTask.";
            return(sErrorMsg);
        }

        #endregion

        #region update point file stage

        int iLoanStageID = 0;

        #region get loan task info

        LoanTasks LoanTaskManager = new LoanTasks();
        DataTable LoanTaskInfo    = LoanTaskManager.GetLoanTaskInfo(iLoanTaskId);
        if (LoanTaskInfo.Rows.Count == 0)
        {
            sErrorMsg = "Invalid task id.";
            return(sErrorMsg);
        }
        string sLoanStageID = LoanTaskInfo.Rows[0]["LoanStageId"].ToString();
        if (sLoanStageID == string.Empty)
        {
            sErrorMsg = "Invalid loan stage id.";
            return(sErrorMsg);
        }
        iLoanStageID = Convert.ToInt32(sLoanStageID);

        #endregion
        if (WorkflowManager.StageCompleted(iLoanStageID) == true)
        {
            #region invoke PointManager.UpdateStage()

            //add by  gdc 20111212  Bug #1306
            LPWeb.BLL.PointFiles pfile = new PointFiles();
            var model = pfile.GetModel(iLoanID);
            if (model != null && !string.IsNullOrEmpty(model.Name.Trim()))
            {
                #region UPdatePointFileStage  WCF

                string sError = LoanTaskCommon.UpdatePointFileStage(iLoanID, this.CurrUser.iUserID, iLoanStageID);

                #endregion
            }

            #endregion
        }

        #endregion

        return(sErrorMsg);
    }
        public override bool Work()
        {
            base.Work();
            if (!Init())
            {
                ProgressDialog.HideDialog();
                return(false);
            }
            ParallelLoopResult result = Parallel.ForEach <string>(Files, s => { Analyze(s); });


            //foreach(var file in Files)
            //{
            //    Count++;
            //    StepProgressor.Message = string.Format("正在分析{0},进度{1}/{2}", file, Count,MaxValue);
            //    CanContinue = TrackCancel.Continue();
            //    if (!CanContinue)
            //    {
            //        break;
            //    }
            //    Application.DoEvents();
            //    Analyze(file);
            //    StepProgressor.Step();
            //}

            foreach (var file in Files)
            {
                Count++;
                StepProgressor.Message = string.Format("正在分析{0},进度{1}/{2}", file, Count, MaxValue);
                CanContinue            = TrackCancel.Continue();
                if (!CanContinue)
                {
                    break;
                }
                Application.DoEvents();
                Judge(file);
                StepProgressor.Step();
            }
            StepProgressor.Message = string.Format("正在保存中");
            if (PointFiles.Count > 0)
            {
                var savePoint = string.Format("{0}\\{1}_点.shp", System.IO.Path.GetDirectoryName(this.SaveFilePath), System.IO.Path.GetFileNameWithoutExtension(this.SaveFilePath));
                StepProgressor.Message = string.Format("正在生成文件{0}", savePoint);
                Merge(string.Join(";", PointFiles.ToArray()), savePoint);
            }
            if (PolylineFiles.Count > 0)
            {
                var savePolyline = string.Format("{0}\\{1}_线.shp", System.IO.Path.GetDirectoryName(this.SaveFilePath), System.IO.Path.GetFileNameWithoutExtension(this.SaveFilePath));
                StepProgressor.Message = string.Format("正在生成文件{0}", savePolyline);
                Merge(string.Join(";", PolylineFiles.ToArray()), savePolyline);
            }

            if (PolygonFiles.Count > 0)
            {
                var savePolygon = string.Format("{0}\\{1}_点.shp", System.IO.Path.GetDirectoryName(this.SaveFilePath), System.IO.Path.GetFileNameWithoutExtension(this.SaveFilePath));
                StepProgressor.Message = string.Format("正在生成文件{0}", savePolygon);
                Merge(string.Join(";", PolygonFiles.ToArray()), savePolygon);
            }
            ProgressDialog.HideDialog();
            return(true);
        }
Example #12
0
    protected void Page_Load(object sender, EventArgs e)
    {
        #region 接收参数

        // TaskID
        bool bIsValid = PageCommon.ValidateQueryString(this, "TaskID", QueryStringType.ID);
        if (bIsValid == false)
        {
            this.Response.Write("{\"ExecResult\":\"Failed\",\"ErrorMsg\":\"Missing required query string.\"}");
            return;
        }
        string sTaskID = this.Request.QueryString["TaskID"].ToString();
        int    iTaskID = Convert.ToInt32(sTaskID);

        // LoanID
        bIsValid = PageCommon.ValidateQueryString(this, "LoanID", QueryStringType.ID);
        if (bIsValid == false)
        {
            this.Response.Write("{\"ExecResult\":\"Failed\",\"ErrorMsg\":\"Missing required query string.\"}");
            return;
        }
        string sLoanID = this.Request.QueryString["LoanID"].ToString();
        int    iLoanID = Convert.ToInt32(sLoanID);

        #endregion

        // json示例
        // {"ExecResult":"Success","ErrorMsg":"","EmailTemplateID":"1", "LoanClosed":"Yes"}
        // {"ExecResult":"Failed","ErrorMsg":"执行数据库脚本时发生错误。"}

        string sErrorMsg        = string.Empty;
        string sEmailTemplateID = string.Empty;
        bool   bIsSuccess       = false;
        string LoanClosed       = "No";
        var    result           = "";
        try
        {
            #region complete task

            int iEmailTemplateId = 0;
            bIsSuccess = LPWeb.DAL.WorkflowManager.CompleteTask(iTaskID, this.CurrUser.iUserID, ref iEmailTemplateId);

            if (bIsSuccess == false)
            {
                sErrorMsg = "Failed to invoke WorkflowManager.CompleteTask.";
                return;
            }

            if (iEmailTemplateId != 0)
            {
                sEmailTemplateID = iEmailTemplateId.ToString();
            }

            #endregion

            #region update point file stage

            int iLoanStageID = 0;

            #region get loan task info

            LoanTasks LoanTaskManager = new LoanTasks();
            DataTable LoanTaskInfo    = LoanTaskManager.GetLoanTaskInfo(iTaskID);
            if (LoanTaskInfo.Rows.Count == 0)
            {
                bIsSuccess = false;
                sErrorMsg  = "Invalid task id.";
                return;
            }
            string sLoanStageID = LoanTaskInfo.Rows[0]["LoanStageId"].ToString();
            if (sLoanStageID == string.Empty)
            {
                bIsSuccess = false;
                sErrorMsg  = "Invalid loan stage id.";
                return;
            }
            iLoanStageID = Convert.ToInt32(sLoanStageID);

            #endregion
            bIsSuccess = true;
            if (!WorkflowManager.StageCompleted(iLoanStageID))
            {
                sErrorMsg = "Completed task successfully.";
                return;
            }

            #region invoke PointManager.UpdateStage()

            //add by  gdc 20111212  Bug #1306
            LPWeb.BLL.PointFiles pfile = new PointFiles();
            var model = pfile.GetModel(iLoanID);
            if (model != null && !string.IsNullOrEmpty(model.Name.Trim()))
            {
                #region check Point File Status first
                ServiceManager sm = new ServiceManager();
                using (LP2ServiceClient service = sm.StartServiceClient())
                {
                    CheckPointFileStatusReq checkFileReq = new CheckPointFileStatusReq();
                    checkFileReq.hdr               = new ReqHdr();
                    checkFileReq.hdr.UserId        = CurrUser.iUserID;
                    checkFileReq.hdr.SecurityToken = "SecurityToken";
                    checkFileReq.FileId            = iLoanID;
                    CheckPointFileStatusResp checkFileResp = service.CheckPointFileStatus(checkFileReq);
                    if (checkFileResp == null || checkFileResp.hdr == null || !checkFileResp.hdr.Successful)
                    {
                        sErrorMsg = "Unable to get Point file status from Point Manager.";
                        WorkflowManager.UnCompleteTask(iTaskID, CurrUser.iUserID);
                        bIsSuccess = false;
                        return;
                    }
                    if (checkFileResp.FileLocked)
                    {
                        sErrorMsg = checkFileResp.hdr.StatusInfo;
                        WorkflowManager.UnCompleteTask(iTaskID, CurrUser.iUserID);
                        bIsSuccess = false;
                        return;
                    }
                }
                #endregion
                #region UPdatePointFileStage  WCF
                string sError = LoanTaskCommon.UpdatePointFileStage(iLoanID, this.CurrUser.iUserID, iLoanStageID);

                // the last one, sleep 1 second
                System.Threading.Thread.Sleep(1000);

                if (sError == string.Empty) // success
                {
                    sErrorMsg = "Completed task successfully.";
                }
                else
                {
                    sErrorMsg = "Completed task successfully but failed to update stage date in Point.";
                    //sErrorMsg = "Failed to update point file stage: " + sError.Replace("\"", "\\\"");
                }
                #endregion
            }
            if (WorkflowManager.IsLoanClosed(iLoanID))
            {
                LoanClosed = "Yes";
            }
            return;

            #endregion
        }
        catch (System.ServiceModel.EndpointNotFoundException ee)
        {
            sErrorMsg = "Completed task successfully but failed to update stage date in Point.";
            return;
        }
        catch (Exception ex)
        {
            if (bIsSuccess)
            {
                sErrorMsg = "Completed task successfully but encountered an error:" + ex.Message;
            }
            else
            {
                sErrorMsg = "Failed to complete task, reason:" + ex.Message;
            }
            //sErrorMsg = "Exception happened when invoke WorkflowManager.CompleteTask: " + ex.ToString().Replace("\"", "\\\"");
            bIsSuccess = false;
            return;
        }
        finally
        {
            if (bIsSuccess)
            {
                result = "{\"ExecResult\":\"Success\",\"ErrorMsg\":\"" + sErrorMsg + "\",\"EmailTemplateID\":\"" + sEmailTemplateID + "\",\"TaskID\":\"" + sTaskID + "\",\"LoanClosed\":\"" + LoanClosed + "\"}";
            }
            //result = "{\"ExecResult\":\"Success\",\"ErrorMsg\":\"\",\"EmailTemplateID\":\"" + sEmailTemplateID + "\",\"LoanClosed\":\"" + LoanClosed + "\"}";
            else
            {
                result = "{\"ExecResult\":\"Failed\",\"ErrorMsg\":\"" + sErrorMsg + "\"}";
            }
            this.Response.Write(result);
        }

        #endregion
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        #region 接收参数

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

        // LoanID
        bIsValid = PageCommon.ValidateQueryString(this, "LoanID", QueryStringType.ID);
        if (bIsValid == false)
        {
            this.Response.Write("{\"ExecResult\":\"Failed\",\"ErrorMsg\":\"Missing required query string.\"}");
            this.Response.End();
        }
        string sLoanID = this.Request.QueryString["LoanID"].ToString();
        int    iLoanID = Convert.ToInt32(sLoanID);

        #endregion

        // json示例
        // {"ExecResult":"Success","ErrorMsg":""}
        // {"ExecResult":"Failed","ErrorMsg":"执行数据库脚本时发生错误。"}

        string sErrorMsg = string.Empty;
        int    iLoanStageID;
        bool   StageCompleted = false;

        try
        {
            #region get loan task info

            LoanTasks LoanTaskManager = new LoanTasks();
            DataTable LoanTaskInfo    = LoanTaskManager.GetLoanTaskInfo(iTaskID);
            if (LoanTaskInfo.Rows.Count == 0)
            {
                this.Response.Write("{\"ExecResult\":\"Failed\",\"ErrorMsg\":\"Invalid task id.\"}");
                return;
            }
            string sLoanStageID = LoanTaskInfo.Rows[0]["LoanStageId"].ToString();
            if (sLoanStageID == string.Empty)
            {
                this.Response.Write("{\"ExecResult\":\"Failed\",\"ErrorMsg\":\"Invalid loan stage id.\"}");
                return;
            }
            iLoanStageID = Convert.ToInt32(sLoanStageID);

            #endregion
            #region uncomplete task

            StageCompleted = WorkflowManager.StageCompleted(iLoanStageID);

            bool bIsSuccess = LPWeb.DAL.WorkflowManager.UnCompleteTask(iTaskID, this.CurrUser.iUserID);

            if (bIsSuccess == false)
            {
                this.Response.Write("{\"ExecResult\":\"Failed\",\"ErrorMsg\":\"Failed to invoke WorkflowManager.UnCompleteTask api.\"}");
                return;
            }

            #endregion
        }
        catch (Exception ex)
        {
            sErrorMsg = "Failed to invoke Workflow Manager, reason:" + ex.Message;
            //sErrorMsg = "Exception happened when invoke WorkflowManager.UnCompleteTask: " + ex.ToString().Replace("\"", "\\\"");

            this.Response.Write("{\"ExecResult\":\"Failed\",\"ErrorMsg\":\"" + sErrorMsg + "\"}");
            return;
        }

        if (!StageCompleted)  // if the stage was not completed prior to the un-complete
        {
            this.Response.Write("{\"ExecResult\":\"Success\",\"ErrorMsg\":\"\"}");
            return;
        }
        try
        {
            //add by  gdc 20111212  Bug #1306
            LPWeb.BLL.PointFiles pfile = new PointFiles();
            var model = pfile.GetModel(iLoanID);
            if (model != null && !string.IsNullOrEmpty(model.Name.Trim()))
            {
                #region check Point File Status first
                //ServiceManager sm = new ServiceManager();
                //using (LP2ServiceClient service = sm.StartServiceClient())
                //{
                //    CheckPointFileStatusReq checkFileReq = new CheckPointFileStatusReq();
                //    checkFileReq.hdr = new ReqHdr();
                //    checkFileReq.hdr.UserId = CurrUser.iUserID;
                //    checkFileReq.hdr.SecurityToken = "SecurityToken";
                //    checkFileReq.FileId = iLoanID;
                //    int emailTemplateId = 0;
                //    CheckPointFileStatusResp checkFileResp = service.CheckPointFileStatus(checkFileReq);
                //    if (checkFileResp == null || checkFileResp.hdr == null || !checkFileResp.hdr.Successful)
                //    {
                //        sErrorMsg = "Unable to get Point file status from Point Manager.";
                //        WorkflowManager.CompleteTask(iTaskID, CurrUser.iUserID, ref emailTemplateId);
                //        this.Response.Write("{\"ExecResult\":\"Failed\",\"ErrorMsg\":\"" + sErrorMsg + "\"}");
                //        return;
                //    }
                //    if (checkFileResp.FileLocked)
                //    {
                //        sErrorMsg = checkFileResp.hdr.StatusInfo;
                //        WorkflowManager.CompleteTask(iTaskID, CurrUser.iUserID, ref emailTemplateId);
                //        this.Response.Write("{\"ExecResult\":\"Failed\",\"ErrorMsg\":\"" + sErrorMsg + "\"}");
                //        return;
                //    }
                //}
                #endregion
                #region update point file stage

                string sError = LoanTaskCommon.UpdatePointFileStage(iLoanID, this.CurrUser.iUserID, iLoanStageID);

                // the last one, sleep 1 second
                System.Threading.Thread.Sleep(1000);

                if (sError == string.Empty) // success
                {
                    this.Response.Write("{\"ExecResult\":\"Success\",\"ErrorMsg\":\"\"}");
                }
                else
                {
                    sErrorMsg = "Un-completed task successfully but failed to update stage date in Point.";
                    //sErrorMsg = "Uncomplete task successfully, but failed to update point file stage: " + sError.Replace("\"", "\\\"");

                    this.Response.Write("{\"ExecResult\":\"Failed\",\"ErrorMsg\":\"" + sErrorMsg + "\"}");
                }

                #endregion
            }
            else
            {
                this.Response.Write("{\"ExecResult\":\"Success\",\"ErrorMsg\":\"\"}");
            }
        }
        catch (Exception ex)
        {
            sErrorMsg = "Un-completed task successfully but failed to update stage date in Point, reason:" + ex.Message;
            //sErrorMsg = "Uncomplete task successfully, but exception happened when update point stage: " + ex.ToString().Replace("\"", "\\\"");

            this.Response.Write("{\"ExecResult\":\"Failed\",\"ErrorMsg\":\"" + sErrorMsg + "\"}");
        }
    }
Example #14
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);
    }
Example #15
0
        private void BindPage(int fileId, int hisId)
        {
            BLL.Loans              bllLoans              = new BLL.Loans();
            Model.Loans            modelLoan             = new Model.Loans();
            BLL.Contacts           bllContact            = new BLL.Contacts();
            BLL.Users              bllUser               = new BLL.Users();
            BLL.PointImportHistory bllPointImportHistory = new PointImportHistory();
            BLL.PointFiles         bllPointFiles         = new PointFiles();
            BLL.PointFolders       bllPointFolders       = new PointFolders();

            var dsList = new DataSet();

            if (fileId > 0)
            {
                dsList = bllPointImportHistory.GetList(string.Format("FileId={0}", fileId));
            }
            else if (hisId > 0)
            {
                dsList = bllPointImportHistory.GetList(string.Format("HistoryId={0}", hisId));
            }

            if (dsList == null || dsList.Tables.Count == 0 || dsList.Tables[0].Rows.Count == 0)
            {
                PageCommon.AlertMsg(this, "There is no data in database.");
                return;
            }

            fileId         = int.Parse(dsList.Tables[0].Rows[0]["FileId"].ToString());
            hfdHisId.Value = fileId.ToString();
            var modelPointFiles = bllPointFiles.GetModel(fileId);

            if (modelPointFiles != null)
            {
                var modelPointFolder = bllPointFolders.GetModel(modelPointFiles.FolderId);
                if (modelPointFolder != null)
                {
                    lblPointFile.Text = modelPointFolder.Name + modelPointFiles.Name;
                }
            }

            lblBorrower.Text    = bllContact.GetBorrower(fileId);
            lblLoanOfficer.Text = bllUser.GetLoanOfficer(fileId);



            // Start: get icon name by fileId, 2010-11-15
            if (string.IsNullOrEmpty(imgSrc))
            {
                string strSeverity = dsList.Tables[0].Rows[0]["Severity"].ToString().ToLower();
                switch (strSeverity)
                {
                case "error":
                    imgIcon.Src = "../images/loan/AlertError.png";
                    break;

                case "warning":
                    imgIcon.Src = "../images/loan/AlertWarning.png";
                    break;

                default:
                    imgIcon.Visible = false;
                    break;
                }
            }
            else
            {
                imgIcon.Src = "../images/loan/" + imgSrc;
            }
            // End: get icon name by fileId, 2010-11-15

            DateTime dt = DateTime.MinValue;

            DateTime.TryParse(dsList.Tables[0].Rows[0]["ImportTime"].ToString(), out dt);

            if (dt != DateTime.MinValue)
            {
                lblTime.Text = dt.ToString("MM/dd/yyyy hh:mm:ss");
            }

            if (!string.IsNullOrEmpty(dsList.Tables[0].Rows[0]["Error"].ToString()))
            {
                string s1 = dsList.Tables[0].Rows[0]["Error"].ToString().Trim();
                s1 = s1.Replace("<br/>  ", "\r\n");
                s1 = s1.Replace("<br/> ", "\r\n");
                s1 = s1.Replace("<br/>", "\r\n");
                tbxErrorMessages.Text = s1;
            }
        }