Example #1
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="session">The current session</param>
 /// <param name="mediaTypeId">The media type that is being handled</param>
 /// <param name="mediaIdContainer">Container for storing the new media ID</param>
 public FrmMediaAdd(SessionInfo session, int mediaTypeId, GenericIntItem mediaIdContainer)
     : this()
 {
     this.session = session;
     this.mediaTypeId = mediaTypeId;
     this.mediaIdContainer = mediaIdContainer;
 }
        ///// <summary>
        ///// Event raiser, when customer has been selected
        ///// </summary>
        //protected virtual void RaiseCustomerSelectedEvent(int mediaId)
        //{
        //    // Raise the event by using the () operator.
        //    if (MediaSelected != null)
        //    {
        //        MediaSelected(this, mediaId);
        //    }
        //}

        /// <summary>
        /// Shows dialog to add a new media to the database
        /// </summary>
        protected int AddNewMedia()
        {
            if (this.session != null)
            {
                GenericIntItem mediaIdContainer = new GenericIntItem(0);

                FrmMediaAdd frmMediaAdd = new FrmMediaAdd(this.session, this.mediaTypeId, mediaIdContainer);
                frmMediaAdd.Owner = this;

                if (frmMediaAdd.ShowDialog(this) == DialogResult.OK)
                {
                    return mediaIdContainer.IntVal;
                }
            }

            return -1;
        }