}         // lnkReturnToOrgAdmin_Click

        #endregion

        #region Private Methods
        /// <summary>
        /// Sets the State of the page.
        /// </summary>
        private void SetPageState()
        {
            // Set the page title to include the custom classification name
            Classification objClassification     = new Classification();
            DataTable      dtbClassificationType = objClassification.GetClassificationType(UserContext.UserData.OrgID);

            this.lblPageTitle.Text = String.Format(ResourceManager.GetString("lblPageTitle.Modify"), dtbClassificationType.Rows[0]["Name"].ToString());//"Modify '" + dtbClassificationType.Rows[0]["Name"].ToString() + "' Grouping Options";

            this.BindGrid();
        }         // SetPageState
Exemplo n.º 2
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