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
            }
        }
Ejemplo n.º 2
0
        protected void Save(bool shouldReturn)
        {
            VIDEO   theVideo = null;
            decimal videoId  = 0;
            string  result   = "<h3>EHS Assessment " + ((IsEditContext) ? "Updated" : "Created") + ":</h3>";

            // Edit context
            videoId = EditVideoId;
            if (videoId > 0)
            {
                theVideo = UpdateVideo(videoId);
                SaveAttachments(videoId);
            }


            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;
            }
            else
            {
                EditVideoId = videoId;
                SessionManager.ReturnRecordID = videoId;
                CurrentStep   = 0;
                IsEditContext = true;
                Visible       = true;

                // and send a message that the field need to be entered
                string script = string.Format("alert('{0}');", Resources.LocalizedText.AssessmentRequiredsIndicatedMsg);
                ScriptManager.RegisterClientScriptBlock(this.Page, this.Page.GetType(), "alert", script, true);
            }

            if (shouldReturn)
            {
                SessionManager.ReturnStatus = false;
                SessionManager.ReturnObject = "DisplayVideos";
                Response.Redirect("/Media/Media_Videos.aspx");
            }
        }