/// <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);
            }
        }
Beispiel #2
0
        }         // grdPagination_UpdateCommand

        /// <summary>
        /// Even Handler for when the data is bound to the DataGrid.
        /// This adds the DateUpdated for every record to the commandargument parameter attribute.
        /// </summary>
        /// <param name="source"> The source of the event.</param>
        /// <param name="e"> Any arguments that the event fires.</param>
        /// <remarks>
        /// This event is fired for every record that is bound to the grid.
        /// It ignores the header row.
        /// </remarks>
        private void grdPagination_ItemDataBound(object source, System.Web.UI.WebControls.DataGridItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem || e.Item.ItemType == ListItemType.SelectedItem || e.Item.ItemType == ListItemType.EditItem)
            {
                DataRowView drvAdminDetails = (DataRowView)e.Item.DataItem;

                string   FirstName             = (string)drvAdminDetails["FirstName"];
                string   LastName              = (string)drvAdminDetails["LastName"];
                DateTime dtOriginalUpdatedDate = (DateTime)drvAdminDetails["DateUpdated"];

                //1. Make a reference to the add button.
                LinkButton lnkAddButton;
                lnkAddButton = (LinkButton)e.Item.Cells[3].Controls[0];

                //2. The original date updated from the database to the command argument for each record in the grid..
                if (lnkAddButton != null)
                {
                    lnkAddButton.CommandArgument = DatabaseTool.ToLongDateTimeString(dtOriginalUpdatedDate);
                    lnkAddButton.Text            = ResourceManager.GetString("grid_AddButton");
                }
            }
        }         // grdPagination_ItemDataBound
Beispiel #3
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