Пример #1
0
        private bool RequestDemoKey()
        {
            DemoKeyRequest keyRequest = new DemoKeyRequest();

            keyRequest.Name    = Name.Text;
            keyRequest.Company = Company.Text;
            keyRequest.Email   = Email.Text;
            keyRequest.Phone   = Phone.Text;
            keyRequest.Host    = Request.Url.Host;
            keyRequest.Port    = Request.Url.Port;
            KeyReply keyReply = KeyService.RequestDemoKey(keyRequest);

            if (keyReply.Success)
            {
                // request succeeded, save new license to file
                string filePath = Server.MapPath("~/App_Data/CommerceBuilder.lic");
                File.WriteAllText(filePath, keyReply.LicenseKey);
                return(true);
            }
            else
            {
                HandleError(keyReply.Message);
                return(false);
            }
        }
Пример #2
0
        private bool RequestKey()
        {
            KeyReply keyReply = KeyService.RequestKey(LicenseKey.Text);

            if (keyReply.Success)
            {
                // request succeeded, save new license to file
                string filePath = Server.MapPath("~/App_Data/CommerceBuilder.lic");
                File.WriteAllText(filePath, keyReply.LicenseKey);
                return(true);
            }
            else
            {
                HandleError(keyReply.Message);
                return(false);
            }
        }
Пример #3
0
        protected void SaveButton_Click(object sender, EventArgs e)
        {
            KeyReply response = KeyService.RequestKey(LicenseKey.Text);

            if (response.Success)
            {
                File.WriteAllText(Server.MapPath("~/App_Data/CommerceBuilder.lic"), response.LicenseKey);

                // WE HAVE TO REFRESH THIS PAGE TO SHOW THE UPDATED LICENSE
                // THE TOKEN MUST BE RE-INITIALIZED TO DISPLAY THE NEW LICENSE DATA
                Session["StoreLicenseUpdated"] = true;
                Response.Redirect(Request.Url.ToString());
            }
            else
            {
                HandleError(response.Message);
            }
        }