private decimal GetTaskLocation(TASK_STATUS task)
        {
            decimal plantID = SessionManager.UserContext.HRLocation.Plant.PLANT_ID;

            switch ((TaskRecordType)task.RECORD_TYPE)
            {
            case TaskRecordType.HealthSafetyIncident:
            case TaskRecordType.PreventativeAction:
                INCIDENT incident = EHSIncidentMgr.SelectIncidentById(new PSsqmEntities(), task.RECORD_ID);
                if (incident != null && incident.DETECT_PLANT_ID.HasValue)
                {
                    plantID = (decimal)incident.DETECT_PLANT_ID;
                }
                break;

            case TaskRecordType.Audit:
                AUDIT audit = EHSAuditMgr.SelectAuditById(new PSsqmEntities(), task.RECORD_ID);
                if (audit != null && audit.DETECT_PLANT_ID.HasValue)
                {
                    plantID = (decimal)audit.DETECT_PLANT_ID;
                }
                break;
            }

            return(plantID);
        }
Beispiel #2
0
        protected string GetPlantName(decimal auditId)
        {
            string content = "";

            content = EHSAuditMgr.SelectAuditLocationNameByAuditId(auditId);
            return(content);
        }
        private void UpdateAnswerStatus(decimal auditID, decimal questionID)
        {
            EHSAuditQuestion auditQuestion = EHSAuditMgr.SelectAuditQuestion(auditID, questionID);

            if (auditQuestion != null)
            {
                if (TaskXLATList == null || TaskXLATList.Count == 0)
                {
                    TaskXLATList = SQMBasePage.SelectXLATList(new string[1] {
                        "AUDIT_EXCEPTION_STATUS"
                    });
                }
                ddlAnswerStatus.DataTextField  = "DESCRIPTION";
                ddlAnswerStatus.DataValueField = "XLAT_CODE";
                ddlAnswerStatus.DataSource     = TaskXLATList;
                ddlAnswerStatus.DataBind();

                if (auditQuestion.Status == null || auditQuestion.Status == "")
                {
                    ddlAnswerStatus.SelectedIndex = 0;
                }
                else
                {
                    ddlAnswerStatus.SelectedValue = auditQuestion.Status;
                }

                btnStatusSave.CommandArgument = auditID + "~" + questionID;

                string script = "function f(){OpenUpdateAnswerStatusWindow(); Sys.Application.remove_load(f);}Sys.Application.add_load(f);";
                ScriptManager.RegisterStartupScript(Page, Page.GetType(), "key", script, true);
            }
        }
        protected void btnStatusSave_Click(object sender, EventArgs e)
        {
            Button btn = (Button)sender;

            if (btn == null || string.IsNullOrEmpty(btn.CommandArgument))
            {
                return;
            }

            string[] cmd = btn.CommandArgument.Split('~');             // recordType, recordID, recordSubID, taskStep, taskType

            EHSAuditQuestion auditQuestion = EHSAuditMgr.SelectAuditQuestion(Convert.ToInt32(cmd[0]), Convert.ToDecimal(cmd[1]));

            if (auditQuestion != null)
            {
                auditQuestion.Status            = ddlAnswerStatus.SelectedValue.ToString();
                auditQuestion.ResolutionComment = tbResolutionComment.Text.ToString();
                if (auditQuestion.Status.Equals("03"))
                {
                    // update the complete date with the local date/time of the plant
                    AUDIT    audit     = EHSAuditMgr.SelectAuditById(entities, auditQuestion.AuditId);
                    PLANT    plant     = SQMModelMgr.LookupPlant((decimal)audit.DETECT_PLANT_ID);
                    DateTime localTime = WebSiteCommon.LocalTime(DateTime.UtcNow, plant.LOCAL_TIMEZONE);
                    auditQuestion.CompleteDate = localTime;
                }
                EHSAuditMgr.UpdateAnswer(auditQuestion);
            }
            UpdateTaskList("update");
        }
        protected void lnkDeleteTask_OnClick(object sender, EventArgs e)
        {
            // we are only marking the status as deleteded, not physically deleting the task.
            lblErrorMessage.Text = "";
            LinkButton btn = (LinkButton)sender;

            if (btn == null || string.IsNullOrEmpty(btn.CommandArgument))
            {
                return;
            }
            TaskStatusMgr taskMgr = new TaskStatusMgr().CreateNew(0, 0);
            TASK_STATUS   task    = taskMgr.SelectTask(Convert.ToDecimal(btn.CommandArgument));

            taskMgr.UpdateTaskStatus(task, TaskStatus.Delete);
            taskMgr.UpdateTask(task);
            taskMgr.UpdateTaskList(task.RECORD_ID);
            if (OnTaskAdd != null)
            {
                OnTaskAdd("added", task.RECORD_ID, (decimal)task.RECORD_SUBID);
            }
            if (task.RECORD_TYPE == (int)TaskRecordType.Audit)             // update the Question Status when adding tasks for an audit followup.
            {
                EHSAuditQuestion auditQuestion = EHSAuditMgr.SelectAuditQuestion(task.RECORD_ID, (decimal)task.RECORD_SUBID);

                if (auditQuestion != null)
                {
                    auditQuestion.Status = "02";
                    EHSAuditMgr.UpdateAnswer(auditQuestion);
                }
                SessionManager.ReturnRecordID = task.RECORD_ID;
                SessionManager.ReturnObject   = "AddTask";
                SessionManager.ReturnStatus   = true;
            }
        }
        protected void AddAttach(decimal auditId, decimal questionId)
        {
            EHSAuditQuestion auditQuestion = EHSAuditMgr.SelectAuditQuestion(auditId, questionId);
            AUDIT            audit         = EHSAuditMgr.SelectAuditById(new PSsqmEntities(), auditId);
            int recordType = (int)TaskRecordType.Audit;

            // before we call the radWindow, we need to update the page?
            uclAttachWin.OpenManageAttachmentsWindow(recordType, audit.AUDIT_ID, auditQuestion.QuestionId.ToString(), Resources.LocalizedText.AttachmentsUpload.ToString(), Resources.LocalizedText.AttachmentsForAssessment.ToString());
        }
