private void OnTextUpdate(string cmd)
        {
            // update the page
            List <MediaVideoData> videos = MediaVideoMgr.SelectVideoDataById(entities, EditVideoId);

            if (videos != null)
            {
                MediaVideoData videoData = videos[0];
                GetAttachments(EditVideoId, (int)MediaAttachmentType.Text, videoData.VideoTextList.Count);
                if (videoData.Video.TEXT_ADDED || videoData.VideoTextList.Count > 0)
                {
                    cbVideoText.Checked = true;
                    //dvText.Visible = true;
                    dvText.Style.Add("display", "block");
                }
                else
                {
                    cbVideoText.Checked = false;
                    //dvText.Visible = false;
                    dvText.Style.Add("display", "none");
                }
            }
        }
Example #2
0
        protected void rgVideoList_ItemDataBound(object sender, GridItemEventArgs e)
        {
            if (e.Item is GridDataItem)
            {
                GridDataItem item = (GridDataItem)e.Item;
                HiddenField  hf;
                Label        lbl;

                MediaVideoData data = (MediaVideoData)e.Item.DataItem;

                LinkButton lnk = (LinkButton)e.Item.FindControl("lbVideoId");
                lnk.Text            = WebSiteCommon.FormatID(data.Video.VIDEO_ID, 6);
                lnk.CommandArgument = data.Video.VIDEO_ID.ToString();
                //if (SessionManager.UserContext.Person.PERSON_ID == data.Person.PERSON_ID)
                //	lnk.CommandArgument = data.Video.VIDEO_ID.ToString() + "~" + data.Status;
                //else if (!data.Status.Equals("C"))
                //	lnk.CommandArgument = data.Audit.AUDIT_ID.ToString() + "~D";
                //else
                //	lnk.CommandArgument = data.Audit.AUDIT_ID.ToString() + "~C";

                RadButton rlnk = (RadButton)e.Item.FindControl("lbnDelete");
                if (data.Video.SOURCE_TYPE == (int)TaskRecordType.Audit || data.Video.SOURCE_TYPE == (int)TaskRecordType.HealthSafetyIncident)
                {
                    rlnk.Visible = false;
                }
                else
                {
                    rlnk.Visible = true;
                }

                if (data.Video.TITLE.Length > 120)
                {
                    lbl      = (Label)e.Item.FindControl("lblVideoTitle");
                    lbl.Text = data.Video.TITLE.Substring(0, 117) + "...";
                }

                if (data.Person != null)
                {
                    lbl      = (Label)e.Item.FindControl("lblVideoBy");
                    lbl.Text = SQMModelMgr.FormatPersonListItem(data.Person);
                }

                lbl = (Label)e.Item.FindControl("lblVideoStatus");                 // what to do with this?
                try
                {
                    lbl.Text = SQMBasePage.GetXLAT(listXLAT, "MEDIA_VIDEO_STATUS", data.Video.VIDEO_STATUS).DESCRIPTION;
                }
                catch { }

                //if (data.Video.VIDEO_STATUS == "C")
                //{
                //	DateTime clsDate = (DateTime)data.Audit.CLOSE_DATE_DATA_COMPLETE;
                //	lbl.Text = WebSiteCommon.GetXlatValue("auditStatus", "C") + " " + SQMBasePage.FormatDate(clsDate, "d", false);
                //}
                //else
                //{
                //	if (data.DaysToClose == 0)
                //	{
                //		DateTime tmp = ((DateTime)data.Audit.AUDIT_DT).AddDays(data.AuditType.DAYS_TO_COMPLETE);
                //		lbl.Text = WebSiteCommon.GetXlatValue("auditStatus", "X") + "<br/>(" + SQMBasePage.FormatDate(tmp, "d", false) + ")";
                //	}
                //	else if (data.Audit.PERCENT_COMPLETE > 0)
                //		lbl.Text = WebSiteCommon.GetXlatValue("auditStatus", "I") + "<br/>(" + data.DaysToClose + ")";
                //	else
                //		lbl.Text = WebSiteCommon.GetXlatValue("auditStatus", "A") + "<br/>(" + data.DaysToClose + ")";
                //}
            }
        }
        public void LoadVideoInformation()
        {
            // populate all the fields
            List <XLAT> listXLAT = SQMBasePage.SelectXLATList(new string[5] {
                "INJURY_PART", "INJURY_TYPE", "MEDIA_VIDEO_SOURCE", "MEDIA_VIDEO_STATUS", "MEDIA_VIDEO_TYPE"
            }, 1);
            List <MediaVideoData> videos = MediaVideoMgr.SelectVideoDataById(entities, EditVideoId);

            if (videos != null)
            {
                MediaVideoData   videoData = videos[0];
                BusinessLocation location  = new BusinessLocation().Initialize((decimal)videoData.Video.PLANT_ID);
                lblVideoSourceType.Text = ((TaskRecordType)videoData.Video.SOURCE_TYPE).ToString();
                if ((TaskRecordType)videoData.Video.SOURCE_TYPE != TaskRecordType.Media)
                {
                    lblVideoSourceType.Text += " " + videoData.Video.SOURCE_ID;
                }
                lblVideoLocation.Text   = location.Plant.PLANT_NAME + " " + location.BusinessOrg.ORG_NAME;
                lblVideoPersonName.Text = videoData.Person.LAST_NAME + ", " + videoData.Person.FIRST_NAME;
                DateTime dt = (DateTime)videoData.Video.VIDEO_DT;
                lblVideoDate.Text = dt.ToString("MM/dd/yyyy");
                dt = (DateTime)videoData.Video.INCIDENT_DT;
                lblVideoIncidentDate.Text = dt.ToString("MM/dd/yyyy");
                lblVideoInjuryType.Text   = SQMBasePage.GetXLAT(listXLAT, "INJURY_TYPE", videoData.Video.INJURY_TYPES).DESCRIPTION;           // for now we assume only one
                lblVideoBodyPart.Text     = SQMBasePage.GetXLAT(listXLAT, "INJURY_PART", videoData.Video.BODY_PARTS).DESCRIPTION;             // for now we assume only one

                tbTitle.Text       = videoData.Video.TITLE;
                tbDescription.Text = videoData.Video.DESCRIPTION;
                if (ddlVideoType.Items.Count == 0)
                {
                    PopulateVideoTypeDropDown();
                }
                if (videoData.Video.VIDEO_TYPE == null)
                {
                    ddlVideoType.SelectedValue = "";
                }
                else
                {
                    ddlVideoType.SelectedValue = videoData.Video.VIDEO_TYPE;
                }
                if (videoData.Video.VIDEO_AVAILABILITY == null)
                {
                    ddlAvailability.SelectedIndex = 0;
                }
                else
                {
                    ddlAvailability.SelectedValue = videoData.Video.VIDEO_AVAILABILITY;
                }
                litVideoDownloadLink.Text = "<a href='/Shared/FileHandler.ashx?DOC=v&DOC_ID=" + EditVideoId + "&FILE_NAME=" + videoData.Video.FILE_NAME + "' target='_blank'>" + Resources.LocalizedText.VideoDownload + "</a>";
                litVideoViewLink.Text     = "<a href='/Shared/VideoHandler.aspx?DOC=v&DOC_ID=" + EditVideoId + "' target='_blank'>" + Resources.LocalizedText.VideoView + "</a>";
                rcbStatusSelect           = SQMBasePage.SetComboBoxItemsFromXLAT(rcbStatusSelect, listXLAT.Where(l => l.XLAT_GROUP == "MEDIA_VIDEO_STATUS" && l.STATUS == "A").OrderBy(h => h.SORT_ORDER).ToList(), "SHORT");
                rcbStatusSelect.Items.Insert(0, new RadComboBoxItem("Select a status", ""));
                rcbStatusSelect.SelectedValue = videoData.Video.VIDEO_STATUS;
                cbVideoText.Checked           = videoData.Video.SPEAKER_AUDIO;

                // populate release form list
                if (videoData.Video.RELEASE_REQUIRED)
                {
                    cbReleaseForms.Checked = true;
                    //dvAttach.Visible = true;
                    dvAttach.Style.Add("display", "block");
                    // get the new async working
                    GetAttachments(EditVideoId, (int)MediaAttachmentType.ReleaseForm, videoData.ReleaseFormList.Count);
                }
                else
                {
                    cbReleaseForms.Checked = false;
                    //dvAttach.Visible = false;
                    dvAttach.Style.Add("display", "none");
                }
                uploadReleases.SetViewMode(true);
                // populate text list
                GetAttachments(EditVideoId, (int)MediaAttachmentType.Text, videoData.VideoTextList.Count);
                if (videoData.Video.TEXT_ADDED || videoData.VideoTextList.Count > 0)
                {
                    cbVideoText.Checked = true;
                    //dvText.Visible = true;
                    dvText.Style.Add("display", "block");
                }
                else
                {
                    cbVideoText.Checked = false;
                    //dvText.Visible = false;
                    dvText.Style.Add("display", "none");
                }

                pnlAddEdit.Visible     = true;
                pnlVideoHeader.Visible = true;
                divVideoForm.Visible   = true;

                if (videoData.Video.SOURCE_TYPE == (int)TaskRecordType.Audit || videoData.Video.SOURCE_TYPE == (int)TaskRecordType.HealthSafetyIncident)
                {
                    btnDelete.Visible = false;
                }
                else
                {
                    btnDelete.Visible = true;
                }

                // if not edit mode, all fields are display only
                if (!IsEditContext)
                {
                    tbTitle.Enabled         = false;
                    tbDescription.Enabled   = false;
                    ddlAvailability.Enabled = false;
                    ddlVideoType.Enabled    = false;
                    cbReleaseForms.Enabled  = false;
                    cbVideoText.Enabled     = false;
                    cbSpeakerAudio.Enabled  = false;
                }
            }
        }