protected void Page_Load(object sender, EventArgs e) { // __doPostBack this.GetPostBackEventReference(this.btnSave); if (Request.Url != null) { FromURL = Request.Url.ToString(); } if (this.IsPostBack == false) { #region build ddlSeq options StringBuilder sbSeqOptions = new StringBuilder(); for (int i = 0; i < 999; i++) { int iSeq = i + 1; sbSeqOptions.AppendLine("<option value=\"" + iSeq + "\">" + iSeq + "</option>"); } this.ltrSeqOptions.Text = sbSeqOptions.ToString(); #endregion #region 加载Stage Template List Template_Stages StageTemplateManager = new Template_Stages(); // Processing and Prospect DataTable StageTemplateList = StageTemplateManager.GetStageTemplateList(" and [Enabled]=1"); this.ddlStageTemplateList.DataSource = StageTemplateList; this.ddlStageTemplateList.DataBind(); // Processing DataView StageTemplateListView1 = new DataView(StageTemplateList); StageTemplateListView1.RowFilter = "WorkflowType='Processing'"; DataTable StageTemplateList1 = this.AddSelectStageRow(StageTemplateListView1.ToTable()); this.ddlStageProcessing.DataSource = StageTemplateList1; this.ddlStageProcessing.DataBind(); // Prospect DataView StageTemplateListView2 = new DataView(StageTemplateList); StageTemplateListView2.RowFilter = "WorkflowType='Prospect'"; DataTable StageTemplateList2 = this.AddSelectStageRow(StageTemplateListView2.ToTable()); this.ddlStageProspect.DataSource = StageTemplateList2; this.ddlStageProspect.DataBind(); #endregion } }
private void BindStage() { DataSet ds = new DataSet(); try { if (WflTemplId == 0) { Template_Stages stage = new Template_Stages(); ds = stage.GetList(""); if (ds == null || ds.Tables.Count < 1 || ds.Tables[0].Rows.Count < 1) { return; } ddlStage.DataValueField = "TemplStageId"; ddlStage.DataTextField = "Name"; ddlStage.DataSource = ds; ddlStage.DataBind(); ddlStage.Items.Insert(0, new ListItem("All", "0")); } else { Template_Wfl_Stages stage = new Template_Wfl_Stages(); ds = stage.GetList(0, "WflTemplId = " + WflTemplId.ToString(), "SequenceNumber"); if (ds == null || ds.Tables.Count < 1 || ds.Tables[0].Rows.Count < 1) { return; } ddlStage.DataValueField = "WflStageId"; ddlStage.DataTextField = "Name"; ddlStage.DataSource = ds; ddlStage.DataBind(); ddlStage.Items.Insert(0, new ListItem("All", "0")); txbEstClose.Text = ds.Tables[0].Rows[0]["DaysFromEstClose"].ToString(); } } catch { } }
/// <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(); }
protected void Page_Load(object sender, EventArgs e) { #region 校验必要参数 // WorkflowTemplateID bool bIsValid = PageCommon.ValidateQueryString(this, "WorkflowTemplateID", QueryStringType.ID); if (bIsValid == false) { PageCommon.WriteJsEnd(this, "Missing required query string.", "window.parent.location.href=window.parent.location.href"); } this.iWorkflowTemplateID = Convert.ToInt32(this.Request.QueryString["WorkflowTemplateID"]); #endregion if (Request.Url != null) { FromURL = Request.Url.ToString(); } Template_Workflow WorkflowTemplateManager = new Template_Workflow(); #region 加载Workflow Template信息 DataTable WorkflowTemplateInfo = WorkflowTemplateManager.GetWorkflowTemplateInfo(this.iWorkflowTemplateID); if (WorkflowTemplateInfo.Rows.Count == 0) { PageCommon.WriteJsEnd(this, "Invalid required query string.", "window.parent.location.href=window.parent.location.href"); } #endregion // is custom this.hdnIsCustom.Text = WorkflowTemplateInfo.Rows[0]["Custom"].ToString(); this.gWorkflowType = WorkflowTemplateInfo.Rows[0]["WorkflowType"].ToString(); // __doPostBack this.GetPostBackEventReference(this.btnSave); if (this.IsPostBack == false) { #region build ddlSeq options StringBuilder sbSeqOptions = new StringBuilder(); for (int i = 0; i < 999; i++) { int iSeq = i + 1; sbSeqOptions.AppendLine("<option value=\"" + iSeq + "\">" + iSeq + "</option>"); } this.ltrSeqOptions.Text = sbSeqOptions.ToString(); #endregion #region 加载Stage Template List Template_Stages StageTemplateManager = new Template_Stages(); // Processing and Prospect DataTable StageTemplateList = StageTemplateManager.GetStageTemplateList(" and [Enabled]=1"); this.ddlStageTemplateList.DataSource = StageTemplateList; this.ddlStageTemplateList.DataBind(); // Processing DataView StageTemplateListView1 = new DataView(StageTemplateList); StageTemplateListView1.RowFilter = "WorkflowType='Processing'"; this.StageTemplateList1 = this.AddSelectStageRow(StageTemplateListView1.ToTable()); this.ddlStageProcessing.DataSource = StageTemplateList1; this.ddlStageProcessing.DataBind(); // Prospect DataView StageTemplateListView2 = new DataView(StageTemplateList); StageTemplateListView2.RowFilter = "WorkflowType='Prospect'"; this.StageTemplateList2 = this.AddSelectStageRow(StageTemplateListView2.ToTable()); this.ddlStageProspect.DataSource = StageTemplateList2; this.ddlStageProspect.DataBind(); #endregion #region 绑定数据 if (WorkflowTemplateInfo.Rows[0]["Name"] == DBNull.Value) { this.txtWorkflowTemplate.Text = ""; } else { this.txtWorkflowTemplate.Text = WorkflowTemplateInfo.Rows[0]["Name"].ToString(); } if ((WorkflowTemplateInfo.Rows[0]["WorkflowType"] == DBNull.Value) || (WorkflowTemplateInfo.Rows[0]["WorkflowType"].ToString() == "")) { this.ddlWorkflowType.SelectedValue = "Processing"; } else { //this.ddlWorkflowType.SelectedValue = WorkflowTemplateInfo.Rows[0]["WorkflowType"].ToString(); if (WorkflowTemplateInfo.Rows[0]["WorkflowType"].ToString().ToUpper() == "PROCESSING") { this.ddlWorkflowType.SelectedValue = "Processing"; } if (WorkflowTemplateInfo.Rows[0]["WorkflowType"].ToString().ToUpper() == "PROSPECT") { this.ddlWorkflowType.SelectedValue = "Prospect"; } } if (WorkflowTemplateInfo.Rows[0]["Desc"] != DBNull.Value) { this.txtDesc.Text = WorkflowTemplateInfo.Rows[0]["Desc"].ToString(); } if (WorkflowTemplateInfo.Rows[0]["Enabled"] == DBNull.Value) { this.chkEnabled.Checked = false; } else { this.chkEnabled.Checked = Convert.ToBoolean(WorkflowTemplateInfo.Rows[0]["Enabled"]); } // cr47 if (this.chkEnabled.Checked == true) { this.btnRegen.Disabled = false; } else { this.btnRegen.Disabled = true; } if (WorkflowTemplateInfo.Rows[0]["CalculationMethod"] == DBNull.Value) { this.ddlCalcDueDateMethod.SelectedValue = "Est Close Date"; } else if (WorkflowTemplateInfo.Rows[0]["CalculationMethod"].ToString() == "1") { this.ddlCalcDueDateMethod.SelectedValue = "Est Close Date"; } else if (WorkflowTemplateInfo.Rows[0]["CalculationMethod"].ToString() == "2") { this.ddlCalcDueDateMethod.SelectedValue = "Creation Date"; } else { this.ddlCalcDueDateMethod.SelectedValue = "Completion Date of the previous Stage"; } //this.ddlCalcDueDateMethod.SelectedValue = WorkflowTemplateInfo.Rows[0]["CalculationMethod"].ToString() == "1" ? "Est Close Date" : "Creation Date"; if (WorkflowTemplateInfo.Rows[0]["Default"] == DBNull.Value) { this.chkDefault.Checked = false; } else { this.chkDefault.Checked = Convert.ToBoolean(WorkflowTemplateInfo.Rows[0]["Default"]); } #endregion #region 加载Workflow Stage List DataTable WflStageListData = WorkflowTemplateManager.GetWflStageList(this.iWorkflowTemplateID); this.gridStageList.DataSource = WflStageListData; this.gridStageList.DataBind(); #endregion // set counter this.hdnCounter.Value = WflStageListData.Rows.Count.ToString(); } }
protected void Page_Load(object sender, EventArgs e) { if (this.IsPostBack == false) { #region Organizations #region Region Regions RegionMgr = new Regions(); DataTable RegionList = null; if (this.CurrUser.sRoleName == "Executive") { RegionList = RegionMgr.GetRegionFilter_Executive(this.CurrUser.iUserID); } else if (this.CurrUser.sRoleName == "Branch Manager") { RegionList = RegionMgr.GetRegionFilter_Branch_Manager(this.CurrUser.iUserID); } else { RegionList = RegionMgr.GetUserRegions(this.CurrUser.iUserID); } if (RegionList.Rows.Count > 0) { DataRow NewRegionRow = RegionList.NewRow(); NewRegionRow["RegionID"] = 0; NewRegionRow["Name"] = "ALL"; RegionList.Rows.InsertAt(NewRegionRow, 0); } this.ddlRegion.DataSource = RegionList; this.ddlRegion.DataBind(); #endregion #region Division Divisions DivisionMgr = new Divisions(); DataTable DivisionList = null; if (this.CurrUser.sRoleName == "Executive") { DivisionList = DivisionMgr.GetDivisionFilter_Executive(this.CurrUser.iUserID, 0); } else if (this.CurrUser.sRoleName == "Branch Manager") { DivisionList = DivisionMgr.GetDivisionFilter_Branch_Manager(this.CurrUser.iUserID, 0); } else { DivisionList = DivisionMgr.GetDivisionFilter(this.CurrUser.iUserID, 0); } if (DivisionList.Rows.Count > 0) { DataRow NewDivisionRow = DivisionList.NewRow(); NewDivisionRow["DivisionID"] = 0; NewDivisionRow["Name"] = "ALL"; DivisionList.Rows.InsertAt(NewDivisionRow, 0); } this.ddlDivision.DataSource = DivisionList; this.ddlDivision.DataBind(); #endregion #region Branch Branches BranchMgr = new Branches(); DataTable BranchList = null; if (this.CurrUser.sRoleName == "Executive") { BranchList = BranchMgr.GetBranchFilter_Executive(this.CurrUser.iUserID, 0, 0); } else if (this.CurrUser.sRoleName == "Branch Manager") { BranchList = BranchMgr.GetBranchFilter_Branch_Manager(this.CurrUser.iUserID, 0, 0); } else { BranchList = BranchMgr.GetBranchFilter(this.CurrUser.iUserID, 0, 0); } if (BranchList.Rows.Count > 0) { DataRow NewBranchRow = BranchList.NewRow(); NewBranchRow["BranchID"] = 0; NewBranchRow["Name"] = "ALL"; BranchList.Rows.InsertAt(NewBranchRow, 0); } this.ddlBranch.DataSource = BranchList; this.ddlBranch.DataBind(); #endregion #region PointFolder PointFolders PointFolderMgr = new PointFolders(); DataTable PointFolderList = null; if (this.CurrUser.sRoleName == "Executive") { PointFolderList = PointFolderMgr.GetPointFolder_Executive(this.CurrUser.iUserID, "0", "0", "0"); } else if (this.CurrUser.sRoleName == "Branch Manager") { PointFolderList = PointFolderMgr.GetPointFolder_BranchManager(this.CurrUser.iUserID, "0", "0", "0"); } else { PointFolderList = PointFolderMgr.GetPointFolder_User(this.CurrUser.iUserID, "0", "0", "0"); } if (PointFolderList.Rows.Count > 0) { DataRow NewPointFolderRow = PointFolderList.NewRow(); NewPointFolderRow["FolderID"] = 0; NewPointFolderRow["Name"] = "ALL"; PointFolderList.Rows.InsertAt(NewPointFolderRow, 0); } this.ddlFolder.DataSource = PointFolderList; this.ddlFolder.DataBind(); #endregion #endregion #region Users and Borrower #region Loan Officer DataTable LoanRolesList = this.GetLoanOfficerList(CurrUser.iUserID); DataRow NewLoanRoleRow = null; if (LoanRolesList.Rows.Count > 0) { NewLoanRoleRow = LoanRolesList.NewRow(); NewLoanRoleRow["ID"] = 0; NewLoanRoleRow["Name"] = "ALL"; LoanRolesList.Rows.InsertAt(NewLoanRoleRow, 0); } this.ddlLoanOfficer.DataSource = LoanRolesList; this.ddlLoanOfficer.DataBind(); #endregion #region Loan Officer Assistant LoanRolesList = this.GetLoanRolesList("Assistant"); if (LoanRolesList.Rows.Count > 0) { NewLoanRoleRow = LoanRolesList.NewRow(); NewLoanRoleRow["Name"] = "ALL"; LoanRolesList.Rows.InsertAt(NewLoanRoleRow, 0); } this.ddlLoanOfficerAssistant.DataSource = LoanRolesList; this.ddlLoanOfficerAssistant.DataBind(); #endregion #region Processor LoanRolesList = this.GetProcessorList(); if (LoanRolesList.Rows.Count > 0) { NewLoanRoleRow = LoanRolesList.NewRow(); NewLoanRoleRow["ID"] = 0; NewLoanRoleRow["Name"] = "ALL"; LoanRolesList.Rows.InsertAt(NewLoanRoleRow, 0); } this.ddlProcessor.DataSource = LoanRolesList; this.ddlProcessor.DataBind(); #endregion #region Jr Processor LoanRolesList = this.GetLoanRolesList("JrProcessor"); if (LoanRolesList.Rows.Count > 0) { NewLoanRoleRow = LoanRolesList.NewRow(); NewLoanRoleRow["Name"] = "ALL"; LoanRolesList.Rows.InsertAt(NewLoanRoleRow, 0); } this.ddlJrProcessor.DataSource = LoanRolesList; this.ddlJrProcessor.DataBind(); #endregion #region Doc Prep LoanRolesList = this.GetLoanRolesList("DocPrep"); if (LoanRolesList.Rows.Count > 0) { NewLoanRoleRow = LoanRolesList.NewRow(); NewLoanRoleRow["Name"] = "ALL"; LoanRolesList.Rows.InsertAt(NewLoanRoleRow, 0); } this.ddlDocPrep.DataSource = LoanRolesList; this.ddlDocPrep.DataBind(); #endregion #region Shipper LoanRolesList = this.GetLoanRolesList("Shipper"); if (LoanRolesList.Rows.Count > 0) { NewLoanRoleRow = LoanRolesList.NewRow(); NewLoanRoleRow["Name"] = "ALL"; LoanRolesList.Rows.InsertAt(NewLoanRoleRow, 0); } this.ddlShipper.DataSource = LoanRolesList; this.ddlShipper.DataBind(); #endregion #region Closer LoanRolesList = this.GetLoanRolesList("Closer"); if (LoanRolesList.Rows.Count > 0) { NewLoanRoleRow = LoanRolesList.NewRow(); NewLoanRoleRow["Name"] = "ALL"; LoanRolesList.Rows.InsertAt(NewLoanRoleRow, 0); } this.ddlCloser.DataSource = LoanRolesList; this.ddlCloser.DataBind(); #endregion #region Underwriter LoanRolesList = this.GetUnderwriterList(); if (LoanRolesList.Rows.Count > 0) { NewLoanRoleRow = LoanRolesList.NewRow(); NewLoanRoleRow["ID"] = 0; NewLoanRoleRow["Name"] = "ALL"; LoanRolesList.Rows.InsertAt(NewLoanRoleRow, 0); } this.ddlUnderwriter.DataSource = LoanRolesList; this.ddlUnderwriter.DataBind(); #endregion #endregion #region Lender, Referral and Loan Info #region Lender DataTable LenderList = this.GetLenderList(); if (LenderList.Rows.Count > 0) { DataRow NewLenderRow = LenderList.NewRow(); NewLenderRow["LenderId"] = 0; NewLenderRow["Lender"] = "ALL"; LenderList.Rows.InsertAt(NewLenderRow, 0); } this.ddlLender.DataSource = LenderList; this.ddlLender.DataBind(); #endregion #region Program DataTable ProgramList = this.GetProgramList(); if (ProgramList.Rows.Count > 0) { DataRow NewProgramRow = ProgramList.NewRow(); NewProgramRow["Program"] = "ALL"; ProgramList.Rows.InsertAt(NewProgramRow, 0); } this.ddlProgram.DataSource = ProgramList; this.ddlProgram.DataBind(); #endregion #region Partner DataTable PartnerList = this.GetPartnerList(); if (PartnerList.Rows.Count > 0) { DataRow NewPartnerRow = PartnerList.NewRow(); NewPartnerRow["PartnerId"] = 0; NewPartnerRow["Partner"] = "ALL"; PartnerList.Rows.InsertAt(NewPartnerRow, 0); } this.ddlPartner.DataSource = PartnerList; this.ddlPartner.DataBind(); #endregion #region LeadSource DataTable LeadSourceList = this.GetLeadSourceList(); if (LeadSourceList.Rows.Count > 0) { DataRow NewLeadSourceRow = LeadSourceList.NewRow(); NewLeadSourceRow["LeadSource"] = "ALL"; LeadSourceList.Rows.InsertAt(NewLeadSourceRow, 0); } this.ddlLeadSource.DataSource = LeadSourceList; this.ddlLeadSource.DataBind(); #endregion #region Referral DataTable ReferralList = this.GetReferralList(); if (ReferralList.Rows.Count > 0) { DataRow NewReferralRow = ReferralList.NewRow(); NewReferralRow["ReferralId"] = 0; NewReferralRow["Referral"] = "ALL"; ReferralList.Rows.InsertAt(NewReferralRow, 0); } this.ddlReferral.DataSource = ReferralList; this.ddlReferral.DataBind(); #endregion #region Purpose DataTable PurposeList = this.GetPurposeList(); if (PurposeList.Rows.Count > 0) { DataRow NewPurposeRow = PurposeList.NewRow(); NewPurposeRow["Purpose"] = "ALL"; PurposeList.Rows.InsertAt(NewPurposeRow, 0); } this.ddlPurpose.DataSource = PurposeList; this.ddlPurpose.DataBind(); #endregion #endregion #region Current Stage Template_Stages Template_Stages_Mgr = new Template_Stages(); DataTable Template_Stages_List = Template_Stages_Mgr.GetStageTemplateList(" and Enabled=1 order by Alias"); if (Template_Stages_List.Rows.Count > 0) { DataRow NewStageTmplRow = Template_Stages_List.NewRow(); NewStageTmplRow["TemplStageId"] = "0"; NewStageTmplRow["Alias"] = "ALL"; Template_Stages_List.Rows.InsertAt(NewStageTmplRow, 0); } this.ddlCurrentStage.DataSource = Template_Stages_List; this.ddlCurrentStage.DataBind(); #endregion #region Point Fields UserLoansViewPointFields UserLoansViewPointFields1 = new UserLoansViewPointFields(); DataTable HeadingList = UserLoansViewPointFields1.GetUserPointFieldInfo(this.CurrUser.iUserID); this.rptHeading.DataSource = HeadingList; this.rptHeading.DataBind(); #endregion //DataTable dtTaskName = new DataTable(); //dtTaskName.Columns.Add("TaskID"); //dtTaskName.Columns.Add("TaskName"); //dtTaskName.Columns.Add("MatchType"); //dtTaskName.Columns.Add("DueDateStart"); //dtTaskName.Columns.Add("DueDateEnd"); //dtTaskName.Columns.Add("CompDateStart"); //dtTaskName.Columns.Add("CompDateEnd"); //gridLicensesList.DataSource = dtTaskName; //gridLicensesList.DataBind(); } }
protected void Page_Load(object sender, EventArgs e) { #region 校验必要参数 // from if (this.Request.QueryString["from"] == null) { this.ClientScript.RegisterClientScriptBlock(this.GetType(), "_Missing3", "$('#divContainer').hide();alert('Missing required query string.');window.parent.location.href='WorkflowTemplateList.aspx');", true); return; } else { this.sFrom = this.Request.QueryString["from"]; } bool bIsValid = PageCommon.ValidateQueryString(this, "WflStageID", QueryStringType.ID); if (bIsValid == false) { string sWflStageID = this.Request.QueryString["WflStageID"].ToString(); if (sWflStageID != "0") { this.ClientScript.RegisterClientScriptBlock(this.GetType(), "_Missing1", "$('#divContainer').hide();alert('Missing required query string.');window.parent.location.href='" + this.sFrom + "';", true); return; } } this.iWflStageID = Convert.ToInt32(this.Request.QueryString["WflStageID"]); bIsValid = PageCommon.ValidateQueryString(this, "WorkflowTemplateID", QueryStringType.ID); if (bIsValid == false) { this.ClientScript.RegisterClientScriptBlock(this.GetType(), "_Missing2", "$('#divContainer').hide();alert('Missing required query string.');window.parent.location.href='" + this.sFrom + "';", true); return; } this.iWorkflowTemplateID = Convert.ToInt32(this.Request.QueryString["WorkflowTemplateID"]); if (this.Request.QueryString["PageIndex"] != null) // PageIndex { try { PageIndex = int.Parse(this.Request.QueryString["PageIndex"].ToString()); } catch { PageIndex = 1; } } else { PageIndex = AspNetPager1.CurrentPageIndex; } #endregion Template_Workflow WorkflowTemplateManager = new Template_Workflow(); #region 加载Workflow Stage信息 DataTable WflStageInfo = null; if (this.iWflStageID > 0) { WflStageInfo = WorkflowTemplateManager.GetWflStageInfo(this.iWflStageID); if (WflStageInfo.Rows.Count == 0) { this.ClientScript.RegisterClientScriptBlock(this.GetType(), "_Invalid1", "$('#divContainer').hide();alert('Invalid required query string.');window.parent..location.href='" + this.sFrom + "';", true); return; } } #endregion #region 加载Workflow Template信息 DataTable WorkflowTemplateInfo = WorkflowTemplateManager.GetWorkflowTemplateInfo(this.iWorkflowTemplateID); if (WorkflowTemplateInfo.Rows.Count == 0) { this.ClientScript.RegisterClientScriptBlock(this.GetType(), "_Invalid2", "$('#divContainer').hide();alert('Invalid required query string.');window.parent..location.href='" + this.sFrom + "';", true); return; } string sWorkflowTemplate = WorkflowTemplateInfo.Rows[0]["Name"].ToString(); string sWorkflowType = WorkflowTemplateInfo.Rows[0]["WorkflowType"].ToString(); string sCalcMethod = WorkflowTemplateInfo.Rows[0]["CalculationMethod"].ToString(); this.lbWorkflowTemplate.Text = sWorkflowTemplate; this.lbWorkflowType.Text = sWorkflowType; #endregion #region 加载Workflow Task List Template_Stages StageTemplateManager = new Template_Stages(); string sSql = string.Empty; string sOrderName = string.Empty; if (this.iWflStageID == 0) // // All Stages { //sSql = "select top(10) a.*, b.Name as PrerequisiteTask, c.Name as StageName, case when a.Enabled=1 then 'Yes' else 'No' end as TaskEnabled " // + "from Template_Wfl_Tasks as a left join Template_Wfl_Tasks as b on a.PrerequisiteTaskId = b.TemplTaskId " // + "inner join Template_Wfl_Stages as c on a.WflStageId = c.WflStageId " // + "where a.WflStageId in (select WflStageId from Template_Wfl_Stages where WflTemplId=" + this.iWorkflowTemplateID + ")"; sSql = " AND WflTemplId='" + this.iWorkflowTemplateID + "'"; sOrderName = "StageName"; } else { //sSql = "select top(10) a.*, b.Name as PrerequisiteTask, c.Name as StageName, case when a.Enabled=1 then 'Yes' else 'No' end as TaskEnabled " // + "from Template_Wfl_Tasks as a left join Template_Wfl_Tasks as b on a.PrerequisiteTaskId = b.TemplTaskId " // + "inner join Template_Wfl_Stages as c on a.WflStageId = c.WflStageId " // + "where a.WflStageId=" + this.iWflStageID; sSql = " AND WflStageId='" + this.iWflStageID + "'"; sOrderName = "SequenceNumber"; } int pageSize = AspNetPager1.PageSize; int pageIndex = PageIndex; int recordCount = 0; //DataTable TaskListData = LPWeb.DAL.DbHelperSQL.ExecuteDataTable(sSql); LPWeb.BLL.Template_Wfl_Tasks tBLL = new Template_Wfl_Tasks(); DataSet TaskListData = tBLL.GetWorkflowStageTasks(pageSize, pageIndex, sOrderName, sSql, out recordCount); AspNetPager1.PageSize = pageSize; AspNetPager1.RecordCount = recordCount; this.gridWorkflowTaskList.DataSource = TaskListData; this.gridWorkflowTaskList.DataBind(); #endregion if (this.IsPostBack == false) { #region 加载Workflow Stage List DataTable WflStageListData = WorkflowTemplateManager.GetWflStageList(this.iWorkflowTemplateID); DataRow NewStageRow = WflStageListData.NewRow(); NewStageRow["TemplStageId"] = DBNull.Value; NewStageRow["Name"] = "All Stages"; WflStageListData.Rows.InsertAt(NewStageRow, 0); this.ddlStage.DataSource = WflStageListData; this.ddlStage.DataBind(); #endregion #region 绑定数据 if (this.iWflStageID == 0) // All Stages { } else { this.ddlStage.SelectedValue = this.iWflStageID.ToString(); this.chkEnabled.Checked = Convert.ToBoolean(WflStageInfo.Rows[0]["Enabled"]); this.txtSeq.Text = WflStageInfo.Rows[0]["SequenceNumber"].ToString(); if (WflStageInfo.Rows[0]["CalculationMethod"].ToString() != "" && WflStageInfo.Rows[0]["CalculationMethod"].ToString() != "0") { sCalcMethod = WflStageInfo.Rows[0]["CalculationMethod"].ToString(); } if (sCalcMethod != "3") { if (sCalcMethod != "" && sCalcMethod != "0") { this.hdnCalcDueDateMethod.Value = sCalcMethod == "1" ? "Est Close Date" : "Creation Date"; //this.ddlCalcDueDateMethod.SelectedValue = sCalcMethod == "1" ? "Est Close Date" : "Creation Date"; } if (sCalcMethod == "1") { this.txtDaysFromEstClose.Text = WflStageInfo.Rows[0]["DaysFromEstClose"].ToString(); this.txtDaysFromEstClose.Enabled = true; this.txtDaysAfterCreation.Enabled = false; } else { this.txtDaysFromEstClose.Enabled = false; this.txtDaysAfterCreation.Text = WflStageInfo.Rows[0]["DaysFromCreation"].ToString(); this.txtDaysAfterCreation.Enabled = true; } } else { this.hdnCalcDueDateMethod.Value = "Completion Date of the previous Stage"; } } #endregion } Template_Wfl_Stages tempWflStages = new Template_Wfl_Stages(); this.hdnMinStagesSeq.Value = tempWflStages.GetMinStageSeqNumByWflTempID(this.iWorkflowTemplateID).ToString(); this.hdnSecStagesSeq.Value = tempWflStages.GetSecStageSeqNumByWflTempID(this.iWorkflowTemplateID).ToString(); }
protected void Page_Load(object sender, EventArgs e) { #region 检查页面参数 // CloseDialogCodes bool bIsValid = PageCommon.ValidateQueryString(this, "CloseDialogCodes", QueryStringType.String); if (bIsValid == false) { PageCommon.WriteJsEnd(this, "Missing required query string.", "window.parent.location.href=window.parent.location.href"); } #endregion // __doPostBack this.GetPostBackEventReference(this.btnSave); if (Request.Url != null) { FromURL = Request.Url.ToString(); } if (this.IsPostBack == false) { #region build ddlSeq options StringBuilder sbSeqOptions = new StringBuilder(); for (int i = 0; i < 999; i++) { int iSeq = i + 1; sbSeqOptions.AppendLine("<option value=\"" + iSeq + "\">" + iSeq + "</option>"); } this.ltrSeqOptions.Text = sbSeqOptions.ToString(); #endregion #region 加载Stage Template List Template_Stages StageTemplateManager = new Template_Stages(); // Processing and Prospect DataTable StageTemplateList = StageTemplateManager.GetStageTemplateList(" and [Enabled]=1"); this.ddlStageTemplateList.DataSource = StageTemplateList; this.ddlStageTemplateList.DataBind(); // Processing DataView StageTemplateListView1 = new DataView(StageTemplateList); StageTemplateListView1.RowFilter = "WorkflowType='Processing'"; DataTable StageTemplateList1 = this.AddSelectStageRow(StageTemplateListView1.ToTable()); this.ddlStageProcessing.DataSource = StageTemplateList1; this.ddlStageProcessing.DataBind(); // Prospect DataView StageTemplateListView2 = new DataView(StageTemplateList); StageTemplateListView2.RowFilter = "WorkflowType='Prospect'"; DataTable StageTemplateList2 = this.AddSelectStageRow(StageTemplateListView2.ToTable()); this.ddlStageProspect.DataSource = StageTemplateList2; this.ddlStageProspect.DataBind(); #endregion } }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Page_Load(object sender, EventArgs e) { #region 权限验证 this.CurrentUser = new LoginUser(); if (this.CurrentUser.userRole.CustomTask.ToString() == "") { Response.Redirect("../Unauthorize1.aspx"); return; } else { this.hdnCustomTask.Value = this.CurrentUser.userRole.CustomTask.ToString(); this.hdnAssignTask.Value = this.CurrentUser.userRole.AssignTask.ToString(); this.hdnCompleteOtherTask.Value = this.CurrentUser.userRole.MarkOtherTaskCompl == true ? "True" : "False"; } #endregion #region 检查必要参数 bool bIsValid = PageCommon.ValidateQueryString(this, "LoanID", QueryStringType.ID); if (bIsValid == false) { //this.Response.Write("Missing required query string."); try { this.Response.End(); } catch { } } this.iLoanID = Convert.ToInt32(this.Request.QueryString["LoanID"]); #endregion // login user id this.hdnLoginUserID.Value = this.CurrentUser.iUserID.ToString(); #region 加载Loan Loans LoanManager = new Loans(); DataTable LoanInfo = LoanManager.GetLoanInfo(this.iLoanID); if (LoanInfo.Rows.Count == 0) { this.Response.Write("Invalid query string."); try { this.Response.End(); } catch { } } #endregion #region Active Loan or Not string sLoanStatus = LoanInfo.Rows[0]["Status"].ToString(); this.hdnLoanStatus.Value = sLoanStatus; #endregion #region Is Post-Close Complated string sSqlx = "select * from LoanStages where FileId=" + this.iLoanID + " and StageName='Post-Close'"; DataTable PostCloseStageInfo = LPWeb.DAL.DbHelperSQL.ExecuteDataTable(sSqlx); if (PostCloseStageInfo.Rows.Count == 0) { this.hdnIsPostCloseUncompleted.Value = "false"; } else { string CompletedDate = PostCloseStageInfo.Rows[0]["Completed"].ToString(); if (CompletedDate == string.Empty) { this.hdnIsPostCloseUncompleted.Value = "true"; } else { this.hdnIsPostCloseUncompleted.Value = "false"; } } #endregion #region hidden fields for Regenerate #region 获取Loan Workflow Template ID LoanWflTempl LoanWflTemplManager = new LoanWflTempl(); DataTable LoanWflTempInfo = LoanWflTemplManager.GetLoanWorkflowTemplateInfo(this.iLoanID); if (LoanWflTempInfo.Rows.Count > 0) { this.hdnLoanWflTempID.Value = LoanWflTempInfo.Rows[0]["WflTemplId"].ToString(); } #endregion #region 获取Default Workflow Template ID and Name Template_Workflow WorkflowTempManager = new Template_Workflow(); DataTable DefaultWorkflowTempInfo = WorkflowTempManager.GetDefaultWorkflowTemplateInfo(sLoanStatus); if (DefaultWorkflowTempInfo.Rows.Count > 0) { this.hdnDefaultWflTempID.Value = DefaultWorkflowTempInfo.Rows[0]["WflTemplId"].ToString(); this.hdnDefaultWflTempName.Value = DefaultWorkflowTempInfo.Rows[0]["Name"].ToString(); } #endregion #endregion #region 加载Filter #region 加载Task Owner DataTable TaskOwners = this.LoanTaskManager.GetTaskOwnerList(this.iLoanID); DataRow AllTaskOwnerRow = TaskOwners.NewRow(); AllTaskOwnerRow["UserID"] = 0; AllTaskOwnerRow["FullName"] = "All"; TaskOwners.Rows.InsertAt(AllTaskOwnerRow, 0); this.ddlTaskOwner.DataSource = TaskOwners; this.ddlTaskOwner.DataBind(); #endregion #region 加载Stage DataTable LoanStages = LoanManager.GetLoanStages(this.iLoanID); DataRow AllStageRow = LoanStages.NewRow(); AllStageRow["LoanStageID"] = 0; AllStageRow["StageName"] = "All"; LoanStages.Rows.InsertAt(AllStageRow, 0); this.ddlStage.DataSource = LoanStages; this.ddlStage.DataBind(); #endregion #endregion #region 生成Stage & Task树 #region 加载筛选后的Loan Stage #region sWhere_Stage string sWhere_Stage = string.Empty; if (this.Request.QueryString["StageFilter"] != null) { string sStageFilter = this.Request.QueryString["StageFilter"].ToString(); sWhere_Stage += " and LoanStageId = " + sStageFilter; } else { sWhere_Stage += " and FileId = " + this.iLoanID; } #endregion DataTable LoanStageNodes = LoanManager.GetLoanStage(sWhere_Stage); #endregion StringBuilder sbStageTemplate = new StringBuilder(); foreach (DataRow StageRow in LoanStageNodes.Rows) { string sStageName = StageRow["StageName"].ToString(); #region 获取Template_Stage.Alias if (StageRow["WflStageId"] != DBNull.Value) { string sWflStageId = StageRow["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) { 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) { sStageName = sAlias; } } } } } #endregion string sLoanStageID = StageRow["LoanStageId"].ToString(); int iLoanStageID = Convert.ToInt32(StageRow["LoanStageId"]); string sCompletedDate = StageRow["Completed"].ToString() == string.Empty ? string.Empty : " (" + Convert.ToDateTime(StageRow["Completed"]).ToString("MM/dd/yyyy") + ")"; string sStageIconFileName = this.GetStageIconFileName(iLoanStageID); string sLi = "<li><img class='StageIcon' src='../images/stage/" + sStageIconFileName + "' /><a onclick='return Stage_onclick(this);' href='LoanDetailsTask.aspx?LoanID=" + this.iLoanID + "&Stage=" + sLoanStageID + "'><span>" + sStageName + sCompletedDate + "</span></a>"; sbStageTemplate.AppendLine(sLi); #region 加载Stage下的Task StringBuilder sbChildTaskList = new StringBuilder(); #region sWhere_Task string sWhere_Task = string.Empty; // TaskStatus sWhere_Task += this.BuildWhere_TaskStatus(); // TaskOwner sWhere_Task += BuildWhere_TaskOwner(); // Due sWhere_Task += BuildWhere_Due(); #endregion if (sLoanStageID != string.Empty) { DataTable ChildTasks = this.LoanTaskManager.GetLoanTaskList(" and FileId = " + this.iLoanID + " and LoanStageId = " + sLoanStageID + " and PrerequisiteTaskId is null" + sWhere_Task); if (ChildTasks.Rows.Count > 0) { sbChildTaskList.AppendLine("<ul>"); foreach (DataRow ChildTaskRow in ChildTasks.Rows) { string sTaskID = ChildTaskRow["LoanTaskId"].ToString(); string sTaskName = ChildTaskRow["Name"].ToString(); string sCmptDate = ChildTaskRow["Completed"].ToString() == string.Empty ? string.Empty : " " + Convert.ToDateTime(ChildTaskRow["Completed"]).ToString("MM/dd/yyyy"); string sLoanTaskIconFileName = this.GetLoanTaskIconFileName(Convert.ToInt32(sTaskID)); string sChecked = ChildTaskRow["Completed"].ToString() == string.Empty ? string.Empty : "checked"; string sChildDisabled = string.Empty; #region 加载Prerequisite Tasks StringBuilder sbPrerequisiteTaskList = new StringBuilder(); DataTable PreTasks = this.LoanTaskManager.GetLoanTaskList(" and FileId = " + this.iLoanID + " and PrerequisiteTaskId = " + sTaskID); if (PreTasks.Rows.Count > 0) { sbPrerequisiteTaskList.AppendLine("<ul>"); foreach (DataRow PreTask in PreTasks.Rows) { string sPreTaskID = PreTask["LoanTaskId"].ToString(); string sPreTaskName = PreTask["Name"].ToString(); string sPreCmptDate = PreTask["Completed"].ToString() == string.Empty ? string.Empty : " " + Convert.ToDateTime(PreTask["Completed"]).ToString("MM/dd/yyyy"); string sPreLoanTaskIconFileName = this.GetLoanTaskIconFileName(Convert.ToInt32(sPreTaskID)); string sPreChecked = PreTask["Completed"].ToString() == string.Empty ? string.Empty : "checked"; // 如果prerequisite task未完成,其子task不允许完成 string sPreDisabled = string.Empty; if (ChildTaskRow["Completed"].ToString() == string.Empty) { sPreDisabled = "disabled title='Please complete prerequisite task at first.'"; } else { // 如果如果prerequisite task完成了,如果其下有任一child task也完成了,那么不允许uncomplete prerequisite task if (sPreCmptDate != string.Empty) { sChildDisabled = "disabled title='You cannot un-complete a task that has completed dependent task(s). Please un-complete the dependent task(s) first.'"; } } string sPreTaskTemplate = "<li><input myTaskID='" + sPreTaskID + "' myStageID='" + sLoanStageID + "' type='checkbox' class='TaskCheckbox' " + sPreChecked + " " + sPreDisabled + " /><img class='TaskIcon' src='../images/task/" + sPreLoanTaskIconFileName + "' /><a onclick='return Task_onclick(this);' href='LoanDetailsTask.aspx?LoanID=" + this.iLoanID + "&Stage=" + sLoanStageID + "&TaskID=" + sPreTaskID + "'><span title='" + sPreTaskName + sPreCmptDate + "'>" + sPreTaskName + sPreCmptDate + "</span></a></li>"; sbPrerequisiteTaskList.AppendLine(sPreTaskTemplate); } sbPrerequisiteTaskList.AppendLine("</ul>"); } #endregion string sTaskTemplate = "<li><input myTaskID='" + sTaskID + "' myStageID='" + sLoanStageID + "' type='checkbox' class='TaskCheckbox' " + sChecked + " " + sChildDisabled + " />" + "<img class='TaskIcon' src='../images/task/" + sLoanTaskIconFileName + "' />" + "<a onclick='return Task_onclick(this);' href='LoanDetailsTask.aspx?LoanID=" + this.iLoanID + "&Stage=" + sLoanStageID + "&TaskID=" + sTaskID + "'><span title='" + sTaskName + sCmptDate + "'>" + sTaskName + sCmptDate + "</span></a>"; sbChildTaskList.AppendLine(sTaskTemplate); sbChildTaskList.AppendLine(sbPrerequisiteTaskList.ToString()); sbChildTaskList.AppendLine("</li>"); } sbChildTaskList.AppendLine("</ul>"); } } #endregion sbStageTemplate.AppendLine(sbChildTaskList.ToString()); sbStageTemplate.AppendLine("</li>"); } this.ltrStageTaskNodes.Text = sbStageTemplate.ToString(); #endregion #region 加载Task列表 // default string sWhere = " and a.FileID=" + this.iLoanID; // TaskStatus sWhere += this.BuildWhere_TaskStatus(); // TaskOwner sWhere += BuildWhere_TaskOwner(); // StageFilter sWhere += BuildWhere_StageFilter(); // Due sWhere += BuildWhere_Due(); // TaskID if (this.Request.QueryString["TaskID"] != null) { string sTaskID = this.Request.QueryString["TaskID"].ToString(); sWhere += " and a.LoanTaskId = " + sTaskID; } DataTable LoanTaskData = this.LoanTaskManager.GetLoanTaskList(sWhere); this.gridTaskList.DataSource = LoanTaskData; this.gridTaskList.DataBind(); #endregion // Add thead and tbody PageCommon.MakeGridViewAccessible(this.gridTaskList); }