protected void Page_Load(object sender, EventArgs e) { SetDevHeaderMenuStyle(); string page = Path.GetFileName(Request.Path); if (!IsPostBack) { if (Session["login"] != null) { Utilities.GetSetLoggedOnUser = Session["login"].ToString(); } lblLoggedOnUser.Text = "Welcome " + Utilities.GetEmployeeDisplayName(Utilities.GetLoggedOnUser()) + "!"; menu.Visible = IsDisplayHideNavigation; divMenuPlaceHolder.Visible = !IsDisplayHideNavigation; bool Is_Security_Admin = AppSecurity.Is_User_Security_Admin(); lnkBtnChangeLogin.Visible = !Utilities.IsEnvironmentProductionMode() && Is_Security_Admin; //Apply security to navigation. AppSecurity.Apply_CAIRS_Security_To_UserControls(menu.Controls); } }
public void LoadDDLSite(bool isApplySiteSecurity, bool isApplySiteSecurityToReadOnly, bool isDisplayActiveOnly, bool isDisplayPleaseSelectOption, bool isDisplayAllOption, bool isSelectUserPreferenceSite, bool isDisplaySetDefaultLink) { //This is to handle the case where security only applies to read only roles. IE the Asset Search page. if (isApplySiteSecurity && isApplySiteSecurityToReadOnly) { //Apply security if the current role is read only isApplySiteSecurity = AppSecurity.Current_User_Access_Level().Equals(AppSecurity.ROLE_READ_ONLY); } //If Role is district staff or director, they have access to all sites regardless of accessible site(s) if (AppSecurity.Current_User_Access_Level().Equals(AppSecurity.ROLE_DISTRICT_TECH) || AppSecurity.Current_User_Access_Level().Equals(AppSecurity.ROLE_DIRECTOR)) { isApplySiteSecurity = false; } DataSet ds = DatabaseUtilities.DsGetCTSiteInfo(isDisplayActiveOnly, isApplySiteSecurity); int iRecordCount = ds.Tables[0].Rows.Count; if (iRecordCount > 0) { ddlSite.DataSource = ds; ddlSite.DataTextField = Constants.COLUMN_CT_SITE_Name; ddlSite.DataValueField = Constants.COLUMN_CT_SITE_ID;; ddlSite.DataBind(); } //Only display select option if return more than one record and isDisplayPleaseSelectOption = true if (iRecordCount > 1 && isDisplayAllOption) { ddlSite.Items.Insert(0, new ListItem(Constants._OPTION_ALL_TEXT + "Sites ---", Constants._OPTION_ALL_VALUE)); } //Only display select option if return more than one record and isDisplayPleaseSelectOption = true if (iRecordCount > 1 && isDisplayPleaseSelectOption) { ddlSite.Items.Insert(0, new ListItem(Constants._OPTION_PLEASE_SELECT_TEXT + "Site ---", Constants._OPTION_PLEASE_SELECT_VALUE)); } if (isSelectUserPreferenceSite) { string empid = Utilities.GetEmployeeIdByLoggedOn(Utilities.GetLoggedOnUser()); DataSet dsDefaultSite = DatabaseUtilities.DsGetUserPreference(empid, Constants.APP_PREFERENCE_TYPE_Default_Site); if (dsDefaultSite.Tables[0].Rows.Count > 0) { string preferenceValue = dsDefaultSite.Tables[0].Rows[0]["Preference_Value"].ToString(); if (!Utilities.isNull(preferenceValue)) { ListItem i = ddlSite.Items.FindByValue(preferenceValue); if (ddlSite.Items.Contains(i)) { ddlSite.SelectedValue = preferenceValue; } } } } }