private void SetupPage()
        {
            if (ddlIncidentSeverity2.Items.Count == 0)
            {
                ddlIncidentSeverity2.Items.AddRange(WebSiteCommon.PopulateRadListItems("incidentSeverity"));
                ddlIncidentSeverity2.Items.Insert(0, new RadComboBoxItem("", ""));
                ddlIncidentSeverity2.SelectedIndex = 0;

                ddlDisposition.Items.AddRange(WebSiteCommon.PopulateRadListItems("NCDisposition"));
                ddlDisposition.Items.Insert(0, new RadComboBoxItem("", ""));
                ddlDisposition.SelectedIndex = 0;

                ddlStatus.Items.AddRange(WebSiteCommon.PopulateRadListItems("recordStatus"));

                SQMBasePage.FillCurrencyDDL(ddlCurrency, "EUR", false);
                ddlCurrency.Items.Insert(0, new RadComboBoxItem("", ""));

                List <PART_ATTRIBUTE> attributeList = SQMModelMgr.SelectPartAttributeList("TYPE", "", false);
                ddlPartType.Items.Add(new RadComboBoxItem("", ""));
                foreach (PART_ATTRIBUTE pat in attributeList)
                {
                    ddlPartType.Items.Add(new RadComboBoxItem(pat.ATTRIBUTE_VALUE, pat.ATTRIBUTE_CD));
                }
            }

            radIssueDate.Culture          = System.Threading.Thread.CurrentThread.CurrentUICulture;
            radIssueDate.MinDate          = new DateTime(2001, 1, 1);
            radIssueDate.MaxDate          = DateTime.UtcNow.AddDays(7);
            radIssueDate.SelectedDate     = WebSiteCommon.LocalTime(DateTime.UtcNow, SessionManager.UserContext.TimeZoneID);
            radIssueDate.ShowPopupOnFocus = true;

            uclPartSearch1.Initialize("", false, false, false, IssueCtl().qualityIssue.IssueOccur.QS_ACTIVITY);
        }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!Page.IsPostBack)
     {
         ddlSeveritySelect.Items.AddRange(WebSiteCommon.PopulateRadListItems("incidentSeverity"));
         ddlSeveritySelect.Items.Insert(0, new RadComboBoxItem("", ""));
     }
 }
예제 #3
0
        private void FillLists(bool bArea, bool bCat)
        {
            string problemSelect = ddlProblemArea.SelectedValue;

            if (ddlProblemArea.Items.Count == 0 || bArea)
            {
                ddlProblemArea.Items.Clear();
                ddlProblemArea.Items.AddRange(WebSiteCommon.PopulateRadListItems("problemArea"));
                List <string> catArea = SQMResourcesMgr.SelectNonconfCategoryList("").Select(c => c.PROBLEM_AREA).Distinct().ToList();
                foreach (RadComboBoxItem item in ddlProblemArea.Items)
                {
                    if (catArea.Contains(item.Value) == false)
                    {
                        item.Enabled = item.Visible = false;
                    }
                }
                // ddlProblemArea.Items.Remove(0);
                ddlProblemArea.Items.Insert(0, new RadComboBoxItem("", ""));
                ddlProblemArea.SelectedValue = problemSelect;
            }
            if (ddlProblemArea.SelectedItem != null)
            {
                problemDescSelect = ddlProblemArea.SelectedItem.Text;
            }

            string category = ddlNCCategory.SelectedValue;

            if (bCat)
            {
                ddlNCCategory.Items.Clear();
                ddlNCCategory.DataSource     = SQMResourcesMgr.SelectNonconfCategoryList(ddlProblemArea.SelectedValue);
                ddlNCCategory.DataTextField  = "NONCONF_NAME";
                ddlNCCategory.DataValueField = "NONCONF_CD";
                ddlNCCategory.DataBind();
                ddlNCCategory.SelectedValue = category;
            }
        }
