示例#1
0
        private void ShowReport()
        {
            //1.Gather criteria
            // Get the selected units
            // string  strParentUnits  = String.Join(",",this.trvUnitsSelector.GetSelectedValues());
            string[] selectUnits;
            selectUnits = trvUnitsSelector.GetSelectedValues();
            //Double check
            BusinessServices.Unit objUnit = new  BusinessServices.Unit();
            selectUnits = objUnit.ReturnAdministrableUnitsByUserID(UserContext.UserID, UserContext.UserData.OrgID, selectUnits);
            string strParentUnits = String.Join(",", selectUnits);

            // Get the selected course and Complete / Incomplete status
            int intCourseID = Convert.ToInt32(cboCourse.SelectedValue);

            // Gather date parts for historic date
            DateTime dtEffective;

            if ((this.lstEffectiveDay.SelectedValue.Length > 0) && (this.lstEffectiveMonth.SelectedValue.Length > 0) && (this.lstEffectiveYear.SelectedValue.Length > 0))
            {
                dtEffective = new DateTime(int.Parse(this.lstEffectiveYear.SelectedValue), int.Parse(this.lstEffectiveMonth.SelectedValue), int.Parse(this.lstEffectiveDay.SelectedValue));
            }
            else
            {
                dtEffective = DateTime.Today;
            }

            if (this.optReportType.SelectedValue == "Table")
            {
                this.rvReport.ReportPath = this.rvReport.ReportPath;
            }
            else
            {
                this.rvReport.ReportPath = this.rvReport.ReportPath + this.optReportType.SelectedValue;
            }

            int intClassificationID = 0;

            if (this.cboCustomClassification.SelectedIndex > 0)
            {
                intClassificationID = int.Parse(cboCustomClassification.SelectedValue);
            }

            //2. Add criteria to the report viewer
            Hashtable parameters = this.rvReport.Parameters;

            parameters["organisationID"] = UserContext.UserData.OrgID;
            parameters["adminUserID"]    = UserContext.UserID;

            parameters["unitIDs"]   = strParentUnits;
            parameters["courseIDs"] = intCourseID;
            if (dtEffective != DateTime.Today)
            {
                parameters["effectiveDate"] = dtEffective.ToString("dd/MMM/yyyy");
            }

            parameters["langCode"]          = Request.Cookies["currentCulture"].Value;
            parameters["langInterfaceName"] = "Report.Summary";
            parameters["classificationID"]  = intClassificationID;
        }
示例#2
0
        private void ShowReport()
        {
            //2. Add criteria to the report viewer
            Hashtable parameters = this.rvReport.Parameters;

            string[] selectUnits;
            selectUnits = trvUnitPath.GetSelectedValues();
            //Double check
            BusinessServices.Unit objUnit = new  BusinessServices.Unit();
            selectUnits = objUnit.ReturnAdministrableUnitsByUserID(UserContext.UserID, UserContext.UserData.OrgID, selectUnits);
            string strParentUnits = String.Join(",", selectUnits);

            parameters["unitIDs"]           = strParentUnits;
            parameters["organisationID"]    = UserContext.UserData.OrgID;
            parameters["adminUserID"]       = UserContext.UserID;
            parameters["langCode"]          = Request.Cookies["currentCulture"].Value;
            parameters["langInterfaceName"] = "Report.CPDReport";
            parameters["profileid"]         = this.cboProfile.SelectedValue == ""?"-1":this.cboProfile.SelectedValue;
            parameters["profileperiodid"]   = this.cboPeriod.SelectedValue == ""?"-1":this.cboPeriod.SelectedValue;
            parameters["UserFirstName"]     = this.txtFirstName.Text;
            parameters["UserLastName"]      = this.txtLastName.Text;
            parameters["userName"]          = this.txtUserName.Text;
            parameters["shortfallusers"]    = this.chbShortFallUsers.Checked?1:0;
            // report title for the CPD Report
            int intOrganisationID = UserContext.UserData.OrgID;

            BusinessServices.Profile objProfile = new BusinessServices.Profile();
            parameters["rptReportTitle"] = objProfile.getCPDReportTitle(intOrganisationID);
        }
示例#3
0
        /// <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>
        /// 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>
        /// 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;
            }
        }
示例#6
0
        /// <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");
            }
        }
