protected void Page_Load(object sender, EventArgs e) {

			try {
				//get the current item and database
				currentDB = Sitecore.Configuration.Factory.GetDatabase("master");
				currentItem = new PlaylistItem(currentDB.Items[HttpContext.Current.Request.QueryString["id"].ToString()]);
				Item acct = currentItem.playlistItem.Parent.Parent;
				//if current parent isn't the account then it's the parent of the folder
				if (!acct.TemplateName.Equals("Account Folder")) {
					acct = acct.Parent;
				}
				accountItem = new AccountItem(acct.ID, acct.InnerData, acct.Database);
				bc = new BCAPI(accountItem.PublisherID);
				
				if (!IsPostBack) {
					loadFormWithCurrentValues();

					//load non-editable information
					ltlPlaylistID.Text = currentItem.PlaylistID.ToString();
					ltlVideos.Text = currentItem.VideoIds.Count.ToString(); 
					ltlAccount.Text = currentItem.AccountId.ToString();
				}
			}
			catch (Exception ex) {
				ltlError.Text = ex.ToString();
			}
		}
		protected void Page_Load(object sender, EventArgs e) {

			//available querystring values for context info (id, language, version, database)

			try {
				//get the current item and database
				currentDB = Sitecore.Configuration.Factory.GetDatabase("master");
				currentItem = new VideoItem(currentDB.Items[HttpContext.Current.Request.QueryString["id"].ToString()]);
				Item acct = currentItem.videoItem.Parent.Parent;
				//if current parent isn't the account then it's the parent of the folder
				if (!acct.TemplateName.Equals("Account Folder")) {
					acct = acct.Parent;
				}
				accountItem = new AccountItem(acct.ID, acct.InnerData, acct.Database);
				bc = new BCAPI(accountItem.PublisherID);

				if (!currentItem.ThumbnailURL.Equals("")) {
					pnlThumb.Visible = true;
					imgThumb.ImageUrl = currentItem.ThumbnailURL;
				}
				if (!currentItem.VideoStillURL.Equals("")) {
					pnlStill.Visible = true;
					imgStill.ImageUrl = currentItem.VideoStillURL;
				}
			}
			catch (Exception ex) {
				ltlError.Text = ex.ToString();
			}
		}
