Beispiel #1
0
    /// <summary>
    /// Binds the page.
    /// </summary>
    private void BindPage()
    {
        if (CurrentFileId < 1)
        {
            PageCommon.WriteJsEnd(this, sErrorMsg, "window.location.href='" + sReturnPage + "'");
            return;
        }

        DataSet ds = bllStages.GetLoanStageSetupInfo(CurrentFileId);

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

        foreach (DataRow LoanStageRow in ds.Tables[0].Rows)
        {
            int iLoanStageId = Convert.ToInt32(LoanStageRow["LoanStageId"]);

            LoanStages LoanStagesMrg = new LoanStages();
            DataTable  LoanStageInfo = LoanStagesMrg.GetList(" LoanStageId=" + iLoanStageId).Tables[0];

            if (LoanStageInfo.Rows.Count > 0)
            {
                #region 获取Template_Stage.Alias

                string sWflStageName = LoanStageInfo.Rows[0]["StageName"].ToString();
                string sDiaplayAs    = LoanStageInfo.Rows[0]["StageName"].ToString();

                if (LoanStageInfo.Rows[0]["WflStageId"] != DBNull.Value)
                {
                    string sWflStageId = LoanStageInfo.Rows[0]["WflStageId"].ToString();

                    Template_Wfl_Stages Template_Wfl_Stages1     = new Template_Wfl_Stages();
                    DataTable           Template_Wfl_Stages_info = Template_Wfl_Stages1.GetList(" WflStageId=" + sWflStageId).Tables[0];
                    if (Template_Wfl_Stages_info.Rows.Count > 0)
                    {
                        sWflStageName = Template_Wfl_Stages_info.Rows[0]["Name"].ToString();

                        string sTemplStageId = Template_Wfl_Stages_info.Rows[0]["TemplStageId"].ToString();
                        if (sTemplStageId != string.Empty)
                        {
                            Template_Stages Template_Stages1    = new Template_Stages();
                            DataTable       Template_Stage_Info = Template_Stages1.GetStageTemplateList(" and TemplStageId=" + sTemplStageId);
                            if (Template_Stage_Info.Rows.Count > 0)
                            {
                                string sAlias = Template_Stage_Info.Rows[0]["Alias"].ToString();
                                if (sAlias != string.Empty)
                                {
                                    sDiaplayAs = sAlias;
                                }
                            }
                        }
                    }
                }

                LoanStageRow["StageName"] = sWflStageName;
                LoanStageRow["Alias"]     = sDiaplayAs;

                #endregion
            }
        }



        DateTime dtMin = DateTime.MinValue;
        if (DateTime.TryParse(ds.Tables[0].Rows[0]["EstCloseDate"].ToString(), out dtMin))
        {
            tbxTargetCloseDate.Text = dtMin.ToShortDateString();
        }
        Loans             loanMgr   = new Loans();
        LPWeb.Model.Loans loanModel = loanMgr.GetModel(CurrentFileId);
        if (loanModel.EstCloseDate != null)
        {
            tbxTargetCloseDate.Text = loanModel.EstCloseDate.Value.ToShortDateString();
        }
        gvWfGrid.DataSource = ds;
        gvWfGrid.DataBind();
    }
