protected void Page_Load(object sender, EventArgs e) { // json示例 // [{"BranchID":"1","Name":"BranchA"},{"BranchID":"2","Name":"BranchB"}] #region 校验页面参数 // RegionID string sRegionID = this.Request.QueryString["RegionIDs"].ToString(); // DivisionID string sDivisionIDs = this.Request.QueryString["DivisionIDs"].ToString(); #endregion #region Branch Branches BranchMgr = new Branches(); DataTable BranchList = null; if (this.CurrUser.sRoleName == "Executive") { BranchList = BranchMgr.GetBranchFilter_Executive(this.CurrUser.iUserID, sRegionID, sDivisionIDs); } else if (this.CurrUser.sRoleName == "Branch Manager") { BranchList = BranchMgr.GetBranchFilter_Branch_Manager(this.CurrUser.iUserID, sRegionID, sDivisionIDs); } else { BranchList = BranchMgr.GetBranchFilter(this.CurrUser.iUserID, sRegionID, sDivisionIDs); } #endregion StringBuilder sbJson = new StringBuilder(); int i = 0; foreach (DataRow BranchRow in BranchList.Rows) { string sBranchID = BranchRow["BranchID"].ToString(); string sName = BranchRow["Name"].ToString(); if (i == 0) { sbJson.Append("{\"BranchID\":\"" + sBranchID + "\",\"Name\":\"" + sName + "\"}"); } else { sbJson.Append(",{\"BranchID\":\"" + sBranchID + "\",\"Name\":\"" + sName + "\"}"); } i++; } this.Response.Write("[" + sbJson.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(); } }
private void BindControlDataSource() { Company_Lead_Sources bCompany_Lead_Sources = new Company_Lead_Sources(); DataSet dsLeadSources = bCompany_Lead_Sources.GetAllList(); DataTable dtLS = new DataTable(); if (dsLeadSources != null && dsLeadSources.Tables[0].Rows.Count > 0) { dtLS = dsLeadSources.Tables[0]; } if (!dtLS.Columns.Contains("LeadSourceID")) { dtLS.Columns.Add("LeadSourceID"); } if (!dtLS.Columns.Contains("LeadSource")) { dtLS.Columns.Add("LeadSource"); } DataRow drls = dtLS.NewRow(); drls["LeadSourceID"] = "-1"; drls["LeadSource"] = "- select a Lead Source -"; dtLS.Rows.InsertAt(drls, 0); ddlLeadSource.DataSource = dtLS; ddlLeadSource.DataBind(); Branches bBranches = new Branches(); DataTable dtBH = null; if (CurrUser.bIsCompanyExecutive || CurrUser.bIsDivisionExecutive || CurrUser.bIsRegionExecutive) { dtBH = bBranches.GetBranchFilter_Executive(CurrUser.iUserID, 0, 0); } else if (CurrUser.bIsBranchManager) { dtBH = bBranches.GetBranchFilter_Branch_Manager(CurrUser.iUserID, 0, 0); } else { dtBH = bBranches.GetBranchFilter(CurrUser.iUserID, 0, 0); } if (dtBH != null) { DataRow drbh = dtBH.NewRow(); drbh["BranchId"] = "-1"; drbh["Name"] = "- select a Branch -"; dtBH.Rows.InsertAt(drbh, 0); ddlBranch.DataSource = dtBH; ddlBranch.DataBind(); } Users bUsers = new Users(); if (CurrUser.bIsBranchUser) { DataTable dt = bUsers.GetUserBranchInfo(CurrUser.iUserID.ToString()); if (dt.Rows.Count > 0) { ddlBranch.SelectedValue = Convert.ToInt32(dt.Rows[0]["BranchID"]).ToString(); ddlBranch.Enabled = false; } } DataTable dtLO = bUsers.GetUserList(string.Format("And RoleName='{0}' and UserId={1}", "Loan Officer", CurrUser.iUserID)); if (dtLO.Rows.Count > 0) { //CurrentUser is Loan Officer if (!dtLO.Columns.Contains("LoanOfficer")) { dtLO.Columns.Add("LoanOfficer"); } ddlLoanOfficer.DataSource = dtLO; ddlLoanOfficer.DataTextField = "LoanOfficer"; ddlLoanOfficer.DataValueField = "UserID"; ddlLoanOfficer.SelectedValue = CurrUser.iUserID.ToString(); ddlLoanOfficer.DataBind(); ddlLoanOfficer.Enabled = false; } }
public void BindData() { #region Local PointFile ----pointFileInfo and pointFolderInfo if (pointFileInfo != null) { txbLastSync.Text = pointFileInfo.LastImported == null ? "" : pointFileInfo.LastImported.Value.ToString("MM/dd/yyyy hh:mm tt"); txbFilename.Text = pointFileInfo.Name; } if (pointFolderInfo == null || string.IsNullOrEmpty(pointFolderInfo.Path)) { txbPath.Text = string.Empty; } else { txbPath.Text = pointFolderInfo.Path; } txbPath.Text += (pointFileInfo == null || string.IsNullOrEmpty(pointFileInfo.Name))?string.Empty : pointFileInfo.Name; // pointFolderInfo.Name; txbPath.Enabled = false; #endregion #region Branch ----loanInfo.BranchID Branches bllBranches = new Branches(); if (iBranchId > 0) { ddlBranch.DataSource = bllBranches.GetList(" BranchId = " + loanInfo.BranchID); ddlBranch.DataBind(); if (ddlBranch.Items.Count > 0) { ddlBranch.SelectedIndex = 0; } ddlBranch.Enabled = false; } else { DataTable dt = new DataTable(); if (loginUser.sRoleName == "Executive") { dt = bllBranches.GetBranchFilter_Executive(loginUser.iUserID, 0, 0); } else if (loginUser.sRoleName == "Branch Manager") { dt = bllBranches.GetBranchFilter_Branch_Manager(loginUser.iUserID, 0, 0); } else { dt = bllBranches.GetBranchFilter(loginUser.iUserID, 0, 0); } ddlBranch.DataSource = dt; ddlBranch.DataBind(); ddlBranch.Enabled = true; } #endregion BindOther(); var folderId = pointFolderInfo != null ? pointFolderInfo.FolderId : 0; var fileName = pointFileInfo != null ? pointFileInfo.Name : ""; #region btnDisabled //1. Create Point File可用 //a. folder name或filename为空时 //b. Folder name和filename不为空时, 但Point文件不存在 //2. Update Point File可用 //a. Folder name和filename不为空时, 以及Point文件存在 //3. Sync Now 可用 //a. Folder name和filename不为空时, 以及Point文件存在 var pointFileWcf = GetPointFileInfo(); btnCreatePointFile.Disabled = true; btnSyncNow.Disabled = true; btnUpdatePoint.Disabled = true; //Create Point File if (folderId == 0 || string.IsNullOrEmpty(pointFileInfo.Name)) { btnCreatePointFile.Disabled = false; } else if (!pointFileWcf.FileExists) //not exists { btnCreatePointFile.Disabled = false; } else { btnSyncNow.Disabled = false; btnUpdatePoint.Disabled = false; } #endregion if (folderId != 0) { ddlFolderName.Enabled = false; } if (!string.IsNullOrEmpty(fileName)) { txbFilename.Enabled = false; } }