protected void Page_Load(object sender, EventArgs e)
		{
			districtParm =  DistrictParms.LoadDistrictParms();
            treeProvider = KenticoHelper.GetUserTreeProvider(SessionObject.LoggedInUser.ToString());
			Master.Search += SearchHandler;

			base.Page_Init(sender, e);

			if (!IsPostBack)
			{ InitializeCriteriaControls(); }

			btnAdd.Visible = UserHasPermission(Thinkgate.Base.Enums.Permission.Add_Reference);
            string cmsTreePathToReferences = ConfigurationManager.AppSettings["CMSTreePathToReferences"];
            if (districtParm.isStateSystem)
                stateInitial.Value = districtParm.State.ToString();
            if (!string.IsNullOrWhiteSpace(cmsTreePathToReferences))
            {
                TreeNode tNode = treeProvider.SelectSingleNode(CMSContext.CurrentSiteName, cmsTreePathToReferences.Substring(0, cmsTreePathToReferences.Length - 2), CMSContext.PreferredCultureCode);

                if (tNode != null)
                {
                    int messageCenterClassId = CMS.SettingsProvider.DataClassInfoProvider.GetDataClass("Thinkgate.ReferenceCenter").ClassID;
                    classId.Value = messageCenterClassId.ToString();
                    parentNodeId.Value = tNode.NodeID.ToString();
                    clientName.Value = districtParm.ClientID.ToString();
                }
            }
		}
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["SessionObject"] == null || User == null)
            {
                Services.Service2.KillSession();
            }
            _sessionObj = (SessionObject)Session["SessionObject"];
            _dParms = DistrictParms.LoadDistrictParms();
            if (_sessionObj.LoggedInUser.IsSuperAdmin || _dParms.PasswordConfigurationRequired == "No")
                h1MinimumPassword.Visible = false;
            else if (_dParms.PasswordConfigurationRequired == "Yes")
                displayMsgChild.InnerHtml = MinimumPasswordRequirementHelper.GetMinumumPasswordRequirementMsg();

            _userName = _sessionObj.LoggedInUser.UserName;

        }
        protected void Page_Load(object sender, EventArgs e)
        {
            _districtParms = DistrictParms.LoadDistrictParms();
            _improvementPlanService = new ImprovementPlanProxy();
            String postBackControlID = GetControlThatCausedPostBack(Parent.Page);
            bool isPostBack = !String.IsNullOrEmpty(postBackControlID) && !postBackControlID.StartsWith("folder") && !postBackControlID.StartsWith("tileContainer");
            
            SetFilterVisibility();
            DisableBtnAdd();

            if (!isPostBack)
            {
                LoadDropDownYear();
                LoadDropDownSchool();
               
            }

            LoadImprovementPlanList();
        }
        /// <summary>
        /// Event fires when the page loads.  It extracts the AssessmentID and ClassID from the 
        /// QueryString, then calls methods that Load the necessary DataTables, and Initialize the UI.
        /// </summary>
        /// <param name="sender">Object that fired this event</param>
        /// <param name="e">EventArgs passed to the eventhandler</param>
        protected void Page_Load(object sender, EventArgs e)
        {
           
            _userID = SessionObject.LoggedInUser.Page;
            // converting value in mili secsecond.
             DParmsNew = DistrictParms.LoadDistrictParms();
           
            if (AreRequiredIDsContainedInQueryString())
            {
                AssessmentID = ExtractAssessmentID();
                ClassID = ExtractClassID();
                IsGroup = ExtractGroupStatus();
            }
            else
            {
                RedirectToPortalSelectionScreenWithCustomMessage("The class ID and/or assessment ID was not provided in URL.");
            }
            if (!IsPostBack)
            {
                // get role name from the session object
                LoggedOnUserRoleName = SessionObject.LoggedInUser.Roles[0].RoleName;
                SchoolId = SessionObject.LoggedInUser.School;
                BuildAssessment();
                ValidateCurriculumRestriction();
                InitializeUI(_dtAssessmentInfo.Rows[0]);
                // save configuration data for testeventid if data exist in configuration table.
                if (IsGroup)
                {
                    AddAssessmentAdministrationTimedInfo(AssessmentID, null, ClassID, CteID.ToString());
                }
                else
                {
                    AddAssessmentAdministrationTimedInfo(AssessmentID, ClassID, null, CteID.ToString());
                }

            }
            SetHiddenFields(GetAssessmentAdministrationTimedInfo(AssessmentID, CteID.ToString()));
            if (!IsPostBack)
            {
                
                hideUnhideColumn();
                grdAssessmentAdmin.DataSource = _dtAssessmentResults;
                grdAssessmentAdmin.DataBind();
                GenerateAdministrationInstructionsPoup();                
            }

            hdnAssessmentId.Value = AssessmentID.ToString();
            hdnClassId.Value = ClassID.ToString();
            hdnTestId.Value = CteID.ToString();
            //Fixed TFS bug#27033
            //Timer1.Interval = Convert.ToInt32(DParmsNew.AdministratorRefreshScreenInterval) * (60000);

            if (hiddenTimeAssessment.Value.ToLower() == "true")
            {
                Timer1.Interval = Convert.ToInt32(DParmsNew.AdministratorRefreshScreenInterval) * (60000);

            }
            else
            {
                Timer1.Enabled = false;
            }
            
        }
		/// <summary>
		///  GetKenticoCurricumumUnitTypeName
		/// </summary>
		/// <param name="districtParms"></param>
		/// <returns>string</returns>
		protected string GetKenticoCurricumumUnitTypeName(DistrictParms districtParms)
		{
			if (districtParms.ClientState != null && !string.IsNullOrWhiteSpace(districtParms.ClientState))
			{
				var clientName = districtParms.ClientState;

				switch (clientName.ToUpper())
				{
					//  case "OH":
					//    return  CUClassNameOH ;
					default:
						return CuClassName;
				}
			}
			return CuClassName;
		}
		/// <summary>
		/// Get all plans from kentico based on search criteria
		/// </summary>
		/// <param name="ui"></param>
		/// <param name="treeProvider"></param>
		/// <param name="whereClauseIp"></param>
		/// <param name="whereClauseUp"></param>
		/// <param name="whereClauseLp"></param>
		/// <param name="whereClauseMu"></param>
		/// <param name="whereTextSearch"></param>
		/// <param name="lookupDataSet"></param>
		/// <param name="districtParms"></param>
		/// <param name="resUnitType"></param>
		/// <returns>List</returns>
        private List<Resource> GetPlans(UserInfo ui, TreeProvider treeProvider, string whereClauseIp,
            string whereClauseUp,
			string whereClauseLp, string whereClauseMu, string whereTextSearch, DataSet lookupDataSet,
			DistrictParms districtParms, ResourceTypes resUnitType)
		{

			List<Resource> buildList = new List<Resource>();
			buildList.AddRange(GetDocumentResource(ui, IpClassName, treeProvider, whereClauseIp, string.Empty,
				whereTextSearch, lookupDataSet, resUnitType));
			buildList.AddRange(GetDocumentResource(ui, UpClassName, treeProvider, whereClauseUp, string.Empty,
				whereTextSearch, lookupDataSet, resUnitType));
			buildList.AddRange(GetDocumentResource(ui, LpClassName, treeProvider, whereClauseLp, string.Empty,
				whereTextSearch, lookupDataSet, resUnitType));
			if (districtParms.State.ToUpper() == "OH")
				buildList.AddRange(GetDocumentResource(ui, GetKenticoCurricumumUnitTypeName(districtParms),
					treeProvider, whereClauseMu, string.Empty, whereTextSearch, lookupDataSet, resUnitType));
			return buildList;
		}
        protected void Page_Load(object sender, EventArgs e)
        {
			//TODO: determine correct Permission
			//_Perm_Resource_Link_Ok = UserHasPermission(Permission.Hyperlink_Resource_Name);

			UserRole = Encryption.DecryptString(Request.QueryString["xID"].ToString());
			AssessmentCategory = Encryption.DecryptString(Request.QueryString["yID"].ToString());
			AssessmentID = (Request.QueryString["zID"] == null) ? "": Encryption.DecryptString(Request.QueryString["zID"].ToString());

			/************************************************************************************************
             * Security - Verify querystring parameters and user's roles are sufficient.
             ************************************************************************************************/

			Validate_Request();

			/************************************************************************************************
			 ************************************************************************************************
			 *							Initial Page Load.
			 ************************************************************************************************
			 ************************************************************************************************/
			var serializer = new JavaScriptSerializer();

			/************************************************************************************************
			 * Populate Class Properties and viewstate.
			 ************************************************************************************************/

			ImageWebFolder = (Request.ApplicationPath.Equals("/") ? string.Empty : Request.ApplicationPath) + "/Images/";

			districtParms = DistrictParms.LoadDistrictParms();

			//In this version of the app, are admins allowed to manage scheduling at the class level?
			AllowClassLevelSchedules = (districtParms.AssessmentSchedulerScheduleLevel == AssessmentScheduleLevels.Class.ToString());

			//In this version of the app, are admins allowed to set up scheduling for classroom assessments?
			AllowClassroomAssessmentScheduling = (districtParms.AssessmentSchedulerClassroomAssessments);

			//In this version of the app, are admins allowed to set up scheduling for proofed assessments, unproofed or both?
			IncludeUnproofedAssessments = (UserRole == "State") ?
												 districtParms.AssessmentSchedulerProofedOptionState :
												 districtParms.AssessmentSchedulerProofedOption; //Originally for Gwinnett

			//Load objects from viewstate if they are present, otherwise, pull from database.
			if (ViewState["ScheduleTypesList"] != null)
			{
				ScheduleTypesList = (List<Scheduling.ScheduleType>)ViewState["ScheduleTypesList"];
				ScheduleLevelsList = (List<Scheduling.ScheduleLevel>)ViewState["ScheduleLevelsList"]; ;
			}
			else
			{
				drGeneric_String_String AssessScheduleKeys = new drGeneric_String_String();
				var schedInstances = new List<Scheduling.Schedule>();
				var schedTypes = new List<Scheduling.ScheduleType>();
				var schedLevels = new List<Scheduling.ScheduleLevel>();

				Scheduling.GetScheduling(SessionObject.GlobalInputs,
										 ScheduleDocTypes.Assessment,
										 AssessmentScheduleLevels.District,
										 AssessScheduleKeys,
										 ref schedInstances,
										 ref schedTypes,
										 ref schedLevels);

				ScheduleTypesList = schedTypes;
				//Stash data from ScheduleTypesList in viewstate because we don't want to query for them again.
				ViewState["ScheduleTypesList"] = ScheduleTypesList;

				ScheduleLevelsList = schedLevels;

				//Stash key data from ScheduleLevelsList in viewstate because we don't want to query for them again.
				ViewState["ScheduleLevelsList"] = ScheduleLevelsList;
	
			}

			if (ViewState["SchedLevelForSave"] != null) SchedLevelForSave = (AssessmentScheduleLevels)ViewState["SchedLevelForSave"];

			if (!IsPostBack)
			{
				/************************************************************************************************
				 * Set up certain criteria controls with their selection values using Json arrays as datasources.
				 ************************************************************************************************/

				LoadCriteriaControls();

				/************************************************************************************************
				 * Reach up to the master page's RadAjaxPanel, and attach to it a javascript script to be 
				 * executed whenever the RadAjaxPanel's ajax call is executed.
				 ************************************************************************************************/
				RadAjaxPanel radAjaxPanel = (RadAjaxPanel)this.Master.FindControl("AjaxPanelResults");
				radAjaxPanel.ResponseScripts.Add("updateSelectedRowCount(0);");

				/************************************************************************************************
				 * If a AssessmentCategory was passed in, then set the Category combo box in the ScheduleCriteria control
				 * to this value and make it read only.
				 ************************************************************************************************/
				if (!string.IsNullOrEmpty(AssessmentCategory))
				{
					ctrlScheduleCriteria.DefaultCategory = AssessmentCategory;
					ctrlScheduleCriteria.CategoryReadOnly = true;
			}

			}

			if (radGridResults.DataSource == null)
            {
                radGridResults.Visible = false;
            }

            if (IsPostBack)
            {
				radGridResults.Visible = true;
			}

		}
        protected void Page_Load(object sender, EventArgs e)
        {
            DParmsNew = DistrictParms.LoadDistrictParms();
            if (!IsPostBack)
            {                
                SetAssessmentType();
                LoadTimedAssessmentData();
                switch (Request.QueryString["headerImg"])
                {
                    case "lightningbolt":
                        headerImg.Src = "../../Images/lightningbolt.png";
                        headerImg.Attributes["headerImgName"] = "lightningbolt";
                        break;
                    case "magicwand":
                        headerImg.Src = "../../Images/magicwand.png";
                        headerImg.Attributes["headerImgName"] = "magicwand";
                        break;
                    default:
                        headerImg.Visible = false;
                        break;
                }

                assessmentTitle.InnerHtml = "Term " + term.ToString() + " " + type + " - " + grade + " Grade " + subject +
                                            " " + (courseName == string.Empty ? string.Empty : courseName) + " - " + description;

                if (_assessment == null)
                {
                    //Code for Wizard goes here
                }
                else
                {
                    generateButton.Text = "  Update  ";
                    backButton.Visible = false;
                    cancelButton.OnClientClick = "cancelButtonClick(); return false;";

                    //Content Type radio check
                    switch (_assessmentInfo.ContentType)
                    {
                        case "External":
                            externalRadio.Checked = true;
                            includeFieldTestCell.Attributes["style"] = "display:none;";
                            onlineContentFormatCell.Attributes["style"] = string.Empty;
                            itemBankCell.Attributes["style"] = "display:none;";
                            break;
                        default:
                            itemBankRadio.Checked = true;
                            includeFieldTestCell.Attributes["style"] = string.Empty;
                            onlineContentFormatCell.Attributes["style"] = "display:none";
                            itemBankCell.Attributes["style"] = string.Empty;
                            break;
                    }

                    //Include Field Test radio check
                    if (_assessmentInfo.AllowFieldTest && _assessmentInfo.Category != "Classroom")
                    {
                        switch (_assessmentInfo.IncludeFieldTest)
                        {
                            case true:
                                includeFieldTestYes.Checked = true;
                                includeFieldTestNo.Disabled = true;
                                break;
                            default:
                                includeFieldTestNo.Checked = true;
                                break;
                        }
                    }
                    else
                    {
                        includeFieldTestNo.Checked = true;
                        includeFieldTestNo.Disabled = true;
                        includeFieldTestYes.Disabled = true;
                    }

                    //Online Content Format radio check
                    switch (_assessmentInfo.OnlineContentFormat)
                    {
                        case "Test and Response Card":
                            onlineContentFormatBoth.Checked = true;
                            break;
                        default:
                            onlineContentFormatResponseOnly.Checked = true;
                            break;
                    }

                    LoadNumberOfFormsDropdown();
                    LoadDistractorLabels();
                    if (!String.IsNullOrEmpty(_assessmentInfo.Keywords)) keywords.Text = _assessmentInfo.Keywords;
                    LoadPerformanceLevels();
                    LoadItemBanks();
                    sourceInput.Value = _assessmentInfo.Source;
                    creditInput.Value = _assessmentInfo.Credit;
                    schoolDistrictName.InnerHtml = _assessmentInfo.Client;
                    authorName.InnerHtml = _assessmentInfo.Author;
                    assessmentItemCount.Value = _assessment.Items.Count.ToString();
                    hiddenUserID.Value = currUserID.ToString();
                    assessmentID.Value = _assessmentID.ToString();
                    encryptedAssessmentID.Value = Request.QueryString["xID"];
                    encryptedTeacherID.Value = Request.QueryString["yID"];

                    //Short Answer Section on Bubble Sheet radio check
                    switch (_assessmentInfo.DisplayShortAnswer)
                    {
                        case "Yes":
                            shortAnswerBubbleSheetYes.Checked = true;
                            break;
                        default:
                            shortAnswerBubbleSheetNo.Checked = true;
                            break;
                    }

                    //Number of Columns radio check
                    switch (_assessmentInfo.PrintColumns)
                    {
                        case 2:
                            numberOfColumns2.Checked = true;
                            break;
                        default:
                            numberOfColumns1.Checked = true;
                            break;
                    }

                    //Include Cover Page radio check
                    switch (_assessmentInfo.IncludeCoverPage)
                    {
                        case "Yes":
                            includeCoverPageYes.Checked = true;
                            break;
                        default:
                            includeCoverPageNo.Checked = true;
                            break;
                    }

                    if (_assessment.IsProofed)
                    {
                        itemBankRadio.Disabled = true;
                        externalRadio.Disabled = true;
                        includeFieldTestYes.Disabled = true;
                        includeFieldTestNo.Disabled = true;
                        onlineContentFormatBoth.Disabled = true;
                        onlineContentFormatResponseOnly.Disabled = true;
                        numberOfForms.Enabled = false;
                        distractorLabels.Enabled = false;
                        keywords.Enabled = false;
                        scoreType.Enabled = false;
                        performanceLevelSet.Enabled = false;
                        assessmentIdentificationButton.Disabled = true;
                        assessmentIdentificationButton.Style.Add("Color", "lightgray");
                        assessmentIdentificationButton.Attributes["onclick"] = "return false;";
                        sourceInput.Disabled = true;
                        creditInput.Disabled = true;
                        shortAnswerBubbleSheetYes.Disabled = true;
                        shortAnswerBubbleSheetNo.Disabled = true;
                        includeCoverPageYes.Disabled = true;
                        includeCoverPageNo.Disabled = true;
                        rcbAllowedOTCNavigation.Enabled = false;
                    }
                }

                if (!SessionObject.LoggedInUser.HasPermission(Base.Enums.Permission.Access_CoverPage_AssessmentConfiguration))
                {
                    coverPageGroup.Attributes["style"] = "display:none;";
                }


            }

            if (!SessionObject.LoggedInUser.HasPermission(Base.Enums.Permission.Access_AssessmentToolConfiguration))
            {
                RadTab onlineToolsTab = RadTabStrip1.FindTabByText("Online Tools");
                onlineToolsTab.Visible = false;
            }

            switch (Request.Form["__EVENTTARGET"])
            {
                case "RadButtonOk":
                    UpdateTestToolClick(this, new EventArgs());
                    break;

            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Tile == null) return;

            String controlId = GetControlThatCausedPostBack(Parent.Page);
            // Simulate IsPostBack.
            _isPostBack = (controlId != null);

            // Initial load.
            dParms = DistrictParms.LoadDistrictParms();
            _selectedAssessment = Base.Classes.Assessment.GetAssessmentAndQuestionsByID(_assessmentId);
            BuildUi();
            hiddenAssessmentID.Value = _assessmentId.ToString();
            hiddenUploadPath.Value = AppSettings.UploadFolderPhysicalPath + "\\";
           
            // Path to upload directory.
            _uploadPath = AppSettings.UploadFolderPhysicalPath + "\\";

            foreach (RepeaterItem ritem in rptAssessment.Items)
            {
                //PBI: 2937
                if (UserHasPermission(Permission.Icon_Delete_Document))
                    ((RadButton)ritem.FindControl("btnDeleteAssessment")).Click += new EventHandler(btnDeleteAssessment_Click);
                else
                {
                    ((RadButton)ritem.FindControl("btnDeleteAssessment")).Visible = false;
                }

                if(!UserHasPermission(Permission.Icon_Upload_Document))
                {
                     ((RadButton)ritem.FindControl("btnUploadAssessment")).Visible = false;
                }
            }

            foreach (RepeaterItem ritem in rptAnswerKey.Items)
            {
                // PBI: 2937
                if (!UserHasPermission(Permission.Icon_Delete_Document))
                {
                    ((RadButton)ritem.FindControl("btnDeleteAnswerKey")).Visible = false;
                }
                else
                    ((RadButton)ritem.FindControl("btnDeleteAnswerKey")).Click += new EventHandler(btnDeleteAnswerKey_Click);

                if (!UserHasPermission(Permission.Icon_Upload_Document))
                {
                    ((RadButton)ritem.FindControl("btnUploadAnswerKey")).Visible = false;
                }
            }

            foreach (RepeaterItem ritem in rptReview.Items)
            {
                 // PBI: 2937
                if (!UserHasPermission(Permission.Icon_Delete_Document))
                {
                    ((RadButton)ritem.FindControl("btnDeleteReview")).Visible = false;
                }
                
                else
                    ((RadButton)ritem.FindControl("btnDeleteReview")).Click += new EventHandler(btnDeleteReview_Click);

                if (!UserHasPermission(Permission.Icon_Upload_Document))
                {
                    ((RadButton)ritem.FindControl("btnUploadReview")).Visible = false;
                }
            }
        }
 private void addImpersonationMenuItem(DistrictParms distParms, SessionObject sessionObject, RadMenuItem miAccountMenuItem)
 {
     if (distParms.ImpersonateUserAccess && sessionObject.LoggedInUser.HasPermission(Permission.Access_ImpersonateUserAccess))
     {
         miAccountMenuItem = new RadMenuItem("Impersonate User");
         miAccountMenuItem.Attributes.Add("action", "window");
         miAccountMenuItem.Attributes.Add("actionUrl", ResolveUrl("~/Account/UserImpersonation.aspx"));
         ctxAccountMenu.Items.Add(miAccountMenuItem);
     }
 }