Beispiel #7
0
        private void SetupPage()
        {
            if (ddlPlantSelect.Items.Count < 1)
            {
                List <BusinessLocation> locationList = SQMModelMgr.SelectBusinessLocationList(SessionManager.UserContext.HRLocation.Company.COMPANY_ID, 0, true);
                SQMBasePage.SetLocationList(ddlPlantSelect, UserContext.FilterPlantAccessList(locationList), 0);

                rcbStatusSelect.SelectedValue = "A";
            }
            divAuditList.Visible = true;

            dmFromDate.ShowPopupOnFocus = dmToDate.ShowPopupOnFocus = true;
            // ABW 1/5/16 - use user's default plant local time for search default
            DateTime localTime = SessionManager.UserContext.LocalTime;

            dmFromDate.SelectedDate = localTime.AddMonths(-1);
            dmToDate.SelectedDate   = localTime.AddMonths(1);

            if (Mode == AuditMode.Audit)
            {
                lblViewEHSRezTitle.Text  = GetLocalResourceObject("lblViewEHSRezTitleResource1.Text").ToString();
                lblPageInstructions.Text = GetLocalResourceObject("lblPageInstructionsResource1.Text").ToString();
                //lblStatus.Text = "Assessment Status:";
                rbNew.Text           = GetLocalResourceObject("rbNewResource1.Text").ToString();
                lblAuditDate.Visible = true;
                phAudit.Visible      = true;

                SETTINGS sets = SQMSettings.GetSetting("EHS", "AUDITSEARCHFROM");
                if (sets != null)
                {
                    try
                    {
                        string[] args = sets.VALUE.Split('-');
                        if (args.Length > 1)
                        {
                            dmFromDate.SelectedDate = new DateTime(Convert.ToInt32(args[0]), Convert.ToInt32(args[1]), Convert.ToInt32(args[2]));
                        }
                        else
                        {
                            dmFromDate.SelectedDate = SessionManager.UserContext.LocalTime.AddMonths(Convert.ToInt32(args[0]) * -1);
                        }
                    }
                    catch { }
                }

                if (rcbAuditType.Items.Count < 1)
                {
                    foreach (AUDIT_TYPE ip in EHSAuditMgr.SelectAuditTypeList(SessionManager.PrimaryCompany().COMPANY_ID, false))
                    {
                        RadComboBoxItem item = new RadComboBoxItem(ip.TITLE, ip.AUDIT_TYPE_ID.ToString());
                        item.Checked = true;
                        rcbAuditType.Items.Add(item);
                    }
                }
            }
        }
        protected void Save(bool shouldReturn)
        {
            AUDIT_SCHEDULER scheduler       = null;
            decimal         auditScheduleId = 0;
            string          result          = "<h3>EHS Audit Scheduler " + ((IsEditContext) ? "Updated" : "Created") + ":</h3>";

            if (shouldReturn == true)
            {
                divForm.Visible = false;

                pnlAddEdit.Visible    = false;
                btnSaveReturn.Visible = false;

                RadCodeBlock rcbWarnNavigate = (RadCodeBlock)this.Parent.Parent.FindControl("rcbWarnNavigate");
                if (rcbWarnNavigate != null)
                {
                    rcbWarnNavigate.Visible = false;
                }

                lblResults.Visible = true;
            }

            if (!IsEditContext)
            {
                auditTypeId = SelectedTypeId;
                auditType   = rddlAuditType.SelectedText;
            }
            else
            {
                auditTypeId = EditAuditTypeId;
                auditType   = EHSAuditMgr.SelectAuditTypeByAuditScheduleId(EditAuditScheduleId);
            }

            if (!IsEditContext)
            {
                // Add context
                scheduler       = CreateNewAuditScheduler();
                auditScheduleId = scheduler.AUDIT_SCHEDULER_ID;
            }
            else
            {
                // Edit context
                auditScheduleId = EditAuditScheduleId;
                if (auditScheduleId > 0)
                {
                    scheduler = UpdateAuditScheduler(auditScheduleId);
                }
            }
            if (shouldReturn)
            {
                SessionManager.ReturnStatus = false;
                SessionManager.ReturnObject = "DisplayAuditSchedules";
                Response.Redirect("/EHS/EHS_Audit_Scheduler.aspx");                  // mt - temporary
            }
        }
        private void AddTask(decimal auditID, decimal questionID)
        {
            int              recordType    = (int)TaskRecordType.Audit;
            AUDIT            audit         = EHSAuditMgr.SelectAuditById(new PSsqmEntities(), auditID);
            EHSAuditQuestion auditQuestion = EHSAuditMgr.SelectAuditQuestion(auditID, questionID);

            //List<TASK_STATUS> tasks = TaskMgr.AuditTaskListByRecord(recordType, auditID, questionID);
            uclTask.BindTaskAdd(recordType, auditQuestion.AuditId, auditQuestion.QuestionId, "350", "T", auditQuestion.QuestionText, (decimal)audit.DETECT_PLANT_ID, "");
            string script = "function f(){OpenUpdateTaskWindow(); Sys.Application.remove_load(f);}Sys.Application.add_load(f);";

            ScriptManager.RegisterStartupScript(Page, Page.GetType(), "key", script, true);
        }