Beispiel #2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        #region 检查必要参数

        string sErrorJs = string.Empty;
        if (this.Request.QueryString["CloseDialogCodes"] == null)
        {
            sErrorJs = "window.parent.RefreshPage();";
        }
        else
        {
            sErrorJs = this.Request.QueryString["CloseDialogCodes"] + ";";
        }

        bool bIsValid = PageCommon.ValidateQueryString(this, "LoanID", QueryStringType.ID);
        if (bIsValid == false)
        {
            PageCommon.RegisterJsMsg(this, "Missing required query string.", sErrorJs);
            return;
        }

        this.iLoanID = Convert.ToInt32(this.Request.QueryString["LoanID"]);

        bIsValid = PageCommon.ValidateQueryString(this, "TaskID", QueryStringType.ID);
        if (bIsValid == false)
        {
            PageCommon.RegisterJsMsg(this, "Missing required query string.", sErrorJs);
            return;
        }

        this.iTaskID = Convert.ToInt32(this.Request.QueryString["TaskID"]);

        #endregion

        #region 加载Loan Task信息

        this.LoanTaskInfo = this.LoanTaskManager.GetLoanTaskInfo(this.iTaskID);
        if (this.LoanTaskInfo.Rows.Count == 0)
        {
            PageCommon.RegisterJsMsg(this, "Invalid required query string.", sErrorJs);
            return;
        }

        #endregion

        #region 检查是否是Prerequisite(is a father?)

        bool bIsPrerequisite = this.LoanTaskManager.IsPrerequisite(this.iTaskID);
        this.hndIsPrerequisite.Value = bIsPrerequisite.ToString();

        #endregion

        #region 加载LoanInfo信息

        DataTable LoanInfo = this.LoanManager.GetLoanInfo(this.iLoanID);
        if (LoanInfo.Rows.Count == 0)
        {
            PageCommon.RegisterJsMsg(this, "Invalid required query string.", sErrorJs);
            return;
        }

        // 存储Loan.EstCloseDate
        if (LoanInfo.Rows[0]["EstCloseDate"] != DBNull.Value)
        {
            this.hdnEstCloseDate.Value = Convert.ToDateTime(LoanInfo.Rows[0]["EstCloseDate"]).ToString("MM/dd/yyyy");
        }

        #endregion



        if (this.IsPostBack == false)
        {
            #region 加载Owner

            DataTable OwnerList = this.LoanTaskManager.GetLoanTaskOwers(this.iLoanID);

            DataRow EmptyOwnerRow = OwnerList.NewRow();
            EmptyOwnerRow["UserID"]   = 0;
            EmptyOwnerRow["FullName"] = "-- select --";
            OwnerList.Rows.InsertAt(EmptyOwnerRow, 0);

            this.ddlOwner.DataSource = OwnerList;
            this.ddlOwner.DataBind();

            // 绑定Owner
            this.ddlOwner.SelectedValue = this.CurrUser.iUserID.ToString();

            #endregion

            #region 加载ddlTaskList for TaskNaem

            LeadTaskList LeadTaskListMgr = new LeadTaskList();

            string sOrderBy = string.Empty;
            if (this.CurrUser.SortTaskPickList == "S")
            {
                sOrderBy = "SequenceNumber";
            }
            else
            {
                sOrderBy = "TaskName";
            }

            DataTable LeadTaskList1 = LeadTaskListMgr.GetLeadTaskList(" and Enabled=1", sOrderBy);

            DataRow EmptyTaskRow = LeadTaskList1.NewRow();
            EmptyTaskRow["TaskName"] = "-- select --";
            LeadTaskList1.Rows.InsertAt(EmptyTaskRow, 0);

            this.ddlTaskList.DataSource = LeadTaskList1;
            this.ddlTaskList.DataBind();

            #endregion

            #region 加载Prerequisite

            int iCurrentLoanStageId = Convert.ToInt32(this.LoanTaskInfo.Rows[0]["LoanStageId"]);

            DataTable PrerequisiteList    = this.LoanTaskManager.GetPrerequisiteList(" and FileID=" + this.iLoanID + " and LoanStageId = " + iCurrentLoanStageId + " and PrerequisiteTaskId is null");
            DataRow   NonePrerequisiteRow = PrerequisiteList.NewRow();
            NonePrerequisiteRow["LoanTaskId"] = 0;
            NonePrerequisiteRow["Name"]       = "None";
            PrerequisiteList.Rows.InsertAt(NonePrerequisiteRow, 0);

            this.ddlPrerequisite.DataSource = PrerequisiteList;
            this.ddlPrerequisite.DataBind();

            this.ddlPrerequisite2.DataSource = PrerequisiteList;
            this.ddlPrerequisite2.DataBind();

            #endregion

            #region 加载email template

            Template_Email EmailTempManager = new Template_Email();
            this.EmailTemplates = EmailTempManager.GetEmailTemplate(" and Enabled = 1");

            DataRow NoneEmailTemplateRow = this.EmailTemplates.NewRow();
            NoneEmailTemplateRow["TemplEmailId"] = 0;
            NoneEmailTemplateRow["Name"]         = "None";
            this.EmailTemplates.Rows.InsertAt(NoneEmailTemplateRow, 0);

            this.ddlWarningEmail.DataSource = this.EmailTemplates;
            this.ddlWarningEmail.DataBind();

            this.ddlOverdueEmail.DataSource = this.EmailTemplates;
            this.ddlOverdueEmail.DataBind();

            this.ddlEmailTemplate.DataSource = this.EmailTemplates;
            this.ddlEmailTemplate.DataBind();

            #endregion

            #region completion email list

            LPWeb.BLL.LoanTask_CompletionEmails bllTaskMail = new LoanTask_CompletionEmails();

            gridCompletetionEmails.DataSource = bllTaskMail.GetList("LoanTaskid=" + iTaskID);
            gridCompletetionEmails.DataBind();

            #endregion

            #region Stage

            //Template_Stages stage = new Template_Stages();
            //var dtStage = stage.GetStageTemplateList(" And [Enabled] = 1 order by  SequenceNumber ");

            LoanStages ls      = new LoanStages();
            var        dtStage = ls.GetLoanStageSetupInfo(iLoanID);

            ddlStage.DataSource = dtStage;
            ddlStage.DataBind();


            #endregion

            #region Bind Data

            ddlStage.SelectedValue = this.LoanTaskInfo.Rows[0]["LoanStageId"].ToString();

            this.radTaskName.Checked = true;
            this.txtTaskName.Text    = this.LoanTaskInfo.Rows[0]["Name"].ToString();
            this.txtDescription.Text = this.LoanTaskInfo.Rows[0]["Desc"].ToString();

            #region Owner

            string sOwnerID = this.LoanTaskInfo.Rows[0]["Owner"].ToString();
            if (sOwnerID == string.Empty)
            {
                this.ddlOwner.SelectedIndex = 0;
            }
            else
            {
                this.ddlOwner.SelectedValue = sOwnerID;
            }

            #endregion

            #region Due Date

            string sDueDate = this.LoanTaskInfo.Rows[0]["Due"].ToString();
            if (sDueDate != string.Empty)
            {
                this.txtDueDate.Text = Convert.ToDateTime(this.LoanTaskInfo.Rows[0]["Due"]).ToString("MM/dd/yyyy");
            }

            string sDueTime = this.LoanTaskInfo.Rows[0]["DueTime"].ToString();
            if (sDueTime != string.Empty)
            {
                TimeSpan DueTime = TimeSpan.Parse(this.LoanTaskInfo.Rows[0]["DueTime"].ToString());
                this.txtDueTime.Text = DueTime.ToString().Substring(0, 5);

                ddlDueTime_hour.SelectedValue = DueTime.Hours.ToString();
                ddlDueTime_min.SelectedValue  = ((DueTime.Minutes / 5) * 5).ToString();
            }

            #endregion

            //#region Completed Date

            string sCompletedDate = this.LoanTaskInfo.Rows[0]["Completed"].ToString();
            if (sCompletedDate != string.Empty)
            {
                this.chkCompleted.Checked  = true;
                this.txtCompletedDate.Text = Convert.ToDateTime(this.LoanTaskInfo.Rows[0]["Completed"]).ToString("MM/dd/yyyy");
                this.hdnCompleted.Value    = Convert.ToDateTime(this.LoanTaskInfo.Rows[0]["Completed"]).ToString("MM/dd/yyyy");
            }

            //#endregion

            this.txtDaysToEst.Text         = this.LoanTaskInfo.Rows[0]["DaysDueFromEstClose"] == DBNull.Value ? string.Empty : this.LoanTaskInfo.Rows[0]["DaysDueFromEstClose"].ToString();
            this.txtDaysAfterCreation.Text = this.LoanTaskInfo.Rows[0]["DaysFromCreation"] == DBNull.Value ? string.Empty : this.LoanTaskInfo.Rows[0]["DaysFromCreation"].ToString();

            this.txtDaysDueAfterPrevStage.Text = this.LoanTaskInfo.Rows[0]["DaysDueAfterPrevStage"] == DBNull.Value ? string.Empty : this.LoanTaskInfo.Rows[0]["DaysDueAfterPrevStage"].ToString();

            #region Prerequisite Task Id

            string sPrerequisiteTaskId = this.LoanTaskInfo.Rows[0]["PrerequisiteTaskId"] == DBNull.Value ? string.Empty : this.LoanTaskInfo.Rows[0]["PrerequisiteTaskId"].ToString();
            if (sPrerequisiteTaskId == string.Empty)
            {
                this.ddlPrerequisite.SelectedIndex = 0;
            }
            else
            {
                this.ddlPrerequisite.SelectedValue = sPrerequisiteTaskId;
            }

            #endregion

            this.txtDaysDueAfter.Text = LoanTaskInfo.Rows[0]["DaysDueAfterPrerequisite"] == DBNull.Value ? string.Empty : this.LoanTaskInfo.Rows[0]["DaysDueAfterPrerequisite"].ToString();



            #region Warning Email

            string sWarningEmailId = this.LoanTaskInfo.Rows[0]["WarningEmailId"].ToString();
            if (sWarningEmailId == string.Empty)
            {
                this.ddlWarningEmail.SelectedIndex = 0;
            }
            else
            {
                this.ddlWarningEmail.SelectedValue = sWarningEmailId;
            }

            #endregion

            #region Overdue Email

            string sOverdueEmailId = this.LoanTaskInfo.Rows[0]["OverdueEmailId"].ToString();
            if (sOverdueEmailId == string.Empty)
            {
                this.ddlOverdueEmail.SelectedIndex = 0;
            }
            else
            {
                this.ddlOverdueEmail.SelectedValue = sOverdueEmailId;
            }

            #endregion

            #endregion
        }
    }
