Exemplo n.º 1
0
        }         // StartPagination

        /// <summary>
        /// Gets the pagination data.
        /// </summary>
        /// <returns> DataView with all users that are not organisation administrators.</returns>
        private DataView GetPaginationData()
        {
            Bdw.Application.Salt.BusinessServices.Organisation objOrganisation = new Bdw.Application.Salt.BusinessServices.Organisation();
            DataTable dtbAdmins = objOrganisation.GetOrganisationAdministrators(UserContext.UserData.OrgID);

            //Customize, and return DataView
            return(dtbAdmins.DefaultView);
        }         // GetPaginationData
Exemplo n.º 2
0
        private void InitializeComponent()
        {
            // language stuff for radio group 2
            radEscMgrMailOpts.Items[0].Text = ResourceManager.GetString("radEscOpts0");
            radEscMgrMailOpts.Items[1].Text = ResourceManager.GetString("radEscOpts1");

            objOrganisation = new BusinessServices.Organisation();
        }
Exemplo n.º 3
0
        }         // StartPagination

        /// <summary>
        /// Gets the pagination data.
        /// </summary>
        /// <returns> DataView with all users that are not organisation administrators.</returns>
        private DataView GetPaginationData()
        {
            Bdw.Application.Salt.BusinessServices.Organisation objOrganisation = new Bdw.Application.Salt.BusinessServices.Organisation();
            DataTable dtbUsers = objOrganisation.GetUsers(UserContext.UserData.OrgID, this.txtFirstName.Text, this.txtLastName.Text);

            // Customize, and return DataView
            return(dtbUsers.DefaultView);
        }         // GetPaginationData
