private void RenderUnitTreeData(int selectedUnitID) { BusinessServices.Unit objUnit = new BusinessServices.Unit(); DataSet dstUnits; string strUnits; dstUnits = objUnit.GetUnitsTreeByUserID(UserContext.UserData.OrgID, UserContext.UserID, 'S', selectedUnitID); if (dstUnits.Tables[0].Rows.Count > 0) { //From Unit strUnits = UnitTreeConvert.ConvertXml(dstUnits); this.trvFromUnit.LoadXml(strUnits); //To Unit dstUnits = objUnit.GetUnitsTreeByUserID(UserContext.UserData.OrgID, UserContext.UserID, 'P', selectedUnitID); strUnits = UnitTreeConvert.ConvertXml(dstUnits); this.trvToUnit.LoadXml(strUnits); } else { this.plhMainscreen.Visible = false; this.lblNoSubUnits.Visible = true; } }
/// <summary> /// Page Load event /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Page_Load(object sender, System.EventArgs e) { pagTitle.InnerText = ResourceManager.GetString("pagTitle"); txtUnitID.ToolTip = ResourceManager.GetString("tooltipExactID"); if (!Page.IsPostBack) { //Show Parent Units tree BusinessServices.Unit objUnit = new BusinessServices.Unit(); DataSet dstUnits = objUnit.GetUnitsTreeByUserID(UserContext.UserData.OrgID, UserContext.UserID, 'A', false); if (dstUnits.Tables[0].Rows.Count == 0) { this.lblNoSubUnits.Visible = true; this.lblNoSubUnits.CssClass = "FeedbackMessage"; this.plhCriteria.Visible = false; this.plhResults.Visible = false; } else { string strUnits = UnitTreeConvert.ConvertXml(dstUnits); this.trvUnitsSelector.LoadXml(strUnits); this.plhCriteria.Visible = true; this.plhResults.Visible = false; } SetPaginationOrder("Name"); } }
/// <summary> /// Event Handler for the Page Load event. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Page_Load(object sender, System.EventArgs e) { pagTitle.InnerText = ResourceManager.GetString("pagTitle"); // tooltip txtUserID.ToolTip = ResourceManager.GetString("tooltipExactID"); if (!Page.IsPostBack) { BusinessServices.Unit objUnit = new BusinessServices.Unit(); DataSet dstUnits = objUnit.GetUnitsTreeByUserID(UserContext.UserData.OrgID, UserContext.UserID, 'A'); // reset the tree view control on each load trvUnitsSelector.ClearSelection(); string strUnits = UnitTreeConvert.ConvertXml(dstUnits); if (strUnits == "") { this.lblNoSubUnits.Visible = true; this.lblNoSubUnits.CssClass = "FeedbackMessage"; this.plhCriteria.Visible = false; this.plhResults.Visible = false; } else { this.trvUnitsSelector.LoadXml(strUnits); this.plhCriteria.Visible = true; this.plhResults.Visible = false; } SetSortOrder("LastName"); } }
/// <summary> /// Event handler for the page load event /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Page_Load(object sender, System.EventArgs e) { pagTitle.InnerText = ResourceManager.GetString("pagTitle"); // Get the unit id from the querystring this.m_intUnitID = int.Parse(Request.QueryString["UnitID"]); WebSecurity.CheckUnitAdministrator(this.m_intUnitID); if (!Page.IsPostBack) { BusinessServices.Unit objUnit = new BusinessServices.Unit(); DataSet dstUnits = objUnit.GetUnitsTreeByUserID(UserContext.UserData.OrgID, UserContext.UserID, 'A'); // Get permissions of the user on this unit string strPermission = objUnit.GetPermission(this.m_intUnitID, UserContext.UserID); // If administrator if (strPermission == "A") { this.chkAdminSub.Visible = false; } this.tblPagination.Visible = false; } }
/// <summary> /// This method displays the units that are available to the administrator /// </summary> private void DisplayUnits() { // Unit object used to gather tree information for the treeview control BusinessServices.Unit objUnit = new BusinessServices.Unit(); // Dataset of units returned by the Unit object DataSet dstUnits; // Get Units accessable to this user. try { // Gets the units that the current user is an administrator of. dstUnits = objUnit.GetUnitsTreeByUserID(UserContext.UserData.OrgID, UserContext.UserID, 'A'); // Convert this to an xml string for rendering by the UnitTreeConverter. string strUnits = UnitTreeConvert.ConvertXml(dstUnits); if (strUnits == "") { // No units found. this.lblError.Visible = true; this.lblError.Text = ResourceManager.GetString("lblError.NoUnit"); //"No units found"; this.lblError.CssClass = "FeedbackMessage"; } else { // Change to the appropriate view and load the Units in this.trvToUnitsSelector.LoadXml(strUnits); } } catch (Exception Ex) { // General Exception occured, log it ErrorLog objError = new ErrorLog(Ex, ErrorLevel.Medium, "MoveUsersToUnit.aspx.cs", "DisplayUnits", "Displaying Units"); } }
/// <summary> /// This method displays all the units that the logged in use is an administrator of. /// </summary> private void DisplayUnits() { BusinessServices.Unit objUnit = new BusinessServices.Unit(); DataSet dstUnits; // Get Units accessable to this user. try { // Gets the units that the current user is an administrator of. dstUnits = objUnit.GetUnitsTreeByUserID(UserContext.UserData.OrgID, UserContext.UserID, 'A'); if (dstUnits.Tables[0].Rows.Count == 0) { this.lblError.Text += "<BR>" + ResourceManager.GetString("lblError.NoUnit"); this.lblError.CssClass = "FeedbackMessage"; this.plhEditEmail.Visible = false; } else { // Convert this to an xml string for rendering by the UnitTreeConverter. string strUnits = UnitTreeConvert.ConvertXml(dstUnits); // Change to the appropriate view and load the Units in this.trvUnitsSelector.LoadXml(strUnits); } } catch (Exception Ex) { // General Exception occured, log it ErrorLog objError = new ErrorLog(Ex, ErrorLevel.Medium, "BulkAssignUsers.aspx.cs", "DisplayUnits", "Displaying Units"); throw (Ex); } }
/// <summary> /// Event handler for the page load event /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Page_Load(object sender, System.EventArgs e) { pagTitle.InnerText = ResourceManager.GetString("pagTitle"); if (!Page.IsPostBack) { //1. Get Parent Units BusinessServices.Unit objUnit = new BusinessServices.Unit(); DataSet dstUnits = objUnit.GetUnitsTreeByUserID(UserContext.UserData.OrgID, UserContext.UserID, 'P'); string strUnits = UnitTreeConvert.ConvertXml(dstUnits); //2. Show Parent Unit tree //If there are units in the organisation, show the parent unit tree if (strUnits.Length > 0) { this.trvParentUnit.LoadXml(strUnits); } //Otherwise hide the parent unit tree else { this.trvParentUnit.Visible = false; this.optUnitLevel.Enabled = false; } //3. Unit administrator can't create top level unit if (UserContext.UserData.UserType == UserType.UnitAdmin) { this.optUnitLevel.Enabled = false; this.optUnitLevel.Items[1].Selected = true; } } }
/// <summary> /// Paint Critera section of the page. /// </summary> private void PaintCriteraPageState() { // Get Units accessable to this user. BusinessServices.Unit objUnit = new BusinessServices.Unit(); DataSet dstUnits = objUnit.GetUnitsTreeByUserID(UserContext.UserData.OrgID, UserContext.UserID, 'A'); // Convert this to an xml string for rendering by the UnitTreeConverter. string strUnits = UnitTreeConvert.ConvertXml(dstUnits); if (strUnits == "") { // No units found. this.lblError.Visible = true; this.lblError.Text += "<BR>" + ResourceManager.GetString("lblError.NoUnit"); //No units exist within this organisation."; this.lblError.CssClass = "FeedbackMessage"; this.plhSearchCriteria.Visible = false; } else { // Change to the appropriate view and load the Units in this.trvUnitsSelector.LoadXml(strUnits); } // Get Policies accessable to this organisation BusinessServices.Policy objPolicy = new BusinessServices.Policy(); Organisation objOrg = new Organisation(); //DataTable dtbPolicies = objPolicy. // objCourse.GetCourseListAccessableToOrg(UserContext.UserData.OrgID); DataTable dtbPolicies = objOrg.GetOrganisationPolicies(UserContext.UserData.OrgID); if (dtbPolicies.Rows.Count > 0) { lstPolicy.DataSource = dtbPolicies; lstPolicy.DataTextField = "PolicyName"; lstPolicy.DataValueField = "PolicyID"; lstPolicy.DataBind(); } else { this.lblError.Visible = true; this.lblError.Text += "<BR>" + ResourceManager.GetString("lblError.NoPolicy"); //"No courses exist within this organisation."; this.lblError.CssClass = "WarningMessage"; this.plhSearchCriteria.Visible = false; } // If there is at least one course then select it. if (lstPolicy.Items.Count > 0) { lstPolicy.SelectedIndex = 0; } // Initialise the date list boxes. WebTool.SetupHistoricDateControl(this.lstEffectiveDay, this.lstEffectiveMonth, this.lstEffectiveYear); WebTool.SetupHistoricDateControl(this.lstEffectiveToDay, this.lstEffectiveToMonth, this.lstEffectiveToYear); radAcceptance.Items[0].Text = ResourceManager.GetString("radAcceptance.1"); radAcceptance.Items[1].Text = ResourceManager.GetString("radAcceptance.2"); radAcceptance.Items[2].Text = ResourceManager.GetString("radAcceptance.3"); }
/// <summary> /// /// </summary> private void ConfigureParameterScreen() { int intOrgID = UserContext.UserData.OrgID; Course objCourse = new Course(); User objUser = new User(); BusinessServices.Unit objUnit = new BusinessServices.Unit(); string strUnits; // Courses DataTable dtbCourses = objCourse.GetCourseListAccessableToOrg(intOrgID); cboCourses.DataSource = dtbCourses; cboCourses.DataTextField = "Name"; cboCourses.DataValueField = "CourseID"; cboCourses.DataBind(); if (cboCourses.Items.Count > 0) { cboCourses.SelectedIndex = 0; } else { this.plhSearchCriteria.Visible = false; this.lblError.Text += ResourceManager.GetString("lblError.NoCourse"); //"No courses exist within this organisation."; this.lblError.Visible = true; } // Units DataSet dstUnits = objUnit.GetUnitsTreeByUserID(UserContext.UserData.OrgID, UserContext.UserID, 'A'); if (dstUnits.Tables[0].Rows.Count == 0) { this.plhSearchCriteria.Visible = false; this.lblError.Text += ResourceManager.GetString("lblError.NoUnit"); //"No units exist within this organisation."; this.lblError.Visible = true; } else { if (trvUnitsSelector.HasControls()) { this.trvUnitsSelector.ClearSelection(); } strUnits = UnitTreeConvert.ConvertXml(dstUnits); if (strUnits == "") { this.trvUnitsSelector.Visible = false; this.lblNoSubUnits.Visible = true; } else { this.trvUnitsSelector.OutputStyle = Uws.Framework.WebControl.TreeOutputStyle.MultipleSelection; this.trvUnitsSelector.Visible = true; this.lblNoSubUnits.Visible = false; this.trvUnitsSelector.LoadXml(strUnits); } } }
/// <summary> /// Paint Critera section of the page /// </summary> /// <remarks> /// </remarks> private void PaintCriteraPageState() { //1. Paint the unit selector BusinessServices.Unit objUnit = new BusinessServices.Unit(); // Unit Object DataSet dstUnits = objUnit.GetUnitsTreeByUserID(UserContext.UserData.OrgID, UserContext.UserID, 'A'); // Data set to contain unit details if (dstUnits.Tables[0].Rows.Count == 0) { this.plhSearchCriteria.Visible = false; this.lblError.Text = ResourceManager.GetString("lblError.NoUnit"); //"No units exist within this organisation."; this.lblError.Visible = true; return; } string strUnits = UnitTreeConvert.ConvertXml(dstUnits); // comma seperated list of units this.trvUnitsSelector.LoadXml(strUnits); //2. Paint the course list details int intOrganisationID = UserContext.UserData.OrgID; // organisation ID BusinessServices.Course objCourse = new BusinessServices.Course(); //Course Object // Get Courses accessable to this organisation DataTable dtbCourses = objCourse.GetCourseListAccessableToOrg(intOrganisationID); // List of courses accesable to the organisation if (dtbCourses.Rows.Count > 0) { lstCourses.DataSource = dtbCourses; lstCourses.DataTextField = "Name"; lstCourses.DataValueField = "CourseID"; lstCourses.DataBind(); } else { this.plhSearchCriteria.Visible = false; this.lblError.Text = ResourceManager.GetString("lblError.NoCourse"); //"No courses exist within this organisation."; this.lblError.CssClass = "FeedbackMessage"; this.lblError.Visible = true; return; } // If there is at least one course then select it. if (lstCourses.Items.Count > 0) { lstCourses.SelectedIndex = 0; } //3. setup date control WebTool.SetupHistoricDateControl(this.lstEffectiveDay, this.lstEffectiveMonth, this.lstEffectiveYear); WebTool.SetupHistoricDateControl(this.lstEffectiveToDay, this.lstEffectiveToMonth, this.lstEffectiveToYear); //4. show custom classification dropdown if required DisplayClassifications(); }
protected void lnkAssignUsers_Click(object sender, System.EventArgs e) { //TODO: functionality here int PolicyID; try { PolicyID = int.Parse(Session["PolicyID"].ToString()); } catch { PolicyID = -1; } BusinessServices.Policy objPolicy = new BusinessServices.Policy(); DisplayType = "search"; BusinessServices.Unit objUnit = new BusinessServices.Unit(); DataSet dstUnits = objUnit.GetUnitsTreeByUserID(UserContext.UserData.OrgID, UserContext.UserID, 'A', false); if (dstUnits.Tables[0].Rows.Count == 0) { //No Units and therefore no users - display message and hide controls this.panUserUnitSelect.Visible = false; this.panUserDetails.Visible = false; this.panSearchReset.Visible = false; this.lblUserMessage.Visible = true; this.lblUserMessage.Text = ResourceManager.GetString("NoUnits"); this.lblUserMessage.CssClass = "FeedbackMessage"; } else { this.panUserUnitSelect.Visible = true; this.panUserDetails.Visible = true; this.panSearchReset.Visible = true; this.lblUserMessage.Visible = false; } this.panAssignUsers.Visible = true; this.panAssignUnits.Visible = false; this.panUnitSelect.Visible = false; this.panAssign.Visible = false; this.panUserSearchResults.Visible = false; this.panUserSaveAll.Visible = false; this.panUserSearchMessage.Visible = false; this.panViewUsers.Visible = false; this.panUserList.Visible = false; this.panUnitSaveAll.Visible = false; this.lblUserAssignMessage.Text = String.Empty; blnViewUsers = false; }
private void LoadUnitTree() { BusinessServices.Unit objUnit= new BusinessServices.Unit(); // Unit Object DataSet dstUnits = objUnit.GetUnitsTreeByUserID(UserContext.UserData.OrgID,UserContext.UserID,'A'); // Data set to contain unit details if (dstUnits.Tables[0].Rows.Count==0) { this.plhSearchCriteria.Visible=false; this.lblError.Text=ResourceManager.GetString("lblError.NoUnit");//"No units exist within this organisation."; this.lblError.Visible=true; return; } string strUnits = UnitTreeConvert.ConvertXml(dstUnits); // comma seperated list of units this.trvUnitPath.LoadXml(strUnits); }
private void SetAssignedUnits() { int PolicyID; try { PolicyID = int.Parse(Session["PolicyID"].ToString()); } catch { PolicyID = -1; } BusinessServices.Policy objPolicy = new BusinessServices.Policy(); DataTable dtAssignedUnits = objPolicy.GetPolicyUnitAccess(PolicyID); BusinessServices.Unit objUnit = new BusinessServices.Unit(); DataSet dstUnits = objUnit.GetUnitsTreeByUserID(UserContext.UserData.OrgID, UserContext.UserID, 'A', false); if (dstUnits.Tables[0].Rows.Count > 0) { //Loop through and assign values to a string array string[] strAssignedUnits = new string[dtAssignedUnits.Rows.Count]; for (int row = 0; row < dtAssignedUnits.Rows.Count; ++row) { strAssignedUnits[row] = dtAssignedUnits.Rows[row]["UnitID"].ToString(); } this.trvUnitsSelector.SetSelectedValues(strAssignedUnits); this.lblSelectUnits.Visible = true; this.lblUnitMessage.Visible = false; this.btnAssign.Visible = true; } else { //No units exist - display message this.lblUnitMessage.Visible = true; this.lblSelectUnits.Visible = false; this.lblUnitMessage.Text = ResourceManager.GetString("NoUnits"); this.lblUnitMessage.CssClass = "FeedbackMessage"; this.btnAssign.Visible = false; } }
/// <summary> /// Paint Critera section of the page /// </summary> /// <remarks> /// Assumptions: None /// Notes: /// Author: Stephen K-Clark /// Changes: /// </remarks> private void PaintCriteraPageState() { // Paint the unit selector BusinessServices.Unit objUnit = new BusinessServices.Unit(); // Unit Object DataSet dstUnits = objUnit.GetUnitsTreeByUserID(UserContext.UserData.OrgID, UserContext.UserID, 'A'); // Data set to contain unit details if (dstUnits.Tables[0].Rows.Count > 0) { string strUnits = UnitTreeConvert.ConvertXml(dstUnits); // comma seperated list of units this.trvUnitsSelector.LoadXml(strUnits); // Paint the course list details int intOrganisationID = UserContext.UserData.OrgID; // organisation ID BusinessServices.Course objCourse = new BusinessServices.Course(); //Course Object DataTable dtbCourses = objCourse.GetCourseListAccessableToOrg(intOrganisationID); // List of courses accesable to the organisation if (dtbCourses.Rows.Count == 0) { this.plhSearchCriteria.Visible = false; this.lblError.Text += ResourceManager.GetString("lblError.NoCourse"); //"No courses exist within this organisation."; this.lblError.CssClass = "FeedbackMessage"; this.lblError.Visible = true; } else { cboCourse.DataSource = dtbCourses; cboCourse.DataValueField = "CourseID"; cboCourse.DataTextField = "Name"; cboCourse.DataBind(); } SetupDateControl(this.lstEffectiveDay, this.lstEffectiveMonth, this.lstEffectiveYear); } else { this.plhSearchCriteria.Visible = false; this.lblError.Text += ResourceManager.GetString("lblError.NoUnit"); //"No units exist within this organisation."; this.lblError.CssClass = "FeedbackMessage"; this.lblError.Visible = true; } }
/// <summary> /// This method configured the screen to be appropriate for the type of report being generated. /// </summary> private void ConfigureParameterScreen() { int intAdminReportType = Convert.ToInt16(ViewState[cm_strAdminReportTypeParameterName]); // Hide areas of the screen switch (intAdminReportType) { case (int)AdminReportType.Current: { // Current reports dont have any date controls. HideEffectiveDateControl(); break; } case (int)AdminReportType.Historic: { // Historical reports have just the effective point in history date control ShowEffectiveDateControl(); SetupDateControl(lstEffectiveDay, lstEffectiveMonth, lstEffectiveYear); break; } } DisplayClassifications(); // Get Courses accessable to this organisation Course objCourse = new Course(); DataTable dtbCourses = objCourse.GetCourseListAccessableToOrg(UserContext.UserData.OrgID); if (dtbCourses.Rows.Count > 0) { lstCourses.DataSource = dtbCourses; lstCourses.DataTextField = "Name"; lstCourses.DataValueField = "CourseID"; lstCourses.DataBind(); } else { this.lblError.Visible = true; this.lblError.Text += "<BR>" + ResourceManager.GetString("lblError.NoCourse"); //"No courses exist within this organisation."; this.lblError.CssClass = "WarningMessage"; this.panelSearchCriteria.Visible = false; } // If there is at least one course then select it. if (lstCourses.Items.Count > 0) { lstCourses.SelectedIndex = 0; } // Populate past courses DataTable dtPastCourses = objCourse.GetPastCourseListForOrg(UserContext.UserData.OrgID); if (dtPastCourses.Rows.Count > 0) { lstPastCourses.DataSource = dtPastCourses; lstPastCourses.DataTextField = "Name"; lstPastCourses.DataValueField = "CourseID"; lstPastCourses.DataBind(); } // Get Units accessable to this user. BusinessServices.Unit objUnit = new BusinessServices.Unit(); DataSet dstUnits = objUnit.GetUnitsTreeByUserID(UserContext.UserData.OrgID, UserContext.UserID, 'A'); // Convert this to an xml string for rendering by the UnitTreeConverter. string strUnits = UnitTreeConvert.ConvertXml(dstUnits); if (strUnits == "") { // No units found. this.lblError.Visible = true; this.lblError.Text += "<BR>" + ResourceManager.GetString("lblError.NoUnit"); //No units exist within this organisation."; this.lblError.CssClass = "FeedbackMessage"; this.panelSearchCriteria.Visible = false; } else { // Change to the appropriate view and load the Units in this.trvUnitsSelector.LoadXml(strUnits); } }
protected void Page_Load(object sender, System.EventArgs e) { BusinessServices.Organisation objOrganisation = new BusinessServices.Organisation(); if (objOrganisation.GetOrganisationPolicyAccess(UserContext.UserData.OrgID)) { //Response.AddHeader("Refresh", Convert.ToString((Session.Timeout*60)-10)); //To get treeview to work correctly when not rendered until link clicked on Page.RegisterHiddenField("StaticPostBackScrollVerticalPosition", "0"); Page.RegisterHiddenField("StaticPostBackScrollHorizontalPosition", "0"); string Success = ""; ResourceManager.RegisterLocaleResource("ConfirmUpload"); pagTitle.InnerText = ResourceManager.GetString("pagTitle"); ddlStatus.Items[0].Text = ResourceManager.GetString("cmnActive"); ddlStatus.Items[1].Text = ResourceManager.GetString("cmnInactive"); int PolicyID; try { PolicyID = Int32.Parse(Session["PolicyID"].ToString()); } catch { PolicyID = -1; } if (PolicyID > 0) { panTabs.Visible = true; } else { panTabs.Visible = false; } if (!Page.IsPostBack) { InitialiseSession = true; Session["PageIndex"] = 0; LoadPolicy(PolicyID); //Show Parent Units tree BusinessServices.Unit objUnit = new BusinessServices.Unit(); DataSet dstUnits = objUnit.GetUnitsTreeByUserID(UserContext.UserData.OrgID, UserContext.UserID, 'A', false); if (dstUnits.Tables[0].Rows.Count != 0) { string strUnits = UnitTreeConvert.ConvertXml(dstUnits); this.trvUnitsSelector.LoadXml(strUnits); this.trvUserUnitsSelector.LoadXml(strUnits); } // Initially hide all assignment panels until user clicks on them this.panAssignUnits.Visible = false; this.panUnitSelect.Visible = false; this.panAssign.Visible = false; this.panUserUnitSelect.Visible = false; this.panAssignUsers.Visible = false; this.panUserDetails.Visible = false; this.panSearchReset.Visible = false; this.panUserSearchResults.Visible = false; this.panViewUsers.Visible = false; this.panUserList.Visible = false; this.panUnitSaveAll.Visible = false; this.panUserSaveAll.Visible = false; this.panUserSearchMessage.Visible = false; SetSortOrder("LastName"); } if (Request.QueryString["Success"] != null) { Success = Request.QueryString["Success"].ToString(); if (Success == "true") { this.lblPolicyName.Text = ResourceManager.GetString("PolicySaved"); this.lblPolicyName.CssClass = "SuccessMessage"; } } } else { pagTitle.InnerText = ResourceManager.GetString("pagTitle"); panPolicy.Visible = false; lblMessage.Text = ResourceManager.GetString("NoAccess"); lblMessage.CssClass = "WarningMessage"; } }