示例#7
0
        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>
        /// Event handler for the Add button
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnAdd_Click(object sender, System.EventArgs e)
        {
            // Unit object used to add the adminisrator
            BusinessServices.Unit objUnit;

            // The userif from the previous form
            int intUserID;

            // boolean flag indicating if the SubUnit option was checked
            bool blnAdminSubUnit;

            // Gather variables
            if (Request.Form["UserID"] == null)
            {
                this.lblMessage.Text     = ResourceManager.GetString("lblMessage.NoUser");//"You did not select a user!";
                this.lblMessage.CssClass = "WarningMessage";
            }
            else
            {
                intUserID       = int.Parse(Request.Form["UserID"]);
                blnAdminSubUnit = this.chkAdminSub.Checked;

                objUnit = new  BusinessServices.Unit();

                // Add Administrator to new unit
                objUnit.AddAdministrator(this.m_intUnitID, intUserID, blnAdminSubUnit, UserContext.UserID);

                Response.Redirect("UnitAdministrators.aspx?UnitID=" + m_intUnitID.ToString());
            }
        }
示例#9
0
        /// <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");
            }
        }
示例#10
0
        /// <summary>
        /// Add units to the criteria list via a csv list of course id's
        /// </summary>
        /// <param name="strUnitIDs">Csv list of units.</param>
        public void AddUnits(string strUnitIDs)
        {
            // Local variables
            if (strUnitIDs != null && strUnitIDs.Length > 0)
            {
                string[] astrUnitIDs  = strUnitIDs.Split(',');
                string   strUnitNames = "";

                // Get Unit List
                BusinessServices.Unit objUnit = new BusinessServices.Unit();
                DataTable             dtbUnit;
                // Loop through all Units
                foreach (string strUnitID in astrUnitIDs)
                {
                    dtbUnit       = objUnit.GetUnit(Int32.Parse(strUnitID));
                    strUnitNames += dtbUnit.Rows[0]["Pathway"].ToString();
                    strUnitNames += "<BR>";
                }

                // Remove trailing command if it exists and replace with a full stop
                if (strUnitNames.Length > 0)
                {
                    strUnitNames  = strUnitNames.Substring(0, strUnitNames.Length - 2);
                    strUnitNames += ".";
                }

                // add to the criteria list
                this.Criteria.Add(ResourceManager.GetString("lblUnits"), strUnitNames);
            }
            else
            {
                // add to the criteria list
                this.Criteria.Add(ResourceManager.GetString("lblUnits"), ResourceManager.GetString("lblAny"));
            }
        }
示例#11
0
        protected void btnShowComplianceRules_Click(object sender, System.EventArgs e)
        {
            panelReport.Visible       = true;
            panelReportParams.Visible = false;

            Hashtable parameters = this.rvReport.Parameters;

            parameters["organisationID"] = UserContext.UserData.OrgID;
            parameters["AdminUserID"]    = UserContext.UserID;

            //1.Gather criteria
            // Get the selected units
            // string  strParentUnits  = String.Join(",",this.trvUnitsSelector.GetSelectedValues());
            string[] selectUnits;
            selectUnits = trvUnitPath.GetSelectedValues();
            //Double check
            BusinessServices.Unit objUnit = new  BusinessServices.Unit();
            selectUnits = objUnit.ReturnAdministrableUnitsByUserID(UserContext.UserID, UserContext.UserData.OrgID, selectUnits);
            string strParentUnits = String.Join(",", selectUnits);

            parameters["unitIDs"] = strParentUnits;

            if (chkIncludeInactiveUnits.Checked)
            {
                parameters["IncludeInactive"] = 1;
            }
            else
            {
                parameters["IncludeInactive"] = 0;
            }

            parameters["langCode"]          = Request.Cookies["currentCulture"].Value;
            parameters["langInterfaceName"] = "Report.UnitComplianceReport";
        }
示例#12
0
        /// <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);
            }
        }
示例#13
0
        /// <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");
        }
示例#14
0
        /// <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);
                }
            }
        }