Exemplo n.º 4
0
        }         // BindGrid

        /// <summary>
        /// Updates an Admin to be an non administratove user.
        /// </summary>
        /// <param name="userID">ID of the Admin to be pudated.</param>
        /// <param name="originalDateUpdated">Original date updated</param>
        private void RemoveAdministrator(int userID, DateTime originalDateUpdated)
        {
            try
            {
                //1. Delete the link from the tblLink table.
                Bdw.Application.Salt.BusinessServices.Organisation objOrganisation = new Bdw.Application.Salt.BusinessServices.Organisation();
                objOrganisation.RemoveAdministrator(userID, UserContext.UserID, UserContext.UserData.OrgID, originalDateUpdated);

                this.lblMessage.Text     = ResourceManager.GetString("lblMessage");            //"The selected organisation administrator has been successfully removed.";
                this.lblMessage.CssClass = "SuccessMessage";

                //2. Reset the item index and rebind the DataGrid.
                this.grdPagination.EditItemIndex = -1;
                this.BindGrid();

                int periodicReportCount = PeriodicReportCountUser(userID);
                if (periodicReportCount > 0)
                {
                    Response.Redirect("/Reporting/PeriodicReportList.aspx?user="******"&isoninactivate=true");
                }
            }
            catch (RecordNotFoundException ex)
            {
                this.lblMessage.Text     = ex.Message;
                this.lblMessage.CssClass = "WarningMessage";
            }
            catch (ParameterException ex)
            {
                throw ex;
            }
            catch (PermissionDeniedException)
            {
                FormsAuthentication.SignOut();
                if (FormsAuthentication.RequireSSL)
                {
                    Response.Redirect("https://" + Request.Url.Host + FormsAuthentication.LoginUrl);
                }
                else
                {
                    Response.Redirect("http://" + Request.Url.Host + FormsAuthentication.LoginUrl);
                }
            }
            catch (IntegrityViolationException ex)
            {
                this.lblMessage.Text     = ex.Message;
                this.lblMessage.CssClass = "WarningMessage";
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }         // RemoveAdministrator
Exemplo n.º 5
0
        }         // BindGrid

        /// <summary>
        /// Updates a User to be an organisation administrator.
        /// </summary>
        /// <param name="userID"> ID of the Admin to be updated.</param>
        /// <param name="originalDateUpdated">Date/time user was updated when page was loaded</param>
        private void AddAdministrator(int userID, DateTime originalDateUpdated)
        {
            try
            {
                //1. Update the user to be an organisation administrator.
                Bdw.Application.Salt.BusinessServices.Organisation objOrganisation = new Bdw.Application.Salt.BusinessServices.Organisation();
                objOrganisation.AddAdministrator(userID, UserContext.UserID, UserContext.UserData.OrgID, originalDateUpdated);

                /*
                 * Changed 03/05/2004 Peter Kneale
                 * User now redirected back to OrganisationAdministrators page after successfully adding one.
                 *
                 *              this.lblMessage.Text = "The selected user has been successfully added as organisation administrator.";
                 * this.lblMessage.CssClass = "SuccessMessage";
                 *
                 * //2. Reset the item index and rebind the DataGrid.
                 *              this.grdPagination.EditItemIndex = -1;
                 *              this.BindGrid();
                 */
                Response.Redirect("OrganisationAdministrators.aspx");
            }
            catch (RecordNotFoundException ex)
            {
                this.lblMessage.Text     = ex.Message;
                this.lblMessage.CssClass = "WarningMessage";
            }
            catch (ParameterException ex)
            {
                throw ex;
            }
            catch (PermissionDeniedException)
            {
                WebSecurity.SignOut();
            }
            catch (IntegrityViolationException ex)
            {
                this.lblMessage.Text     = ex.Message;
                this.lblMessage.CssClass = "WarningMessage";
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }         // AddAdministrator
        /// <summary>
        /// Load data the page is first loaded
        /// </summary>
        private void LoadData()
        {
            BusinessServices.Unit objUnit;              // Used to gather the unit details
            DataTable             dtbUnit;              // Holds the unit details
            int intOrganisationID;                      // the organisation id of the unit

            objUnit = new BusinessServices.Unit();

            // Get unit details
            dtbUnit = objUnit.GetUnit(this.m_intUnitID);

            this.lblUnitName.Text = dtbUnit.Rows[0]["Pathway"].ToString();

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

            // Emerging bug 7, 8
            DataTable dtLoadOrg;

            string strLangCode = Request.Cookies["currentCulture"].Value;

            Bdw.Application.Salt.BusinessServices.Organisation objOrganisation = new Bdw.Application.Salt.BusinessServices.Organisation();
            dtLoadOrg = objOrganisation.GetOrganisation(strLangCode, intOrganisationID);
            this.cboLessonFrequency.SelectedValue = dtLoadOrg.Rows[0]["DefaultLessonFrequency"].ToString();
            this.cboQuizFrequency.SelectedValue   = dtLoadOrg.Rows[0]["DefaultQuizFrequency"].ToString();
            this.txtQuizPassMark.Text             = dtLoadOrg.Rows[0]["DefaultQuizPassMark"].ToString();

            // Setup date dropdowns with value
            if (dtLoadOrg.Rows[0]["DefaultLessonCompletionDate"] != System.DBNull.Value)
            {
                DateTime defaultLessonCompletionDate = (DateTime)dtLoadOrg.Rows[0]["DefaultLessonCompletionDate"];
                cboLCompletionDay.SelectedValue   = defaultLessonCompletionDate.Day.ToString();
                cboLCompletionMonth.SelectedValue = defaultLessonCompletionDate.Month.ToString();
                cboLCompletionYear.SelectedValue  = defaultLessonCompletionDate.Year.ToString();
            }

            if (dtLoadOrg.Rows[0]["DefaultQuizCompletionDate"] != System.DBNull.Value)
            {
                DateTime defaultQuizCompletionDate = (DateTime)dtLoadOrg.Rows[0]["DefaultQuizCompletionDate"];
                cboQCompletionDay.SelectedValue   = defaultQuizCompletionDate.Day.ToString();
                cboQCompletionMonth.SelectedValue = defaultQuizCompletionDate.Month.ToString();
                cboQCompletionYear.SelectedValue  = defaultQuizCompletionDate.Year.ToString();
            }
            // emerging end

            //1.Load Course list that are assigned to this organisation
            this.GetCourseList(intOrganisationID);

            //2. Get Organisation Default Compliance Rules
            this.GetDefaultRules(intOrganisationID);

            if (this.cboCourse.Items.Count > 0)
            {
                //3. Lists all modules in the selected course
                this.GetModuleRule();
            }
            else
            {
                this.cboCourse.Visible      = false;
                this.grdModules.Visible     = false;
                this.btnPopulateAll.Visible = false;

                this.lblMessage.Text     = ResourceManager.GetString("lblMessage.NoCourseAccess");            //"There is no course access.";
                this.lblMessage.CssClass = "FeedbackMessage";
            }
        }
Exemplo n.º 7
0
        }         // AddOrganisation

        /// <summary>
        /// Updates the organisation details.
        /// </summary>
        private void UpdateOrganisation()
        {
            try
            {
                DateTime defaultLessonCompletionDate = DateTime.Parse("1/1/1900");
                DateTime defaultQuizCompletionDate   = DateTime.Parse("1/1/1900");
                DateTime defaultOriginalDateUpdated  = DateTime.Parse("1/1/1990");
                if (!ValidateOrganisation(ref defaultLessonCompletionDate, ref defaultQuizCompletionDate))
                {
                    return;
                }


                string   strLogoName           = this.GetOrganisationLogo();
                DateTime dtOriginalDateUpdated = DateTime.Parse(this.OriginalDateUpdated);

                string strOrganisationNotes;
                strOrganisationNotes = BusinessServices.HTMLSanitizer.Sanitize(this.txtOrganisationNotes.Text);
                strOrganisationNotes = Server.HtmlEncode(strOrganisationNotes);

                long lngDiskSpace;
                if (this.txtDiskSpace.Text.Trim() != "")
                {
                    lngDiskSpace = long.Parse(this.txtDiskSpace.Text);
                    lngDiskSpace = lngDiskSpace * (1024 * 1024);                     //Convert to  bytes
                }
                else
                {
                    lngDiskSpace = 0;
                }
                string strLangCode = Request.Cookies["currentCulture"].Value;
                Bdw.Application.Salt.BusinessServices.Organisation objOrganisation = new Bdw.Application.Salt.BusinessServices.Organisation();

                objOrganisation.UpdateOrganisation(strLangCode, UserContext.UserData.OrgID, this.txtOrganisationName.Text, strOrganisationNotes,
                                                   strLogoName,
                                                   this.cboDefaultLessonFrequency.SelectedValue == null?System.Data.SqlTypes.SqlInt32.Null:Int32.Parse(this.cboDefaultLessonFrequency.SelectedValue),
                                                   this.cboDefaultLessonFrequency.SelectedValue == null?System.Data.SqlTypes.SqlInt32.Null:Int32.Parse(this.cboDefaultQuizFrequency.SelectedValue),
                                                   this.txtDefaultQuizPassMark.Text == ""?System.Data.SqlTypes.SqlInt32.Null:Int32.Parse(this.txtDefaultQuizPassMark.Text),
                                                   defaultLessonCompletionDate,
                                                   defaultQuizCompletionDate,
                                                   UserContext.UserData.UserType == UserType.SaltAdmin?this.chkAdvancedReporting.Checked:System.Data.SqlTypes.SqlBoolean.Null,
                                                   UserContext.UserID,
                                                   dtOriginalDateUpdated,
                                                   this.txtCPDReportName.Text,
                                                   lngDiskSpace,
                                                   System.Data.SqlTypes.SqlBoolean.Parse(this.ckbIncludeLogo.Checked.ToString()),
                                                   System.Data.SqlTypes.SqlBoolean.Parse(this.chkActivatePassword.Checked.ToString()),
                                                   this.listTimeZone.SelectedItem.ToString(),
                                                   chkBxShowLastPassDate.Checked,
                                                   chkDisablePasswordField.Checked,
                                                   chkurlrequest.Checked,
                                                   chkuserCPDEvent.Checked,
                                                   chkEbookNotification.Checked
                                                   );

                //7. Save the Organisation Logo
                this.SaveOrganisationLogo(strLogoName);

                if (this.txtClassificationName.Text != "")
                {
                    if (this.ClassificationTypeID == 0)
                    {
                        //4. Save the ClassificationName
                        Classification objClassification = new Classification();
                        objClassification.AddClassificationType(this.txtClassificationName.Text, UserContext.UserData.OrgID);
                    }
                    else
                    {
                        //8. Update the ClassificationType name.
                        Classification objClassification = new Classification();
                        objClassification.UpdateClassificationType(this.txtClassificationName.Text, this.ClassificationTypeID, UserContext.UserData.OrgID);
                    }
                }

                if (ckbOverrideUnitLF.Checked)
                {
                    BusinessServices.Unit.OverrideLessonCompliance(UserContext.UserData.OrgID, defaultLessonCompletionDate, Int32.Parse(this.cboDefaultLessonFrequency.SelectedValue));
                }

                if (ckbOverrideUnitQF.Checked)
                {
                    BusinessServices.Unit.OverrideQuizCompliance(UserContext.UserData.OrgID, defaultQuizCompletionDate, Int32.Parse(this.cboDefaultQuizFrequency.SelectedValue));
                }

                //9. Reload the page
                //Response.Redirect("OrganisationDetails.aspx");
                this.lblMessage.Text     = ResourceManager.GetString("lblMessage.Saved");//"The Organisation's Details have been updated successfully";
                this.lblMessage.CssClass = "SuccessMessage";

                //10. Refresh the UI
                this.LoadData();
                this.SetPageState();
            }
            catch (UniqueViolationException ex)
            {
                this.lblMessage.Text     = ex.Message;
                this.lblMessage.CssClass = "WarningMessage";
            }
            catch (ParameterException ex)
            {
                this.lblMessage.Text     = ex.Message;
                this.lblMessage.CssClass = "WarningMessage";
            }
            catch (PermissionDeniedException ex)
            {
                this.lblMessage.Text     = ex.Message;
                this.lblMessage.CssClass = "WarningMessage";
            }
            catch (IntegrityViolationException ex)
            {
                this.lblMessage.Text     = ex.Message;
                this.lblMessage.CssClass = "WarningMessage";
            }
            catch (Exception ex)
            {
                throw new ApplicationException(ex.Message);
            }
        }         // UpdateOrganisation
