Пример #1
0
 /// <summary>
 /// Binds the controls.
 /// </summary>
 private void BindControls()
 {
     lblHostID.Text = String.Format("Host ID: {0}", CommerceLicensing.GetHostUid());
     CommerceLicenseInfo[] licenseInfo = CommerceLicensing.GetLicenseInfo(); // do not use cache here
     dlLicenseList.DataSource = licenseInfo;
     dlLicenseList.DataBind();
 }
Пример #2
0
        /// <summary>
        /// Handles the ServerClick event of the btnUpload control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        protected void btnUpload_ServerClick(object sender, EventArgs e)
        {
            Encoding encoding = Encoding.UTF8;

            McHttpPostedFile file = mcHtmlInputFile.PostedFile;

            if (file != null)
            {
                byte[] data = new Byte[file.ContentLength];
                file.InputStream.Read(data, 0, file.ContentLength);
                CommerceLicensing.SetLicense(encoding.GetString(data));
                BindControls();
            }
        }
Пример #3
0
        /// <summary>
        /// Handles the Click event of the btnDownloadLicense control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        protected void btnDownloadLicense_Click(object sender, EventArgs e)
        {
            if (!String.IsNullOrEmpty(tbLicenseKey.Text))
            {
                string errorMessage = String.Empty;

                CommerceLicensing.InstallLicense(tbLicenseKey.Text, out errorMessage);

                if (!String.IsNullOrEmpty(errorMessage))
                {
                    this.DisplayErrorMessage(errorMessage);
                }

                tbLicenseKey.Text = String.Empty;
            }
            BindControls();
        }
Пример #4
0
        /// <summary>
        /// Handles the Load event of the Page control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        protected void Page_Load(object sender, EventArgs e)
        {
            LicenseManager.Validate(typeof(Mediachase.MetaDataPlus.MetaObject), null);

            Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "UpTemplate_SetPageTitle", String.Format("CSManagementClient.PageTitleControlId = '{0}';", this.lblPageTitle.ClientID), true);

            string userName = String.Empty;

            if (HttpContext.Current.User != null && HttpContext.Current.User.Identity.IsAuthenticated)
            {
                ProfileContext context = FrameworkContext.Current.Profile;
                if (context != null && context.Profile != null && context.Profile.Account != null)
                {
                    userName = context.Profile.Account.Name;
                }

                if (String.IsNullOrEmpty(userName))
                {
                    userName = HttpContext.Current.User.Identity.Name;                 //FrameworkContext.Current.Profile;
                }
                lblUser.Text = String.Format("{0}, {1}", RM.GetString("UPTEMPLATE_WELCOME"), userName);
            }
            else
            {
                lblUser.Text = String.Empty;
            }


            lblUser.EnableViewState = false;

            // Remove any cached info
            CommerceLicenseInfo[] licenseInfo = CommerceLicensing.GetLicenseInfo();
            if (licenseInfo == null || licenseInfo.Length == 0)
            {
                lblLicenseInfo.Text      = "unlicensed version";
                lblLicenseInfo.ForeColor = Color.Red;
                lblLicenseInfo.Font.Bold = true;
            }
            else
            {
                lblLicenseInfo.Text = String.Format("{0} ({1})", licenseInfo[0].Edition, licenseInfo[0].Company);
            }
        }
Пример #5
0
 /// <summary>
 /// Handles the Click event of the DeleteLicense control.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">The <see cref="System.Web.UI.ImageClickEventArgs"/> instance containing the event data.</param>
 protected void DeleteLicense_Click(object sender, ImageClickEventArgs e)
 {
     CommerceLicensing.RemoveLicense(((ImageButton)sender).CommandArgument);
     BindControls();
 }