示例#15
0
        private void ShowReport()
        {
            //1.Gather criteria
            // Get the selected units
            // string  strParentUnits  = String.Join(",",this.trvUnitsSelector.GetSelectedValues());
            string[] selectUnits;
            string   strCourses = "";

            selectUnits = trvUnitsSelector.GetSelectedValues();

            //Double check
            BusinessServices.Unit objUnit = new  BusinessServices.Unit();
            selectUnits = objUnit.ReturnAdministrableUnitsByUserID(UserContext.UserID, UserContext.UserData.OrgID, selectUnits);
            string strParentUnits = String.Join(",", selectUnits);

            // Get the selected courses
            for (int intIndex = 0; intIndex != this.lstCourses.Items.Count; intIndex++)
            {
                if (this.lstCourses.Items[intIndex].Selected)
                {
                    if (intIndex == 0)
                    {
                        strCourses += this.lstCourses.Items[intIndex].Value;
                    }
                    else
                    {
                        strCourses += "," + this.lstCourses.Items[intIndex].Value;
                    }
                }
            }

            int intClassificationID = 0;

            if (this.cboCustomClassification.SelectedIndex > 0)
            {
                intClassificationID = int.Parse(this.cboCustomClassification.SelectedValue);
            }

            //2. Add criteria to the report viewer
            Hashtable parameters = this.rvReport.Parameters;

            parameters["organisationID"]    = UserContext.UserData.OrgID;
            parameters["adminUserID"]       = UserContext.UserID;
            parameters["unitIDs"]           = strParentUnits;
            parameters["courseIDs"]         = strCourses;
            parameters["langCode"]          = Request.Cookies["currentCulture"].Value;
            parameters["langInterfaceName"] = "Report.Progress";
            parameters["classificationID"]  = intClassificationID;
            if (chkIncludeInactiveUsers.Checked)
            {
                parameters["IncludeInactive"] = 1;
            }
            else
            {
                parameters["IncludeInactive"] = 0;
            }
        }
        /// <summary>
        /// Event handler for the populate all button
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnPopulateAll_Click(object sender, System.EventArgs e)
        {
            // String that holds the error message
            string strErrorMessage = "";

            // Integers holding the organisation properties
            int intCourseID;
            int intLessonFrequency, intQuizFrequency, intQuizPassMark;

            BusinessServices.Unit objUnit = new BusinessServices.Unit();

            // Gather the selected values
            intCourseID        = int.Parse(this.cboCourse.SelectedValue);
            intLessonFrequency = int.Parse(this.cboLessonFrequency.SelectedValue);
            intQuizFrequency   = int.Parse(this.cboQuizFrequency.SelectedValue);

            DateTime lessonCompletionDate = DateTime.Parse("1/1/1900");

            strErrorMessage = Bdw.Application.Salt.Web.General.Shared.Validation.Validate_Frequency_CompletionDates(ref lessonCompletionDate, cboLessonFrequency.SelectedValue, cboLCompletionDay.SelectedValue, cboLCompletionMonth.SelectedValue, cboLCompletionYear.SelectedValue);

            DateTime quizCompletionDate = DateTime.Parse("1/1/1900");

            strErrorMessage = Bdw.Application.Salt.Web.General.Shared.Validation.Validate_Frequency_CompletionDates(ref quizCompletionDate, cboQuizFrequency.SelectedValue, cboQCompletionDay.SelectedValue, cboQCompletionMonth.SelectedValue, cboQCompletionYear.SelectedValue);

            try
            {
                intQuizPassMark = int.Parse(this.txtQuizPassMark.Text);
                if ((intQuizPassMark < 1) || (intQuizPassMark > 100))
                {
                    strErrorMessage = c_strPassMarkValidation;
                }
            }
            catch
            {
                intQuizPassMark = 100;
                strErrorMessage = c_strPassMarkValidation;
            }

            if (strErrorMessage == "")
            {
                objUnit.SaveModuleRuleToAll(this.m_intUnitID, intCourseID, intLessonFrequency, intQuizFrequency, intQuizPassMark, lessonCompletionDate, quizCompletionDate, UserContext.UserID, UserContext.UserData.OrgID);

                this.GetModuleRule();

                this.lblMessage.Text     = ResourceManager.GetString("lblMessage.Populated");            //"The Compliance Rules have been populated to all the modules in the course.";
                this.lblMessage.CssClass = "SuccessMessage";
            }
            else
            {
                this.lblMessage.Text     = strErrorMessage;
                this.lblMessage.CssClass = "WarningMessage";
            }
            // Reset the grid
            this.grdModules.EditItemIndex = -1;
        }
        /// <summary>
        /// Get Pagination Data
        /// </summary>
        /// <returns></returns>
        private DataView GetPaginationData()
        {
            BusinessServices.Unit objUnit;
            DataTable             dtbUsers;

            objUnit = new  BusinessServices.Unit();

            dtbUsers = objUnit.GetAdministrators(this.m_intUnitID);

            return(dtbUsers.DefaultView);
        }