Exemplo n.º 8
0
        }         // SetPageState

        /// <summary>
        /// Loads the Data from the database for the speciied Organisation.
        /// </summary>
        private void LoadData()
        {
            DataTable dtLoadOrg;

            string strLangCode = Request.Cookies["currentCulture"].Value;

            Bdw.Application.Salt.BusinessServices.Organisation objOrganisation = new Bdw.Application.Salt.BusinessServices.Organisation();
            dtLoadOrg = objOrganisation.GetOrganisation(strLangCode, UserContext.UserData.OrgID);

            // If an organisation Exists
            if (dtLoadOrg.Rows.Count > 0)
            {
                if (dtLoadOrg.Rows[0]["AllocatedDiskSpace"].ToString().Trim() != "")
                {
                    long lngDiskSpace = (long)dtLoadOrg.Rows[0]["AllocatedDiskSpace"];
                    lngDiskSpace = lngDiskSpace / (1024 * 1024);                     //Convert from bytes to MegaBytes
                    if (UserContext.UserData.UserType == UserType.SaltAdmin)
                    {
                        this.lblDiskSpaceDisplay.Visible = false;
                        this.txtDiskSpace.Visible        = true;
                        this.txtDiskSpace.Text           = lngDiskSpace.ToString();
                        this.lblDiskSpaceDisplay.Text    = lngDiskSpace.ToString();
                    }
                    else
                    {
                        this.txtDiskSpace.Visible        = false;
                        this.lblDiskSpaceDisplay.Visible = true;
                        this.lblDiskSpaceDisplay.Text    = lngDiskSpace.ToString();
                        this.txtDiskSpace.Text           = lngDiskSpace.ToString();
                    }
                }
                this.chkBxShowLastPassDate.Checked   = Boolean.Parse(dtLoadOrg.Rows[0]["ShowLastPassed"].ToString());
                this.chkDisablePasswordField.Checked = Boolean.Parse(dtLoadOrg.Rows[0]["DisablePasswordField"].ToString());
                if (chkDisablePasswordField.Checked)
                {
                    chkurlrequest.Enabled = false;
                    chkurlrequest.Checked = false;
                }
                else
                {
                    chkurlrequest.Checked = Boolean.Parse(dtLoadOrg.Rows[0]["EnableUniqueURL"].ToString());
                    chkurlrequest.Enabled = true;
                }

                int OrganisationID = UserContext.UserData.OrgID;

                if (objOrganisation.GetOrganisationCPDEventAccess(UserContext.UserData.OrgID))
                {
                    truserevent.Visible = true;
                }
                else
                {
                    truserevent.Visible = false;
                }

                this.chkuserCPDEvent.Checked = Boolean.Parse(dtLoadOrg.Rows[0]["EnableUserCPDEvent"].ToString());

                this.txtOrganisationName.Text  = dtLoadOrg.Rows[0]["OrganisationName"].ToString();
                this.txtOrganisationNotes.Text = Server.HtmlDecode(dtLoadOrg.Rows[0]["Notes"].ToString());
                this.lblLogo.Text = dtLoadOrg.Rows[0]["Logo"].ToString() + " ";
                this.cboDefaultLessonFrequency.SelectedValue = dtLoadOrg.Rows[0]["DefaultLessonFrequency"].ToString();
                this.cboDefaultQuizFrequency.SelectedValue   = dtLoadOrg.Rows[0]["DefaultQuizFrequency"].ToString();
                this.txtDefaultQuizPassMark.Text             = dtLoadOrg.Rows[0]["DefaultQuizPassMark"].ToString();
                this.chkEbookNotification.Checked            = Boolean.Parse(dtLoadOrg.Rows[0]["DefaultEbookEmailNotification"].ToString());
                if (dtLoadOrg.Rows[0]["CPDReportName"].ToString().Equals(String.Empty))
                {
                    this.txtCPDReportName.Text = "Continuing Professional Development";
                }
                else
                {
                    this.txtCPDReportName.Text = dtLoadOrg.Rows[0]["CPDReportName"].ToString();
                }
                this.ckbIncludeLogo.Checked      = dtLoadOrg.Rows[0]["IncludeCertificateLogo"].ToString().Trim() == ""?false:Boolean.Parse(dtLoadOrg.Rows[0]["IncludeCertificateLogo"].ToString());
                this.chkActivatePassword.Checked = Boolean.Parse(dtLoadOrg.Rows[0]["PasswordLockout"].ToString());

                // Setup date dropdowns with value
                if (dtLoadOrg.Rows[0]["DefaultLessonCompletionDate"] != System.DBNull.Value)
                {
                    DateTime defaultLessonCompletionDate = (DateTime)dtLoadOrg.Rows[0]["DefaultLessonCompletionDate"];
                    cboLCompletionDay.SelectedValue   = defaultLessonCompletionDate.Day.ToString();
                    cboLCompletionMonth.SelectedValue = defaultLessonCompletionDate.Month.ToString();
                    cboLCompletionYear.SelectedValue  = defaultLessonCompletionDate.Year.ToString();
                }

                if (dtLoadOrg.Rows[0]["DefaultQuizCompletionDate"] != System.DBNull.Value)
                {
                    DateTime defaultQuizCompletionDate = (DateTime)dtLoadOrg.Rows[0]["DefaultQuizCompletionDate"];
                    cboQCompletionDay.SelectedValue   = defaultQuizCompletionDate.Day.ToString();
                    cboQCompletionMonth.SelectedValue = defaultQuizCompletionDate.Month.ToString();
                    cboQCompletionYear.SelectedValue  = defaultQuizCompletionDate.Year.ToString();
                }



                if (UserContext.UserData.UserType == UserType.SaltAdmin)
                {
                    this.chkAdvancedReporting.Checked = (bool)dtLoadOrg.Rows[0]["AdvancedReporting"];
                }
                else
                {
                    this.lblAdvancedReporting.Text = (bool)dtLoadOrg.Rows[0]["AdvancedReporting"]?ResourceManager.GetString("Yes"):ResourceManager.GetString("No");
                }

                DateTime dtOriginalDateUpdated = (DateTime)dtLoadOrg.Rows[0]["DateUpdated"];
                this.OriginalDateUpdated = DatabaseTool.ToLongDateTimeString(dtOriginalDateUpdated);

                Classification objClassification     = new Classification();
                DataTable      dtbClassificationType = objClassification.GetClassificationType(UserContext.UserData.OrgID);

                if (dtbClassificationType.Rows.Count > 0)
                {
                    this.ClassificationTypeID = Int32.Parse(dtbClassificationType.Rows[0]["ClassificationTypeID"].ToString());
                    //this.lblCustomClasification.Text = dtbClassificationType.Rows[0]["Name"].ToString();
                    this.txtClassificationName.Text = dtbClassificationType.Rows[0]["Name"].ToString();
                }
            }
            else
            {
                this.lblMessage.Text                = ResourceManager.GetString("lblMessage.NoOrg");//"No Organisations Exist.";
                this.lblMessage.CssClass            = "FeedbackMessage";
                this.plhOrganisationDetails.Visible = false;
            }

            // hide the ebook checkbox if the organisation does not have ebook feature
            bool hasEbookAccess = objOrganisation.GetOrganisationEbookAccess(UserContext.UserData.OrgID);

            if (!hasEbookAccess)
            {
                this.plhEbookNotification.Visible = false;
            }
            else
            {
                this.plhEbookNotification.Visible = true;
            }



            if (!IsPostBack)
            {
                LoadTimeZone();
                int OrgTZId = 0;
                Int32.TryParse(dtLoadOrg.Rows[0]["TimeZoneID"].ToString(), out OrgTZId);
                string orgFLBName = null;

                using (StoredProcedure sp = new StoredProcedure("prcTimeZone_GetFLBNamefromTZID",
                                                                StoredProcedure.CreateInputParam("@TimezoneID", SqlDbType.Int, OrgTZId))
                       )
                {
                    orgFLBName = sp.ExecuteScalar().ToString();
                }
                listTimeZone.SelectedValue = listTimeZone.Items.FindByText(orgFLBName).Value;
            }
        }         // LoadData