예제 #4
0
        protected void DisplayUser()
        {
            PERSON           person = LocalPerson();
            BusinessLocation businessLocation;
            SETTINGS         sets      = SQMSettings.GetSetting("COMPANY", "ESCALATEANYUSER");
            SQM_ACCESS       sysAccess = SQMModelMgr.LookupCredentials(entities, person.SSO_ID, "", false);

            divPageBody.Visible = true;
            ddlPlantSelect.ClearCheckedItems();
            ddlCustPlantSelect.ClearCheckedItems();

            DisplayErrorMessage(null);

            if (person == null || string.IsNullOrEmpty(person.STATUS))                 // new user
            {
                winUserEdit.Title        = hfAddUser.Value;
                businessLocation         = new BusinessLocation();
                businessLocation.Company = SessionManager.EffLocation.Company;
                SetStatusList("ddlUserStatus", "A", true);
                tbUserSSOID.Enabled = true;
                tbUserSSOID.Text    = "";
                tbUserSSOID.Focus();
            }
            else
            {
                winUserEdit.Title   = hfUpdateUser.Value;
                tbUserSSOID.Enabled = false;
                tbUserFirstName.Focus();

                lblPlantAccess.Text = "";
                if (person.PLANT_ID > 0)
                {
                    ddlHRLocation.SelectedValue = person.PLANT_ID.ToString();
                    if (ddlPlantSelect.Items.FindItemByValue(person.PLANT_ID.ToString()) != null)
                    {
                        ddlPlantSelect.Items.FindItemByValue(person.PLANT_ID.ToString()).Checked = true;
                    }
                }

                if (!string.IsNullOrEmpty(person.NEW_LOCATION_CD))
                {
                    RadComboBoxItem plantItem = null;
                    string[]        locs      = person.NEW_LOCATION_CD.Split(',');
                    foreach (string locid in locs)
                    {
                        if ((plantItem = ddlPlantSelect.Items.FindItemByValue(locid)) != null)
                        {
                            ddlPlantSelect.Items.FindItemByValue(locid).Checked = true;
                            if (locs.Length > 2)
                            {
                                lblPlantAccess.Text += lblPlantAccess.Text.Length == 0 ? plantItem.Text : (", " + plantItem.Text);
                            }
                        }
                    }
                }

                if (!string.IsNullOrEmpty(person.OLD_LOCATION_CD))
                {
                    string[] locs = person.OLD_LOCATION_CD.Split(',');
                    foreach (string locid in locs)
                    {
                        if (ddlCustPlantSelect.Items.FindItemByValue(locid) != null)
                        {
                            ddlCustPlantSelect.Items.FindItemByValue(locid).Checked = true;
                        }
                    }
                }
            }

            // AW20131106 - do not want to be able to change a SSO ID once a person has been added
            if (!string.IsNullOrEmpty(person.SSO_ID.Trim()))
            {
                tbUserSSOID.Text = person.SSO_ID;
            }

            tbUserFirstName.Text = person.FIRST_NAME;
            tbUserLastName.Text  = person.LAST_NAME;
            tbUserTitle.Text     = person.JOB_TITLE;
            tbUserPhone.Text     = person.PHONE;
            tbUserEmail.Text     = person.EMAIL;
            SetStatusList("ddlUserStatus", person.STATUS, true);
            if (sysAccess != null && sysAccess.LAST_LOGON_DT.HasValue)
            {
                lblUserLoginDate_out.Text = SQMBasePage.FormatDate(WebSiteCommon.LocalTime((DateTime)sysAccess.LAST_LOGON_DT, WebSiteCommon.GetXlatValue("timeZone", person.PREFERRED_TIMEZONE)), "g", true);
            }
            else
            {
                lblUserLoginDate_out.Text = "";
            }
            lblUserLastUpdate.Text = person.LAST_UPD_BY + "  " + SQMBasePage.FormatDate(WebSiteCommon.LocalTime((DateTime)person.LAST_UPD_DT, SessionManager.UserContext.TimeZoneID), "g", true);

            if (ddlUserLanguage.Items.FindByValue(person.PREFERRED_LANG_ID.ToString()) != null)
            {
                ddlUserLanguage.SelectedValue = person.PREFERRED_LANG_ID.ToString();
            }
            if (ddlUserTimezone.Items.FindByValue(person.PREFERRED_TIMEZONE) != null)
            {
                ddlUserTimezone.SelectedValue = person.PREFERRED_TIMEZONE;
            }

            ddlUserRole.Items.Clear();
            ddlUserRole.Items.AddRange(WebSiteCommon.PopulateRadListItems("userRole"));
            for (int i = ddlUserRole.Items.Count - 1; i >= 0; i--)
            {
                AccessMode roleMode = SessionManager.RoleAccessMode(Convert.ToInt32(ddlUserRole.Items[i].Value));
                if (SessionManager.IsEffLocationPrimary() && roleMode == AccessMode.Partner)
                {
                    ddlUserRole.Items.Remove(i);
                }
                if (!SessionManager.IsEffLocationPrimary() && roleMode != AccessMode.Partner)               // restrict roles of non-primary company users
                {
                    ddlUserRole.Items.Remove(i);
                }
                else if (UserContext.RoleAccess() < AccessMode.SA && roleMode > AccessMode.Admin)      // only QAI admin may see or edit sys admin role
                {
                    ddlUserRole.Items.Remove(i);
                }
            }

            string rolesDesc = "";

            if (ddlUserRole.Items.FindItemByValue(person.ROLE.ToString()) != null)
            {
                ddlUserRole.SelectedValue = person.ROLE.ToString();
            }

            if (sets == null || sets.VALUE.ToUpper() != "Y")      // prompt for user escalation
            {
                cbUserRcvEscalation.Visible = true;
                if (person.RCV_ESCALATION.HasValue)
                {
                    cbUserRcvEscalation.Checked = (bool)person.RCV_ESCALATION;
                }
            }
            else
            {
                cbUserRcvEscalation.Visible = false;        // enable escalation for anyone
                cbUserRcvEscalation.Checked = true;
            }

            if (person.ROLE <= 100 || person.PERSON_ACCESS.Where(a => a.ACCESS_PROD == "SQM").Count() > 0)
            {
                ddlCustPlantSelect.Enabled = true;
            }
            else
            {
                ddlCustPlantSelect.Enabled       = false;
                ddlCustPlantSelect.SelectedIndex = 0;
            }

            List <SysModule> sysmodList = SQMSettings.SystemModuleItems();
            string           prod = "";
            RadComboBoxItem  item = null; RadComboBoxItem itemSep = null;

            ddlModuleAccess.Items.Clear();
            lblModuleAccess.Text = "";
            foreach (SysModule sysmod in sysmodList.Where(l => l.prod != "CQM").ToList())
            {
                if (string.IsNullOrEmpty(sysmod.mod))
                {
                    prod                = sysmod.prod;
                    itemSep             = new RadComboBoxItem(((HiddenField)pnlUserEdit.FindControl("hf" + prod)).Value, prod);
                    itemSep.IsSeparator = true;
                    ddlModuleAccess.Items.Add(itemSep);
                }
                else
                {
                    item = new RadComboBoxItem(sysmod.desc, sysmod.topic);
                    ddlModuleAccess.Items.Add(item);
                    if (GetSelectedUserRole() <= 100)
                    {
                        item.Checked = true;
                    }
                    else if ((sysmod.prod == "SQM" && person.PERSON_ACCESS.Where(a => a.ACCESS_TOPIC == "201").Count() > 0) ||
                             (sysmod.prod == "EHS" && person.PERSON_ACCESS.Where(a => a.ACCESS_TOPIC == "301").Count() > 0))
                    {
                        item.Checked = true;
                    }
                    else if (person.PERSON_ACCESS.Where(a => a.ACCESS_TOPIC == sysmod.topic).Count() > 0)
                    {
                        item.Checked = true;
                    }
                    // exclusions
                    if (!SessionManager.IsEffLocationPrimary())  // restrict module selections if not primary company user
                    {
                        if (sysmod.prod != "SQM")
                        {
                            itemSep.Enabled        = item.Enabled = item.Checked = false;
                            ddlModuleAccess.Height = 120;
                        }
                    }
                    if (item.Checked)
                    {
                        lblModuleAccess.Text += lblModuleAccess.Text.Length == 0 ? item.Text : (", " + item.Text);
                    }
                }
            }

            if (!SessionManager.IsEffLocationPrimary())
            {
                ddlCustPlantSelect.Enabled  = false;
                cbUserRcvEscalation.Visible = cbUserRcvEscalation.Checked = false;
            }

            string script = "function f(){OpenUserEditWindow(); Sys.Application.remove_load(f);}Sys.Application.add_load(f);";

            ScriptManager.RegisterStartupScript(Page, Page.GetType(), "key", script, true);
        }