Beispiel #10
0
        private void SetupPage()
        {
            if (ddlPlantSelect.Items.Count < 1)
            {
                List <BusinessLocation> locationList = SQMModelMgr.SelectBusinessLocationList(SessionManager.UserContext.HRLocation.Company.COMPANY_ID, 0, true);
                SQMBasePage.SetLocationList(ddlPlantSelect, UserContext.FilterPlantAccessList(locationList), 0);

                rcbStatusSelect.SelectedValue = "A";
            }
            divAuditList.Visible = true;

            dmFromDate.ShowPopupOnFocus = dmToDate.ShowPopupOnFocus = true;
            dmFromDate.SelectedDate     = DateTime.Now.AddMonths(-1);
            dmToDate.SelectedDate       = DateTime.Now.AddMonths(1);

            if (Mode == AuditMode.Audit)
            {
                lblViewEHSRezTitle.Text  = "Manage Environmental Health &amp; Safety Audits";
                lblPageInstructions.Text = "Add or update EH&amp;S Audits below.";
                //lblStatus.Text = "Audit Status:";
                rbNew.Text           = "New Audit";
                lblAuditDate.Visible = true;
                phAudit.Visible      = true;

                SETTINGS sets = SQMSettings.GetSetting("EHS", "AUDITSEARCHFROM");
                if (sets != null)
                {
                    try
                    {
                        string[] args = sets.VALUE.Split('-');
                        if (args.Length > 1)
                        {
                            dmFromDate.SelectedDate = new DateTime(Convert.ToInt32(args[0]), Convert.ToInt32(args[1]), Convert.ToInt32(args[2]));
                        }
                        else
                        {
                            dmFromDate.SelectedDate = DateTime.Now.AddMonths(Convert.ToInt32(args[0]) * -1);
                        }
                    }
                    catch { }
                }

                foreach (AUDIT_TYPE ip in EHSAuditMgr.SelectAuditTypeList(SessionManager.PrimaryCompany().COMPANY_ID, false))
                {
                    RadComboBoxItem item = new RadComboBoxItem(ip.TITLE, ip.AUDIT_TYPE_ID.ToString());
                    item.Checked = true;
                    rcbAuditType.Items.Add(item);
                }
            }
        }
        private void UpdateTaskList(string cmd, decimal recordID, decimal recordSubID)
        {
            // update the status when a task is added
            if (cmd == "added")
            {
                EHSAuditQuestion auditQuestion = EHSAuditMgr.SelectAuditQuestion(recordID, recordSubID);

                if (auditQuestion != null)
                {
                    auditQuestion.Status = "02";
                    EHSAuditMgr.UpdateAnswer(auditQuestion);
                }
                SearchAudits();
            }
        }
        protected void btnDelete_Click(object sender, EventArgs e)
        {
            if (EditAuditScheduleId > 0)
            {
                pnlForm.Visible = false;

                btnSaveReturn.Visible = false;
                btnDelete.Visible     = false;
                lblResults.Visible    = true;
                int delStatus = EHSAuditMgr.DeleteAuditScheduler(EditAuditScheduleId);
                lblResults.Text  = "<div style=\"text-align: center; font-weight: bold; padding: 10px;\">";
                lblResults.Text += (delStatus == 1) ? "Audit Scheduler deleted." : "Error deleting audit scheduler.";
                lblResults.Text += "</div>";
            }

            rddlAuditType.SelectedIndex = 0;
        }
        List <decimal> SelectPlantIdsByAccessLevel()
        {
            List <decimal> plantIdList = new List <decimal>();

            if (UserContext.CheckUserPrivilege(SysPriv.admin, SysScope.system))
            {
                plantIdList = EHSAuditMgr.SelectPlantIdsByCompanyId(companyId);
            }
            else
            {
                plantIdList = SessionManager.UserContext.PlantAccessList;
                if (plantIdList == null || plantIdList.Count == 0)
                {
                    plantIdList.Add(SessionManager.UserContext.HRLocation.Plant.PLANT_ID);
                }
            }

            return(plantIdList);
        }
Beispiel #14
0
        private void SetupPage()
        {
            if (ddlPlantSelect.Items.Count < 1)
            {
                List <BusinessLocation> locationList = SQMModelMgr.SelectBusinessLocationList(SessionManager.UserContext.HRLocation.Company.COMPANY_ID, 0, true);
                SQMBasePage.SetLocationList(ddlPlantSelect, UserContext.FilterPlantAccessList(locationList), 0);

                rcbStatusSelect.SelectedValue = "A";
            }

            if (rcbAuditType.Items.Count < 1)
            {
                foreach (AUDIT_TYPE ip in EHSAuditMgr.SelectAuditTypeList(SessionManager.PrimaryCompany().COMPANY_ID, false))
                {
                    RadComboBoxItem item = new RadComboBoxItem(ip.TITLE, ip.AUDIT_TYPE_ID.ToString());
                    item.Checked = true;
                    rcbAuditType.Items.Add(item);
                }
            }
            if (rcbScheduleDay.Items.Count < 1)
            {
                IDictionary <int, string> days = GetAll <DayOfWeek>();
                foreach (var day in days)
                {
                    RadComboBoxItem item = new RadComboBoxItem(day.Value, day.Key.ToString());
                    item.Checked = true;
                    rcbScheduleDay.Items.Add(item);
                }
                //rcbScheduleDay.DataSource = GetAll<DayOfWeek>();
                //rcbScheduleDay.DataTextField = "Value";
                //rcbScheduleDay.DataValueField = "Key";
                //rcbScheduleDay.DataBind();
            }

            divAuditList.Visible = true;

            lblViewEHSRezTitle.Text  = "Manage Environmental Health &amp; Safety Audit Schedules";
            lblPageInstructions.Text = "Add or update EH&amp;S Audit Schedule below.";
            rbNew.Text      = "New Audit Schedule";
            phAudit.Visible = true;
        }