Ejemplo n.º 3
0
		protected void Page_Load(object sender, EventArgs e) {
			
			//available querystring values for context info (id, language, version, database)

			try {
				//get the current item and database
				currentDB = Sitecore.Configuration.Factory.GetDatabase("master");
				currentItem = new VideoItem(currentDB.Items[HttpContext.Current.Request.QueryString["id"].ToString()]);
				Item acct = currentItem.videoItem.Parent.Parent;
				//if current parent isn't the account then it's the parent of the folder
				if (!acct.TemplateName.Equals("Account Folder")) {
					acct = acct.Parent;
				}
				accountItem = new AccountItem(acct.ID, acct.InnerData, acct.Database);
				bc = new BCAPI(accountItem.PublisherID);
				
				//set the form values for the video
				if (!IsPostBack) {
					loadFormWithCurrentValues();
				}

				//show the video id
				ltlVideoID.Text = currentItem.VideoID.ToString();
				
				//show the video upload status
				RPCResponse<UploadStatusEnum> rpcr = bc.GetUploadStatus(currentItem.VideoID);
				ltlStatus.Text = rpcr.result.ToString();

				ltlCreation.Text = currentItem.CreationDate.ToString("MMMM d, yyyy");
				ltlModified.Text = currentItem.LastModifiedDate.ToString("MMMM d, yyyy");
				ltlPublished.Text = currentItem.PublishedDate.ToString("MMMM d, yyyy");
				try {
					long milliseconds = currentItem.Length;
					string lengthText = "";
					long hours = (milliseconds / 60000000);
					if (hours >= 1) {
						milliseconds -= hours * 60000000;
						lengthText += hours + " hours, ";
					}
					long mins = (milliseconds / 60000);
					if (mins >= 1) {
						milliseconds -= mins * 60000;
						lengthText += mins + " minutes, ";
					}
					long secs = (milliseconds / 1000);
					if (secs >= 1) {
						milliseconds -= secs * 1000;
						lengthText += secs + " seconds";
					}
					ltlLength.Text = lengthText;
				}
				catch(Exception ex){
				}
				ltlPlays.Text = currentItem.PlaysTotal.ToString();
				ltlPlaysTrailing.Text = currentItem.PlaysTrailingWeek.ToString();
			}
			catch (Exception ex) {
				ltlError.Text = ex.ToString();
			}
		}
		protected void Page_Load(object sender, EventArgs e) {

			//available querystring values for context info (id, language, version, database)

			try {
				//get the current item and database
				currentDB = Sitecore.Configuration.Factory.GetDatabase("master");
				currentItem = new PlayerItem(currentDB.Items[HttpContext.Current.Request.QueryString["id"].ToString()]);
				Item acct = currentItem.playerItem.Parent.Parent;
				//if current parent isn't the account then it's the parent of the folder
				if (!acct.TemplateName.Equals("Account Folder")) {
					acct = acct.Parent;
				}
				accountItem = new AccountItem(acct.ID, acct.InnerData, acct.Database);
				bc = new BCAPI(accountItem.PublisherID);
				
				//populate drop down
				if (!IsPostBack) {
					foreach (Item itm in accountItem.Parent.ChildByTemplateAndName("Settings Folder", "Settings").ChildByTemplateAndName("Enum", "WMode").GetChildren()) {
						ddlWMode.Items.Add(new ListItem(itm.DisplayName, itm.DisplayName));
					}
					//fill player drop down
					foreach (VideoItem vp in accountItem.VideoLib.Videos) {
						ddlVideo.Items.Add(new ListItem(vp.VideoName, vp.videoItem.ID.ToString()));
					}
					//fill playlist drop down
					foreach (PlaylistItem pl in accountItem.PlaylistLib.Playlists) {
						cblPlaylist.Items.Add(new ListItem(pl.PlaylistName, pl.playlistItem.ID.ToString()));
					}
					if (!currentItem.PlaylistType.Equals(PlayerPlaylistType.None) && cblPlaylist.Items.Count > 0) {
						cblPlaylist.SelectedIndex = 0;
					}

					//set the initial player up
					if (ddlVideo.Items.Count > 0) {
						SetVideoPlayer();
					}
					else {
						ltlMessage.Text = "To use the preview section you must have already defined at least one player";
					}
				}
			}
			catch(Exception ex){
				ltlError.Text = ex.ToString();
			}
		}
		protected void Page_Load(object sender, EventArgs e) {
			
			try {
				//get the current item and database
				currentDB = Sitecore.Configuration.Factory.GetDatabase("master");
				currentItem = currentDB.Items[HttpContext.Current.Request.QueryString["id"].ToString()];
				accountItem = new AccountItem(currentItem.ID, currentItem.InnerData, currentItem.Database);
				bc = new BCAPI(accountItem.PublisherID);
							
				//display the current video and playlist count
				ltlTotalPlaylists.Text = accountItem.PlaylistLib.Playlists.Count.ToString();
				ltlTotalVideos.Text = accountItem.VideoLib.Videos.Count.ToString();
			}
			catch(Exception ex){
				ltlError.Text = "There was an error loading this page. You probably need to set the publisher Id<br/><br/>";
				ltlError.Text += ex.ToString();
			}
		}
		protected void Page_Load(object sender, EventArgs e) {

			//available querystring values for context info (id, language, version, database)
			//disabling this for now
			pnlUpload.Visible = false;
			try {
				//get the current item and database
				currentDB = Sitecore.Configuration.Factory.GetDatabase("master");
				currentItem = currentDB.Items[HttpContext.Current.Request.QueryString["id"].ToString()];
				accountItem = new AccountItem(currentItem.Parent.ID, currentItem.Parent.InnerData, currentItem.Parent.Database);
				bc = new BCAPI(accountItem.PublisherID);
				
				//display the current video and playlist count
				ltlTotalVideos.Text = accountItem.VideoLib.Videos.Count.ToString();
			}
			catch (Exception ex) {
				ltlError.Text = ex.ToString();
			}
		}