示例#18
0
        private void ShowReport()
        {
            //1.Gather criteria
            // Get the selected units
            // string  strParentUnits  = String.Join(",",this.trvUnitsSelector.GetSelectedValues());
            string[] selectUnits;
            selectUnits = trvUnitsSelector.GetSelectedValues();
            //Double check
            BusinessServices.Unit objUnit = new  BusinessServices.Unit();
            selectUnits = objUnit.ReturnAdministrableUnitsByUserID(UserContext.UserID, UserContext.UserData.OrgID, selectUnits);
            string strParentUnits = String.Join(",", selectUnits);

            // Get the selected course
            int intCourseID = Convert.ToInt32(cboCourse.SelectedValue);

            // Gather date parts for trend date
            DateTime dtEffective;
            DateTime dtEffectiveTo;

            if ((this.lstEffectiveDay.SelectedValue.Length > 0) && (this.lstEffectiveMonth.SelectedValue.Length > 0) && (this.lstEffectiveYear.SelectedValue.Length > 0))
            {
                dtEffective = new DateTime(int.Parse(this.lstEffectiveYear.SelectedValue), int.Parse(this.lstEffectiveMonth.SelectedValue), int.Parse(this.lstEffectiveDay.SelectedValue));
            }
            else
            {            // The user select 'To Date' only
                // Set the from date to a past date to cover all the record has been created
                dtEffective = new DateTime(1997, 1, 1);
            }



            if ((this.lstEffectiveToDay.SelectedValue.Length > 0) && (this.lstEffectiveToMonth.SelectedValue.Length > 0) && (this.lstEffectiveToYear.SelectedValue.Length > 0))
            {
                dtEffectiveTo = new DateTime(int.Parse(this.lstEffectiveToYear.SelectedValue), int.Parse(this.lstEffectiveToMonth.SelectedValue), int.Parse(this.lstEffectiveToDay.SelectedValue));
            }
            else
            {
                dtEffectiveTo = DateTime.Today;
            }

            //2. Add criteria to the report viewer
            Hashtable parameters = this.rvReport.Parameters;

            parameters["organisationID"] = UserContext.UserData.OrgID;
            parameters["adminUserID"]    = UserContext.UserID;

            parameters["unitIDs"]   = strParentUnits;
            parameters["courseIDs"] = intCourseID;
            parameters["FromDate"]  = dtEffective;
            parameters["ToDate"]    = dtEffectiveTo;

            parameters["langCode"]          = Request.Cookies["currentCulture"].Value;
            parameters["langInterfaceName"] = "Report.Trend";
        }
示例#19
0
        /// <summary>
        /// Lists all modules in the selected course
        /// </summary>
        private void GetModuleAccess()
        {
            BusinessServices.Unit objUnit = new BusinessServices.Unit();
            int       intCourseID         = int.Parse(this.cboCourse.SelectedValue);
            DataTable dtbModules          = objUnit.GetModuleAccess(this.m_intUnitID, intCourseID);

            //this.grdModules.DataSource = dtbModules;
            //this.grdModules.DataBind();

            this.rptModuleList.DataSource = dtbModules;
            this.rptModuleList.DataBind();
        }
示例#20
0
        /// <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();
        }
        /// <summary>
        /// Lists all modules in the selected course
        /// </summary>
        private DataTable GetModuleRule()
        {
            // Unit used to gather the module rules
            BusinessServices.Unit objUnit = new BusinessServices.Unit();
            // Holds the selected course id
            int       intCourseID = int.Parse(this.cboCourse.SelectedValue);
            DataTable dtbModules  = objUnit.GetModuleRule(this.m_intUnitID, intCourseID);

            this.grdModules.DataSource   = dtbModules;
            this.grdModules.DataKeyField = "ModuleID";
            this.grdModules.DataBind();

            return(dtbModules);
        }
示例#22
0
        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;
        }
示例#23
0
        /// <summary>
        /// Save Unit module access settings
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnSave_Click(object sender, System.EventArgs e)
        {
            string strGrantedModuleIDs;

            strGrantedModuleIDs = Request.Form["chkGrantedModule"];
            int intCourseID = int.Parse(this.cboCourse.SelectedValue);

            BusinessServices.Unit objUnit = new BusinessServices.Unit();
            objUnit.SaveModuleAccess(this.m_intUnitID, intCourseID, strGrantedModuleIDs, chbIsInherit.Checked);

            this.GetModuleAccess();

            this.lblMessage.Text     = ResourceManager.GetString("lblMessage.Saved");        //"Unit Module Access has been saved successfully.";
            this.lblMessage.CssClass = "SuccessMessage";
        }
示例#24
0
		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);
		}