Beispiel #15
0
        public static void NotifyOnAuditCreate(decimal auditId, decimal personId)
        {
            var entities = new PSsqmEntities();

            decimal companyId = SessionManager.UserContext.HRLocation.Company.COMPANY_ID;
            decimal busOrgId  = SessionManager.UserContext.HRLocation.BusinessOrg.BUS_ORG_ID;
            var     emailIds  = new HashSet <decimal>();

            AUDIT  audit     = EHSAuditMgr.SelectAuditById(entities, auditId);
            string auditType = EHSAuditMgr.SelectAuditTypeByAuditId(auditId);

            emailIds.Add((decimal)audit.AUDIT_PERSON);

            if (emailIds.Count > 0)
            {
                string appUrl = SQMSettings.SelectSettingByCode(entities, "MAIL", "TASK", "MailURL").VALUE;
                if (string.IsNullOrEmpty(appUrl))
                {
                    appUrl = "the website";
                }

                string emailSubject = "Audit Created: " + auditType;
                string emailBody    = "A new audit has been created:<br/>" +
                                      "<br/>" +
                                      auditType + "<br/>" +
                                      "<br/>" +
                                      "Please log in to " + appUrl + auditPath + " to view the audit.";

                foreach (decimal eid in emailIds)
                {
                    string emailAddress = (from p in entities.PERSON where p.PERSON_ID == eid select p.EMAIL).FirstOrDefault();

                    Thread thread = new Thread(() => WebSiteCommon.SendEmail(emailAddress, emailSubject, emailBody, "", "web"));
                    thread.IsBackground = true;
                    thread.Start();

                    //WebSiteCommon.SendEmail(emailAddress, emailSubject, emailBody, "");
                }
            }
        }
        protected void UpdateAuditTypes()
        {
            if (rddlAuditType.Items.Count == 0)
            {
                var    auditTypeList = new List <AUDIT_TYPE>();
                string selectString  = "";
                auditTypeList = EHSAuditMgr.SelectAuditTypeList(companyId, true);
                selectString  = "[Select An Audit Type]";
                if (auditTypeList.Count > 1)
                {
                    auditTypeList.Insert(0, new AUDIT_TYPE()
                    {
                        AUDIT_TYPE_ID = 0, TITLE = selectString
                    });
                }

                rddlAuditType.DataSource     = auditTypeList;
                rddlAuditType.DataTextField  = "TITLE";
                rddlAuditType.DataValueField = "AUDIT_TYPE_ID";
                rddlAuditType.DataBind();
            }
        }
        protected void rgAuditAnswers_NeedDataSource(object sender, GridNeedDataSourceEventArgs e)
        {
            try
            {
                GridDataItem parentItem = ((sender as RadGrid).NamingContainer as GridNestedViewItem).ParentItem as GridDataItem;
                if (parentItem != null)
                {
                    // we only want to select the audit answers that were adverse
                    // or have a task assigned to them
                    decimal                 auditID        = Convert.ToDecimal(parentItem.GetDataKeyValue("Audit.Audit_ID").ToString());
                    HiddenField             hdnAuditTypeId = (HiddenField)parentItem.FindControl("hdnAuditTypeID");
                    decimal                 auditTypeID    = Convert.ToDecimal(hdnAuditTypeId.Value.ToString());
                    List <EHSAuditQuestion> questions      = (List <EHSAuditQuestion>)EHSAuditMgr.SelectAuditQuestionExceptionList(auditID, auditTypeID, true);

                    (sender as RadGrid).DataSource = questions;
                }
            }
            catch (Exception ex) { }
        }
        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;
            }
        }
        protected void btnTaskAdd_Click(object sender, EventArgs e)
        {
            PSsqmEntities ctx = new PSsqmEntities();

            lblErrorMessage.Text = "";
            Button btn = (Button)sender;

            if (btn == null || string.IsNullOrEmpty(btn.CommandArgument))
            {
                return;
            }

            string[] cmd         = btn.CommandArgument.Split('~');     // recordType, recordID, recordSubID, taskStep, taskType, plantID
            int      recordType  = Convert.ToInt32(cmd[0]);
            decimal  recordID    = Convert.ToDecimal(cmd[1]);
            decimal  recordSubID = Convert.ToDecimal(cmd[2]);
            string   taskStep    = cmd[3];
            string   taskType    = cmd[4];

            decimal plantID = 0;

            decimal.TryParse(cmd[5], out plantID);

            // make sure that the Assign To Employee has been selected
            if (ddlAssignPersonAdd.SelectedValue.ToString().Equals(""))
            {
                // I don't think we need to bind the list at this point
                BindTaskAdd(recordType, recordID, recordSubID, taskStep, taskType, lblTaskDetailValueAdd.Text.ToString(), plantID, "");
                lblErrorMessage.Text = lblErrRequiredInputs.Text.ToString();
                string script = "function f(){OpenUpdateTaskWindow(); Sys.Application.remove_load(f);}Sys.Application.add_load(f);";
                ScriptManager.RegisterStartupScript(Page, Page.GetType(), "key", script, true);
            }
            else
            {
                TaskStatusMgr taskMgr = new TaskStatusMgr();
                taskMgr.Initialize(recordType, recordID);
                TASK_STATUS task = new TASK_STATUS();
                task.RECORD_TYPE    = recordType;
                task.RECORD_ID      = recordID;
                task.RECORD_SUBID   = recordSubID;
                task.TASK_STEP      = taskStep;
                task.TASK_TYPE      = taskType;
                task.TASK_SEQ       = 0;
                task.DUE_DT         = rdpTaskDueDTAdd.SelectedDate;
                task.RESPONSIBLE_ID = Convert.ToDecimal(ddlAssignPersonAdd.SelectedValue.ToString());
                task.DETAIL         = lblTaskDetailValueAdd.Text.ToString();
                task.DESCRIPTION    = tbTaskDescriptionAdd.Text.ToString();
                task.STATUS         = ((int)TaskStatus.New).ToString();
                task.CREATE_DT      = SessionManager.UserContext.LocalTime != null ? SessionManager.UserContext.LocalTime : DateTime.UtcNow;
                task.CREATE_ID      = SessionManager.UserContext.Person.PERSON_ID;

                taskMgr.CreateTask(task);
                taskMgr.UpdateTaskList(task.RECORD_ID);
                // send email
                PERSON assignTo = SQMModelMgr.LookupPerson(ctx, (decimal)task.RESPONSIBLE_ID, "", false);
                EHSNotificationMgr.NotifyTaskAssigment(task, assignTo.PLANT_ID);

                // reset the fields for the next add
                ddlAssignPersonAdd.SelectedValue = "";
                tbTaskDescriptionAdd.Text        = "";
                rdpTaskDueDTAdd.SelectedDate     = DateTime.Today;

                if (OnTaskAdd != null)
                {
                    OnTaskAdd("added", task.RECORD_ID, (decimal)task.RECORD_SUBID);
                }
                if (recordType == (int)TaskRecordType.Audit)                 // update the Question Status when adding tasks for an audit followup.
                {
                    EHSAuditQuestion auditQuestion = EHSAuditMgr.SelectAuditQuestion(recordID, recordSubID);

                    if (auditQuestion != null)
                    {
                        auditQuestion.Status = "02";
                        EHSAuditMgr.UpdateAnswer(auditQuestion);
                    }
                    //SessionManager.ReturnRecordID = task.RECORD_ID;
                    //SessionManager.ReturnObject = "AddTask";
                    //SessionManager.ReturnStatus = true;
                }

                if (Page.Request.Url.ToString().Contains("AssessmentForm"))
                {
                    // now update the list and stay on the popup
                    BindTaskAdd(recordType, recordID, recordSubID, taskStep, taskType, lblTaskDetailValueAdd.Text.ToString(), plantID, "");
                    lblErrorMessage.Text = "";
                    string script = "function f(){OpenUpdateTaskWindow(); Sys.Application.remove_load(f);}Sys.Application.add_load(f);";
                    ScriptManager.RegisterStartupScript(Page, Page.GetType(), "key", script, true);
                }
                else
                {
                    SessionManager.ReturnRecordID = task.RECORD_ID;
                    SessionManager.ReturnObject   = "AddTask";
                    SessionManager.ReturnStatus   = true;
                }
            }
        }
        private void SetupPage()
        {
            if (ddlPlantSelect.Items.Count < 1)
            {
                List <BusinessLocation> locationList = SQMModelMgr.SelectBusinessLocationList(SessionManager.UserContext.HRLocation.Company.COMPANY_ID, 0, true);
                SQMBasePage.SetLocationList(ddlPlantSelect, UserContext.FilterPlantAccessList(locationList), 0);

                rcbStatusSelect.SelectedValue = "A";
            }
            divAuditList.Visible = true;

            dmFromDate.ShowPopupOnFocus = dmToDate.ShowPopupOnFocus = true;

            // we want the start date to be the previous week Monday
            // ABW 1/5/16 - use user's default plant local time for search default
            DateTime localTime = SessionManager.UserContext.LocalTime;
            int      dayofweek = (int)localTime.DayOfWeek;
            DateTime fromDate  = localTime.AddDays(-7);

            while ((int)(fromDate.DayOfWeek) > 1)
            {
                fromDate = fromDate.AddDays(-1);
            }
            // we want the end date to be the next week Monday (so we can see audits in progress)
            DateTime toDate = localTime;

            while ((int)(toDate.DayOfWeek) > 1)
            {
                toDate = toDate.AddDays(1);
            }

            dmFromDate.SelectedDate = fromDate;
            dmToDate.SelectedDate   = toDate;

            if (Mode == AuditMode.Audit)
            {
                //lblViewEHSRezTitle.Text = "Environmental Health &amp; Safety Assessment Exceptions";
                //lblPageInstructions.Text = "Review and update EH&amp;S Assessment Exceptions below.";
                //lblStatus.Text = "Assessment Status:";
                lblAuditDate.Visible = true;
                phAudit.Visible      = true;

                SETTINGS sets = SQMSettings.GetSetting("EHS", "AUDITEXCEPTIONSEARCHFROM");
                if (sets != null)
                {
                    try
                    {
                        string[] args = sets.VALUE.Split('-');
                        if (args.Length > 1)
                        {
                            dmFromDate.SelectedDate = new DateTime(Convert.ToInt32(args[0]), Convert.ToInt32(args[1]), Convert.ToInt32(args[2]));
                        }
                        else
                        {
                            dmFromDate.SelectedDate = SessionManager.UserContext.LocalTime.AddMonths(Convert.ToInt32(args[0]) * -1);
                        }
                    }
                    catch { }
                }

                if (rcbAuditType.Items.Count < 1)
                {
                    foreach (AUDIT_TYPE ip in EHSAuditMgr.SelectAuditTypeList(SessionManager.PrimaryCompany().COMPANY_ID, false))
                    {
                        RadComboBoxItem item = new RadComboBoxItem(ip.TITLE, ip.AUDIT_TYPE_ID.ToString());
                        item.Checked = true;
                        rcbAuditType.Items.Add(item);
                    }
                }
            }
        }
        protected void btnTaskUpdate_Click(object sender, EventArgs e)
        {
            PSsqmEntities ctx = new PSsqmEntities();

            lblErrorMessage.Text = "";
            Button btn = (Button)sender;

            if (btn == null || string.IsNullOrEmpty(btn.CommandArgument))
            {
                return;
            }

            TaskStatusMgr taskMgr = new TaskStatusMgr().CreateNew(0, 0);
            TASK_STATUS   task    = taskMgr.SelectTask(Convert.ToDecimal(btn.CommandArgument));

            //task.RECORD_TYPE = recordType;
            //task.RECORD_ID = recordID;
            //task.RECORD_SUBID = recordSubID;
            //task.TASK_STEP = taskStep;
            //task.TASK_TYPE = taskType;
            //task.TASK_SEQ = 0;
            task.DUE_DT = rdpTaskDueDT.SelectedDate;
            //task.RESPONSIBLE_ID = Convert.ToDecimal(ddlAssignPerson.SelectedValue.ToString());
            //task.DETAIL = lblTaskDetailValue.Text.ToString(); // this is the original detail, so we don't change it.
            //task.DESCRIPTION = tbTaskDescription.Text.ToString();
            task.COMMENTS = tbTaskComments.Text.ToString();
            //task.STATUS = ((int)TaskStatus.New).ToString();
            //task.CREATE_DT = SessionManager.UserContext.LocalTime != null ? SessionManager.UserContext.LocalTime : DateTime.UtcNow;
            //task.CREATE_ID = SessionManager.UserContext.Person.PERSON_ID;

            taskMgr.UpdateTask(task);
            taskMgr.UpdateTaskList(task.RECORD_ID);
            // send email
            PERSON assignTo = SQMModelMgr.LookupPerson(ctx, (decimal)task.RESPONSIBLE_ID, "", false);

            EHSNotificationMgr.NotifyTaskAssigment(task, assignTo.PLANT_ID);

            // reset the fields for the next add
            ddlAssignPersonAdd.SelectedValue = "";
            tbTaskDescriptionAdd.Text        = "";
            rdpTaskDueDTAdd.SelectedDate     = DateTime.Today;

            if (OnTaskAdd != null)
            {
                OnTaskAdd("added", task.RECORD_ID, (decimal)task.RECORD_SUBID);
            }
            if (task.RECORD_TYPE == (int)TaskRecordType.Audit)             // update the Question Status when adding tasks for an audit followup.
            {
                EHSAuditQuestion auditQuestion = EHSAuditMgr.SelectAuditQuestion(task.RECORD_ID, (decimal)task.RECORD_SUBID);

                if (auditQuestion != null)
                {
                    auditQuestion.Status = "02";
                    EHSAuditMgr.UpdateAnswer(auditQuestion);
                }
                //SessionManager.ReturnRecordID = task.RECORD_ID;
                //SessionManager.ReturnObject = "AddTask";
                //SessionManager.ReturnStatus = true;
            }

            if (Page.Request.Url.ToString().Contains("AssessmentForm"))
            {
                // now update the list and stay on the popup if adding through assessment form
                BindTaskAdd(task.RECORD_TYPE, task.RECORD_ID, (decimal)task.RECORD_SUBID, task.TASK_STEP, task.TASK_TYPE, lblTaskDetailValue.Text.ToString(), assignTo.PLANT_ID, "");
                lblErrorMessage.Text = "";

                string script = "function f(){OpenUpdateTaskWindow(); Sys.Application.remove_load(f);}Sys.Application.add_load(f);";
                ScriptManager.RegisterStartupScript(Page, Page.GetType(), "key", script, true);
            }
            else
            {
                SessionManager.ReturnRecordID = task.RECORD_ID;
                SessionManager.ReturnObject   = "UpdateTask";
                SessionManager.ReturnStatus   = true;

                if (OnTaskUpdate != null)
                {
                    OnTaskUpdate("update");
                }
            }
        }
        public void Refresh(decimal auditId, int[] steps)
        {
            var     entities    = new PSsqmEntities();
            var     companyId   = SessionManager.UserContext.WorkingLocation.Company.COMPANY_ID;
            decimal?auditTypeId = (from i in entities.AUDIT where i.AUDIT_ID == auditId select i.AUDIT_TYPE_ID).FirstOrDefault();

            var sb = new StringBuilder();

            if (auditTypeId != null)
            {
                foreach (int step in steps)
                {
                    var questions = EHSAuditMgr.SelectAuditQuestionList((decimal)auditTypeId, 0, auditId);

                    string  previousTopic           = "";
                    string  qid                     = "";
                    string  tid                     = "";
                    string  ptid                    = "";
                    decimal totalQuestions          = 0;
                    decimal totalTopicQuestions     = 0;
                    decimal totalPositive           = 0;
                    decimal totalTopicPositive      = 0;
                    decimal totalPercent            = 0;
                    decimal totalWeightScore        = 0;
                    decimal totalPossibleScore      = 0;
                    decimal totalTopicWeightScore   = 0;
                    decimal totalTopicPossibleScore = 0;
                    decimal possibleScore           = 0;
                    decimal percentInTopic          = 0;

                    sb.AppendLine("<table class=\"lightTable\" cellspacing=\"0\" style=\"width: 100%\">");
                    foreach (var q in questions)
                    {
                        qid  = q.QuestionId.ToString();
                        tid  = q.TopicId.ToString();
                        ptid = previousTopic;
                        bool   answerIsPositive = false;
                        string answerText       = "";

                        if (!previousTopic.Equals(tid))                         // add a topic header
                        {
                            if (!previousTopic.Equals(""))
                            {
                                // need to add a display for the topic percentage
                                //if (totalTopicQuestions > 0)
                                //	totalPercent = totalTopicPositive / totalTopicQuestions;
                                //else
                                //	totalPercent = 0;
                                if (totalTopicPossibleScore > 0)
                                {
                                    totalPercent = totalTopicWeightScore / totalTopicPossibleScore;
                                }
                                else
                                {
                                    totalPercent = 0;
                                }
                                if (percentInTopic > 0)
                                {
                                    sb.AppendLine("<tr><td colspan=\"3\" class=\"greyCell\" style=\"width: 100%; text-align: right; font-weight: bold;\">" + string.Format("{0:0%}", totalPercent) + "</td></tr>");
                                }
                                totalTopicQuestions     = 0;
                                totalTopicPositive      = 0;
                                totalTopicWeightScore   = 0;
                                totalTopicPossibleScore = 0;
                                percentInTopic          = 0;
                            }
                            sb.AppendLine("<tr><td colspan=\"3\" class=\"blueCell\" style=\"width: 100%; font-weight: bold;\">" + q.TopicTitle + "</td></tr>");
                            previousTopic = tid;
                        }

                        //string answer = (from a in entities.AUDIT_ANSWER
                        //				 where a.AUDIT_ID == auditId && a.AUDIT_QUESTION_ID == q.QuestionId
                        //				 select a.ANSWER_VALUE).FirstOrDefault();
                        var auditAnswer = (from a in entities.AUDIT_ANSWER
                                           where a.AUDIT_ID == auditId && a.AUDIT_QUESTION_ID == q.QuestionId
                                           select a).FirstOrDefault();
                        string answer  = (auditAnswer.ANSWER_VALUE == null) ? "" : auditAnswer.ANSWER_VALUE;
                        string comment = (auditAnswer.COMMENT == null) ? "" : auditAnswer.COMMENT;

                        if (q.QuestionType == EHSAuditQuestionType.RadioPercentage || q.QuestionType == EHSAuditQuestionType.RadioPercentageCommentLeft)
                        {
                            totalQuestions      += 1;
                            totalTopicQuestions += 1;
                            percentInTopic      += 1;
                            answerIsPositive     = false;
                            possibleScore        = 0;
                            foreach (EHSAuditAnswerChoice choice in q.AnswerChoices)
                            {
                                if (choice.ChoiceWeight > possibleScore)
                                {
                                    possibleScore = choice.ChoiceWeight;
                                }
                                if (choice.Value.Equals(answer))
                                {
                                    if (choice.ChoicePositive)
                                    {
                                        answerIsPositive = true;
                                    }
                                    totalWeightScore      += choice.ChoiceWeight;
                                    totalTopicWeightScore += choice.ChoiceWeight;
                                }
                            }
                            totalPossibleScore      += possibleScore;
                            totalTopicPossibleScore += possibleScore;
                            if (answerIsPositive)
                            {
                                totalPositive      += 1;
                                totalTopicPositive += 1;
                            }
                        }
                        answer = answer.Replace("<a href", "<a target=\"blank\" href");

                        if (!string.IsNullOrEmpty(answer) ||
                            q.QuestionType == EHSAuditQuestionType.Attachment ||
                            q.QuestionType == EHSAuditQuestionType.PageOneAttachment)
                        {
                            switch (q.QuestionType)
                            {
                            case EHSAuditQuestionType.Date:
                                answer = DateTime.Parse(answer, CultureInfo.GetCultureInfo("en-US")).ToShortDateString();
                                answer = Server.HtmlEncode(answer);
                                break;

                            case EHSAuditQuestionType.Time:
                                answer = DateTime.Parse(answer, CultureInfo.GetCultureInfo("en-US")).ToShortTimeString();
                                answer = Server.HtmlEncode(answer);
                                break;

                            case EHSAuditQuestionType.DateTime:
                                answer = DateTime.Parse(answer, CultureInfo.GetCultureInfo("en-US")).ToString();
                                answer = Server.HtmlEncode(answer);
                                break;

                            case EHSAuditQuestionType.LocationDropdown:
                                answer = EHSAuditMgr.SelectPlantNameById(Convert.ToDecimal(answer));
                                answer = Server.HtmlEncode(answer);
                                break;

                            case EHSAuditQuestionType.UsersDropdown:
                                answer = EHSAuditMgr.SelectUserNameById(Convert.ToDecimal(answer));
                                answer = Server.HtmlEncode(answer);
                                break;

                            case EHSAuditQuestionType.UsersDropdownLocationFiltered:
                                answer = EHSAuditMgr.SelectUserNameById(Convert.ToDecimal(answer));
                                answer = Server.HtmlEncode(answer);
                                break;

                            case EHSAuditQuestionType.Attachment:
                                answer = GetUploadedFiles(40, auditId, (step + 1).ToString());
                                break;

                            case EHSAuditQuestionType.PageOneAttachment:
                                answer = GetUploadedFiles(40, auditId, (step + 1).ToString());
                                break;
                            }
                        }
                        // Add a comment box that hides/shows via a link to certain field types
                        if (q.QuestionType == EHSAuditQuestionType.BooleanCheckBox || q.QuestionType == EHSAuditQuestionType.CheckBox ||
                            q.QuestionType == EHSAuditQuestionType.Dropdown || q.QuestionType == EHSAuditQuestionType.PercentTextBox ||
                            q.QuestionType == EHSAuditQuestionType.Radio || q.QuestionType == EHSAuditQuestionType.RequiredYesNoRadio ||
                            q.QuestionType == EHSAuditQuestionType.RadioPercentage || q.QuestionType == EHSAuditQuestionType.RadioPercentageCommentLeft ||
                            q.QuestionType == EHSAuditQuestionType.RadioCommentLeft)
                        {
                            answerText = q.AnswerChoices.Where(l => l.Value == answer).FirstOrDefault() != null?q.AnswerChoices.Where(l => l.Value == answer).FirstOrDefault().Text : "";

                            comment = Server.HtmlEncode(comment);
                            if (q.QuestionType == EHSAuditQuestionType.RadioPercentageCommentLeft || q.QuestionType == EHSAuditQuestionType.RadioCommentLeft)
                            {
                                sb.AppendLine(string.Format("<tr><td style=\"width: 33%;\">{0}</td><td style=\"width: 33%;\">{1}</td><td style=\"width: 33%;\">{2}</td></tr>", q.QuestionText, comment, answerText));
                            }
                            else
                            {
                                sb.AppendLine(string.Format("<tr><td style=\"width: 33%;\">{0}</td><td style=\"width: 33%;\">{1}</td><td style=\"width: 33%;\">{2}</td></tr>", q.QuestionText, answerText, comment));
                            }
                        }
                        else
                        {
                            answerText = q.AnswerChoices.Where(l => l.Value == answer).FirstOrDefault() != null?q.AnswerChoices.Where(l => l.Value == answer).FirstOrDefault().Text : "";

                            sb.AppendLine(string.Format("<tr><td style=\"width: 33%;\">{0}</td><td style=\"width: 33%;\">{1}</td><td style=\"width: 33%;\"></td></tr>", q.QuestionText, answerText));
                        }
                    }
                    // add the last topic total
                    //if (totalTopicQuestions > 0)
                    //	totalPercent = totalTopicPositive / totalTopicQuestions;
                    //else
                    //	totalPercent = 0;
                    if (totalTopicPossibleScore > 0)
                    {
                        totalPercent = totalTopicWeightScore / totalTopicPossibleScore;
                    }
                    else
                    {
                        totalPercent = 0;
                    }
                    if (percentInTopic > 0)
                    {
                        sb.AppendLine("<tr><td colspan=\"3\" class=\"greyCell\" style=\"width: 100%; text-align: right; font-weight: bold;\">" + string.Format("{0:0%}", totalPercent) + "</td></tr>");
                    }
                    // update the audit total
                    if (totalQuestions > 0)
                    {
                        totalPercent = totalPositive / totalQuestions;
                    }
                    else
                    {
                        totalPercent = 0;
                    }
                    //sb.AppendLine("<tr><td colspan=\"3\" class=\"greyCell\" style=\"width: 100%; text-align: right; font-weight: bold;\">" + string.Format("Total Positive Score:   {0:0%}", totalPercent) + "</td></tr>");
                    sb.AppendLine("<tr><td colspan=\"3\" class=\"greyCell\" style=\"width: 100%; text-align: right; font-weight: bold;\">&nbsp;</td></tr>");
                    sb.AppendLine("<tr><td colspan=\"3\" class=\"greyCell\" style=\"width: 100%; text-align: right; font-weight: bold;\">" + string.Format("Total Possible Score:   {0:0}", totalPossibleScore) + "</td></tr>");
                    sb.AppendLine("<tr><td colspan=\"3\" class=\"greyCell\" style=\"width: 100%; text-align: right; font-weight: bold;\">" + string.Format("Total Points Achieved:   {0:0}", totalWeightScore) + "</td></tr>");
                    if (totalPossibleScore > 0)
                    {
                        totalPercent = totalWeightScore / totalPossibleScore;
                    }
                    else
                    {
                        totalPercent = 0;
                    }
                    sb.AppendLine("<tr><td colspan=\"3\" class=\"greyCell\" style=\"width: 100%; text-align: right; font-weight: bold;\">" + string.Format("Percentage of Points Achieved:   {0:0%}", totalPercent) + "</td></tr>");
                }
                sb.AppendLine("</table>");
            }

            litAuditDetails.Text = sb.ToString();
        }