Exemplo n.º 9
0
        }         // lnkModifyClassificationOptions_Click

        #endregion

        #region Private Methods
        /// <summary>
        /// Sets the state of the page.
        /// </summary>
        private void SetPageState()
        {
            // Disable to organisation logo vaildator if label is set
            if (this.lblLogo.Text.Length == 0)
            {
                this.validatorOrganisationLogo.Enabled = true;
            }
            else
            {
                this.validatorOrganisationLogo.Enabled = false;
            }

            // Hide the link to modify custom classification options if no type ID set
            if (this.ClassificationTypeID == 0)
            {
                this.lnkModifyClassificationOptions.Visible = false;
            }
            else
            {
                this.lnkModifyClassificationOptions.Visible = true;
            }

            if (UserContext.UserData.UserType == UserType.SaltAdmin)
            {
                this.chkAdvancedReporting.Visible = true;
                this.lblAdvancedReporting.Visible = false;
            }
            else
            {
                this.chkAdvancedReporting.Visible = false;
                this.lblAdvancedReporting.Visible = true;
            }

            //Only perform this check for OrganisationCPDAccess and OrganisationPolicyAccess if existing Org
            //Fix for Issue ID BD100
            if (this.PageAction != "add")
            {
                Bdw.Application.Salt.BusinessServices.Organisation objOrganisation = new Bdw.Application.Salt.BusinessServices.Organisation();
                if (objOrganisation.GetOrganisationCPDAccess(UserContext.UserData.OrgID))
                {
                    this.lblCPDReportName.Visible = true;
                    this.txtCPDReportName.Visible = true;
                }

                if (objOrganisation.GetOrganisationPolicyAccess(UserContext.UserData.OrgID))
                {
                    this.lblDiskSpace.Visible = true;
                    if (UserContext.UserData.UserType == UserType.SaltAdmin)
                    {
                        this.txtDiskSpace.Visible        = true;
                        this.lblDiskSpaceDisplay.Visible = false;
                    }
                    else
                    {
                        this.lblDiskSpaceDisplay.Visible = true;
                        this.txtDiskSpace.Visible        = false;
                    }
                    this.litMegabytes.Visible = true;
                    this.divDiskSpace.Visible = true;
                }
            }


            this.lblIncludeLogo.Text = ResourceManager.GetString("lblIncludeLogo");
            this.lblInclLogoMsg.Text = ResourceManager.GetString("lblInclLogoMsg");
        }         // SetPageState