示例#25
0
        /// <summary>
        /// Get Unit's Details
        /// </summary>
        private void GetDetails()
        {
            BusinessServices.Unit objUnit;
            DataTable             dtbUnit;
            int intOrganisationID;

            //1. Get Unit details
            objUnit             = new BusinessServices.Unit();
            dtbUnit             = objUnit.GetUnit(this.m_intUnitID);
            this.txtName.Text   = dtbUnit.Rows[0]["Name"].ToString();
            this.txtUnitID.Text = this.m_intUnitID.ToString();
            if (dtbUnit.Rows[0]["Active"].ToString() == "True")
            {
                this.cboStatus.SelectedIndex = 0;
            }
            else
            {
                this.cboStatus.SelectedIndex = 1;
            }

            this.lblPathway.Text = dtbUnit.Rows[0]["Organisation"].ToString() + " > " + dtbUnit.Rows[0]["Pathway"].ToString();


            DateTime dteOriginalDateUpdated = (DateTime)dtbUnit.Rows[0]["DateUpdated"];

            this.OriginalDateUpdated = DatabaseTool.ToLongDateTimeString(dteOriginalDateUpdated);

            intOrganisationID = (int)dtbUnit.Rows[0]["OrganisationID"];

            //2. Get Sub-Units tree
            DataSet dstUnits = objUnit.GetUnitsByOrganisation(intOrganisationID, "", "", "", this.m_intUnitID);

            string strUnits = UnitTreeConvert.ConvertXml(dstUnits);

            if (strUnits == "")
            {
                this.trvSubUnits.Visible   = false;
                this.lblNoSubUnits.Visible = true;
            }
            else
            {
                this.trvSubUnits.Visible   = true;
                this.lblNoSubUnits.Visible = false;
                this.trvSubUnits.LoadXml(strUnits);
            }
        }
        private void grdPagination_DeleteCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e)
        {
            int intUserID = (int)this.grdPagination.DataKeys[e.Item.ItemIndex];

            BusinessServices.Unit objUnit;

            objUnit = new  BusinessServices.Unit();

            objUnit.RemoveAdministrator(this.m_intUnitID, intUserID, UserContext.UserID);

            this.ShowPagination(this.grdPagination.CurrentPageIndex);

            int periodicReportsCount = PeriodicReportCountUser(intUserID);

            if (periodicReportsCount > 0)
            {
                Response.Redirect("/Reporting/PeriodicReportList.aspx?user="******"&isoninactivate=true");
            }
        }
示例#27
0
        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;
            }
        }
示例#28
0
        /// <summary>
        /// Get Pagination Data
        /// </summary>
        /// <returns></returns>
        private DataView GetData()
        {
            //Customize, and return DataView
            string strParentUnits, strUnitName;
            int    unitID;

            bool result = Int32.TryParse(this.txtUnitID.Text, out unitID);

            if (!result)
            {
                unitID = 0;
            }

            strParentUnits = String.Join(",", this.trvUnitsSelector.GetSelectedValues());
            strUnitName    = this.txtUnitName.Text.Trim();

            BusinessServices.Unit objUnit  = new  BusinessServices.Unit();
            DataTable             dtbUnits = objUnit.Search(UserContext.UserData.OrgID, strParentUnits, strUnitName, UserContext.UserID, unitID, this.chkInactiveUnits.Checked);

            return(dtbUnits.DefaultView);
        }
示例#29
0
        /// <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;
            }
        }
示例#30
0
        protected void btnSave_Click(object sender, System.EventArgs e)
        {
            string strName;
            bool   blnActive;

            BusinessServices.Unit objUnit;

            //1. Get Unit Details
            strName   = this.txtName.Text;
            blnActive = (this.cboStatus.SelectedIndex == 0);

            DateTime dteOriginalDateUpdated = DateTime.Parse(this.OriginalDateUpdated);

            //2. Save Details
            objUnit = new BusinessServices.Unit();

            try
            {
                objUnit.Update(this.m_intUnitID, strName, blnActive, UserContext.UserID, dteOriginalDateUpdated, UserContext.UserData.OrgID);

                //3. Reload the unit's details
                //This will reset the updated date time for integrity checking
                this.GetDetails();
                this.lblMessage.Text     = ResourceManager.GetString("btnSave_Click");            //"The Unit's Details have been updated successfully";
                this.lblMessage.CssClass = "SuccessMessage";
            }
            catch (IntegrityViolationException ex)
            {
                this.lblMessage.Text     = ex.Message.Replace("[Url]", "UnitDetails.aspx?UnitID=" + this.m_intUnitID.ToString());
                this.lblMessage.CssClass = "WarningMessage";
            }
            catch (BusinessServiceException ex)
            {
                this.lblMessage.Text     = ex.Message;
                this.lblMessage.CssClass = "WarningMessage";
            }
        }