Esempio n. 1
0
        protected void lbnOK_Click(object sender, EventArgs e)
        {
            ClientRegistrationKeyController ctrl = new ClientRegistrationKeyController();
            ClientRegistrationKey key;
            if (_keyID == -1)
            {
                key = new ClientRegistrationKey();
            }
            else
            {
                key = ctrl.Get(_keyID, 0);
            }

            key.Notes = txtNotes.Text;
            key.RegKey = txtKey.Text;

            if (_keyID == -1)
            {
                ctrl.Create(key);
            }
            else
            {
                ctrl.Update(key);
            }

            Response.Redirect(Globals.NavigateURL());
        }
Esempio n. 2
0
        public static RegistrationClientAPIResult IsRegistered(string SiteAlias, string ProductName, string DeveloperSeed)
        {
            try
            {
                //check for null values
                if (SiteAlias == null || ProductName == null || DeveloperSeed == null)
                    return RegistrationClientAPIResult.NotRegistered;

                //check for localhost
                if (SiteAlias.Substring(0,9).Equals("localhost", StringComparison.InvariantCultureIgnoreCase))
                {
                    return RegistrationClientAPIResult.Localhost;
                }

                //generate hash
                string strGenRegKey = GenerateRegistrationKey(DeveloperSeed, SiteAlias, ProductName);

                //find hash in key list
                ClientRegistrationKeyController ctrl = new ClientRegistrationKeyController();
                ClientRegistrationKey key = ctrl.GetKeyByHash(strGenRegKey);

                //return result
                if (key != null)
                {
                    key.LastUsed = System.DateTime.Now.ToString();
                    ctrl.Update(key);
                    return RegistrationClientAPIResult.Registered;
                }
                else
                {
                    return RegistrationClientAPIResult.NotRegistered;
                }
            }
            catch (Exception ex)
            {
                return RegistrationClientAPIResult.Error;
            }
        }