Beispiel #23
0
        protected void Page_PreRender(object sender, EventArgs e)
        {
            bool createAuditAccess = SessionManager.CheckUserPrivilege(SysPriv.config, SysScope.audit);

            rbNew.Visible = createAuditAccess;


            if (IsPostBack)
            {
                //if (!uclAuditForm.IsEditContext)
                RadPersistenceManager1.StorageProviderKey = SessionManager.UserContext.Person.PERSON_ID.ToString();
                RadPersistenceManager1.SaveState();

                if (SessionManager.ReturnStatus == true)
                {
                    if (SessionManager.ReturnObject is string)
                    {
                        string type = SessionManager.ReturnObject as string;
                        switch (type)
                        {
                        case "DisplayAudits":
                            UpdateDisplayState(DisplayState.AuditList);
                            break;

                        case "Notification":
                            //UpdateDisplayState(DisplayState.AuditNotificationEdit);
                            //UpdateDisplayState(DisplayState.AuditReportEdit);
                            uclAuditForm.EditAuditId = SessionManager.ReturnRecordID;
                            // need to determine if the Audit is past due and force it into display mode (probelm when coming from Calendar)
                            string auditStatus = EHSAuditMgr.SelectAuditStatus(SessionManager.ReturnRecordID);
                            if (auditStatus == "C")
                            {
                                UpdateDisplayState(DisplayState.AuditNotificationDisplay);
                            }
                            else
                            {
                                UpdateDisplayState(DisplayState.AuditNotificationEdit);
                            }
                            if (isDirected)
                            {
                                rbNew.Visible = false;
                                uclAuditForm.EnableReturnButton(false);
                            }
                            break;

                        case "Closed":
                            uclAuditForm.EditAuditId = SessionManager.ReturnRecordID;
                            UpdateDisplayState(DisplayState.AuditNotificationClosed);
                            if (isDirected)
                            {
                                rbNew.Visible = false;
                                uclAuditForm.EnableReturnButton(false);
                            }
                            break;

                        case "DisplayOnly":
                            uclAuditForm.EditAuditId = SessionManager.ReturnRecordID;
                            UpdateDisplayState(DisplayState.AuditNotificationDisplay);
                            if (isDirected)
                            {
                                rbNew.Visible = false;
                                uclAuditForm.EnableReturnButton(false);
                            }
                            break;
                        }
                    }
                    SessionManager.ClearReturns();
                }
            }
            else
            {
                Ucl_DocMgr ucl = (Ucl_DocMgr)this.Master.FindControl("uclDocSelect");
                if (ucl != null)
                {
                    ucl.BindDocumentSelect("EHS", 2, true, true, "");
                }

                if (SessionManager.ReturnStatus == true && SessionManager.ReturnObject is string)
                {
                    try
                    {
                        // from inbox
                        DisplayNonPostback();
                        SessionManager.ReturnRecordID = Convert.ToDecimal(SessionManager.ReturnObject.ToString());
                        SessionManager.ReturnObject   = "Notification";
                        SessionManager.ReturnStatus   = true;
                        isDirected = true;

                        StringBuilder       sbScript = new StringBuilder();
                        ClientScriptManager cs       = Page.ClientScript;

                        sbScript.Append("<script language='JavaScript' type='text/javascript'>\n");
                        sbScript.Append("<!--\n");
                        sbScript.Append(cs.GetPostBackEventReference(this, "PBArg") + ";\n");
                        sbScript.Append("// -->\n");
                        sbScript.Append("</script>\n");

                        cs.RegisterStartupScript(this.GetType(), "AutoPostBackScript", sbScript.ToString());
                    }
                    catch
                    {
                        // not a number, parse as type
                        DisplayNonPostback();
                    }
                }
                else
                {
                    DisplayNonPostback();
                }
            }
            // for now, we will only let 'admin' create audits
            //if (!SessionManager.UserContext.Person.SSO_ID.ToLower().Equals("admin"))
            //	rbNew.Visible = false;
        }