protected void LoadInformation() { // set up for adding the header info List <PRIVGROUP> pl = SQMModelMgr.SelectPrivGroupList(new SysPriv[1] { SysPriv.originate }, SysScope.audit, ""); // SQMModelMgr.SelectPrivGroupJobcodeList(SysPriv.originate, SysScope.audit); DropDownListItem item = new DropDownListItem(); UpdateAuditTypes(); if (rddlAuditJobcodes.Items.Count == 0) { rddlAuditJobcodes.DataSource = pl; rddlAuditJobcodes.DataTextField = "DESCRIPTION"; rddlAuditJobcodes.DataValueField = "PRIV_GROUP"; rddlAuditJobcodes.DataBind(); item = new DropDownListItem("[Select a Group]", ""); rddlAuditJobcodes.Items.Insert(0, item); } if (rddlDayOfWeek.Items.Count == 0) { rddlDayOfWeek.Items.Clear(); rddlDayOfWeek.DataSource = EHS_Audit_Scheduler.GetAll <DayOfWeek>(); rddlDayOfWeek.DataTextField = "Value"; rddlDayOfWeek.DataValueField = "Key"; rddlDayOfWeek.DataBind(); item = new DropDownListItem("[Select a Day]", ""); rddlDayOfWeek.Items.Insert(0, item); } if (IsEditContext || CurrentStep > 0) { // in edit mode, load the header field values and make all fields display only AUDIT_SCHEDULER scheduler = EHSAuditMgr.SelectAuditSchedulerById(entities, EditAuditScheduleId); BusinessLocation location = new BusinessLocation().Initialize((decimal)scheduler.PLANT_ID); rddlAuditType.SelectedValue = scheduler.AUDIT_TYPE_ID.ToString(); rddlAuditType.Enabled = false; rddlAuditType.Visible = false; lblScheduleAuditType.Visible = true; lblScheduleAuditType.Text = rddlAuditType.SelectedText.ToString(); hdnAuditLocation.Value = location.Plant.PLANT_ID.ToString(); lblAuditLocation.Text = location.Plant.PLANT_NAME + " " + location.BusinessOrg.ORG_NAME; lblAuditLocation.Visible = true; ddlAuditLocation.Visible = false; mnuAuditLocation.Visible = false; rddlDayOfWeek.SelectedValue = scheduler.DAY_OF_WEEK.ToString(); cbInactive.Checked = scheduler.INACTIVE; // build the audit jobcode list PRIVGROUP pv = pl.Where(i => i.PRIV_GROUP.ToString() == scheduler.JOBCODE_CD).FirstOrDefault(); lblAuditJobcode.Text = pv.DESCRIPTION; lblAuditJobcode.Visible = true; rddlAuditJobcodes.SelectedValue = scheduler.JOBCODE_CD.ToString(); rddlAuditJobcodes.Visible = false; } else { if (UserContext.GetMaxScopePrivilege(SysScope.audit) <= SysPriv.config) { List <BusinessLocation> locationList = SessionManager.PlantList; locationList = UserContext.FilterPlantAccessList(locationList); if (locationList.Select(l => l.Plant.BUS_ORG_ID).Distinct().Count() > 1 && SessionManager.IsUserAgentType("ipad,iphone") == false) { if (mnuAuditLocation.Items.Count == 0) { mnuAuditLocation.Items.Clear(); ddlAuditLocation.Visible = false; mnuAuditLocation.Visible = true; mnuAuditLocation.Enabled = true; SQMBasePage.SetLocationList(mnuAuditLocation, locationList, 0, "Select a Location", "", true); } } else { if (ddlAuditLocation.Items.Count == 0) { ddlAuditLocation.Items.Clear(); ddlAuditLocation.Visible = true; ddlAuditLocation.Enabled = true; mnuAuditLocation.Visible = false; SQMBasePage.SetLocationList(ddlAuditLocation, locationList, 0, true); ddlAuditLocation.Items[0].ImageUrl = "~/images/defaulticon/16x16/user-alt-2.png"; } } } // set defaults for add mode rddlAuditType.Enabled = true; rddlAuditType.Visible = true; lblAuditLocation.Visible = false; rddlAuditJobcodes.Enabled = true; rddlAuditJobcodes.Visible = true; lblAuditJobcode.Visible = false; lblScheduleAuditType.Visible = false; } }