Beispiel #3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        #region 检查必要参数

        string sErrorJs = string.Empty;
        if (this.Request.QueryString["CloseDialogCodes"] == null)
        {
            sErrorJs = "window.parent.RefreshPage();";
        }
        else
        {
            sErrorJs = this.Request.QueryString["CloseDialogCodes"] + ";";
        }

        bool bIsValid = PageCommon.ValidateQueryString(this, "LoanID", QueryStringType.ID);
        if (bIsValid == false)
        {
            PageCommon.RegisterJsMsg(this, "Missing required query string.", sErrorJs);
            return;
        }

        this.iLoanID = Convert.ToInt32(this.Request.QueryString["LoanID"]);

        #endregion

        #region 校验LoanId

        DataTable LoanInfo = this.LoanManager.GetLoanInfo(this.iLoanID);
        if (LoanInfo.Rows.Count == 0)
        {
            PageCommon.RegisterJsMsg(this, "Invalid required query string.", sErrorJs);
            return;
        }

        // 存储Loan.EstCloseDate
        if (LoanInfo.Rows[0]["EstCloseDate"] != DBNull.Value)
        {
            this.hdnEstCloseDate.Value = Convert.ToDateTime(LoanInfo.Rows[0]["EstCloseDate"]).ToString("MM/dd/yyyy");
        }

        this.iCurrentLoanStageId = WorkflowManager.GetCurrentLoanStageId(this.iLoanID);

        bIsValid = PageCommon.ValidateQueryString(this, "Stage", QueryStringType.ID);
        if (bIsValid == true)
        {
            int    iout   = 0;
            string sStage = this.Request.QueryString["Stage"];
            if (Int32.TryParse(sStage, out iout))
            {
                this.iCurrentLoanStageId = iout;
            }
        }

        #endregion

        if (this.IsPostBack == false)
        {
            #region 加载Owner

            DataTable OwnerList = this.LoanTaskManager.GetLoanTaskOwers(this.iLoanID);

            DataRow EmptyOwnerRow = OwnerList.NewRow();
            EmptyOwnerRow["UserID"]   = 0;
            EmptyOwnerRow["FullName"] = "-- select --";
            OwnerList.Rows.InsertAt(EmptyOwnerRow, 0);

            this.ddlOwner.DataSource = OwnerList;
            this.ddlOwner.DataBind();

            // 绑定Owner
            this.ddlOwner.SelectedValue = this.CurrUser.iUserID.ToString();

            #endregion

            #region 加载ddlTaskList for TaskNaem

            LeadTaskList LeadTaskListMgr = new LeadTaskList();

            string sOrderBy = string.Empty;
            if (this.CurrUser.SortTaskPickList == "S")
            {
                sOrderBy = "SequenceNumber";
            }
            else
            {
                sOrderBy = "TaskName";
            }

            DataTable LeadTaskList1 = LeadTaskListMgr.GetLeadTaskList(" and Enabled=1", sOrderBy);

            DataRow EmptyTaskRow = LeadTaskList1.NewRow();
            EmptyTaskRow["TaskName"] = "-- select --";
            LeadTaskList1.Rows.InsertAt(EmptyTaskRow, 0);

            this.ddlTaskList.DataSource = LeadTaskList1;
            this.ddlTaskList.DataBind();

            #endregion

            // set default value
            this.txtDueDate.Text = DateTime.Now.ToString("MM/dd/yyyy");
            //this.txtDueTime.Text = DateTime.Now.AddMinutes(15).ToShortTimeString();
            this.ddlDueTime_hour.SelectedValue = DateTime.Now.Hour.ToString("00");
            this.ddlDueTime_min.SelectedValue  = (DateTime.Now.AddMinutes(15).Minute / 5 * 5).ToString();

            #region 加载Prerequisite

            DataTable PrerequisiteList    = this.LoanTaskManager.GetPrerequisiteList(" and FileID=" + this.iLoanID + " and LoanStageId = " + iCurrentLoanStageId + " and PrerequisiteTaskId is null");
            DataRow   NonePrerequisiteRow = PrerequisiteList.NewRow();
            NonePrerequisiteRow["LoanTaskId"] = 0;
            NonePrerequisiteRow["Name"]       = "None";
            PrerequisiteList.Rows.InsertAt(NonePrerequisiteRow, 0);

            this.ddlPrerequisite.DataSource = PrerequisiteList;
            this.ddlPrerequisite.DataBind();

            this.ddlPrerequisite2.DataSource = PrerequisiteList;
            this.ddlPrerequisite2.DataBind();

            #endregion

            #region 加载email template

            Template_Email EmailTempManager = new Template_Email();
            DataTable      EmailTemplates   = EmailTempManager.GetEmailTemplate(" and Enabled = 1");

            DataRow NoneEmailTemplateRow = EmailTemplates.NewRow();
            NoneEmailTemplateRow["TemplEmailId"] = 0;
            NoneEmailTemplateRow["Name"]         = "None";
            EmailTemplates.Rows.InsertAt(NoneEmailTemplateRow, 0);

            this.ddlWarningEmail.DataSource = EmailTemplates;
            this.ddlWarningEmail.DataBind();

            this.ddlOverdueEmail.DataSource = EmailTemplates;
            this.ddlOverdueEmail.DataBind();

            this.ddlEmailTemplate.DataSource = EmailTemplates;
            this.ddlEmailTemplate.DataBind();

            #endregion

            #region completion email list

            gridCompletetionEmails.DataSource = null;
            gridCompletetionEmails.DataBind();

            #endregion


            #region Stage

            //Template_Stages stage = new Template_Stages();
            //var dtStage = stage.GetStageTemplateList(" And [Enabled] = 1 order by  SequenceNumber ");

            LoanStages ls      = new LoanStages();
            var        dtStage = ls.GetLoanStageSetupInfo(iLoanID);

            ddlStage.DataSource = dtStage;
            ddlStage.DataBind();

            ddlStage.SelectedValue = this.iCurrentLoanStageId.ToString();
            #endregion
        }
    }