protected void gridRegKeys_RowCommand(object sender, GridViewCommandEventArgs e) { GridViewRow gvr = this.gridRegKeys.Rows[Convert.ToInt32(e.CommandArgument)]; var hiddenID = gvr.FindControl("hiddenID") as HtmlInputHidden; RegistrationKeyController ctrlKey = new RegistrationKeyController(); RegistrationKey key = ctrlKey.Get(Int32.Parse(hiddenID.Value), _regID); switch (e.CommandName) { case "Delete": ctrlKey.Delete(key); break; case "Select": //gen key key.RegKey = ctrlKey.GenerateRegistrationKey(Settings["Seed"].ToString(), key, _regProduct); ctrlKey.Update(key); SendCustomerNotification(key.HostName, key.RegKey); RegistrationProductController ctrlProd = new RegistrationProductController(); _regProduct.Status = "Keys Generated"; ctrlProd.Update(_regProduct); Response.Redirect(EditUrl("RegID", _regID.ToString())); break; } }
protected void lbnApprove_Click(object sender, EventArgs e) { RegistrationProductController ctrlReg = new RegistrationProductController(); _regProduct.Approved = true; RegistrationKeyController ctrlKey = new RegistrationKeyController(); foreach (var key in ctrlKey.GetItems(_regProduct.ID)) { if (key.RegKey == null) { key.RegKey = ctrlKey.GenerateRegistrationKey(Settings["Seed"].ToString(), key, _regProduct); ctrlKey.Update(key); SendCustomerNotification(key.HostName, key.RegKey); _regProduct.Status = "Keys Generated"; } } ctrlReg.Update(_regProduct); Response.Redirect(EditUrl("RegID", _regID.ToString(), "Edit", "Success=Existing key requests have been processed and future requests will be processed automatically" )); }
protected void lbnUpdateTotal_Click(object sender, EventArgs e) { RegistrationProductController ctrlReg = new RegistrationProductController(); _regProduct.TotalKeys = Int32.Parse(txtNewTotal.Text); ctrlReg.Update(_regProduct); Response.Redirect(EditUrl("RegID", _regID.ToString())); }
protected void lbnAddHostName_Click(object sender, EventArgs e) { if (txtAddHostName.Text == "") { Response.Redirect(EditUrl("RegID", _regID.ToString(), "Edit", "Error=Site Alias is required.")); } RegistrationKeyController ctrlKey = new RegistrationKeyController(); RegistrationKey key = new RegistrationKey(); key.HostName = txtAddHostName.Text; key.LastUpdateDate = System.DateTime.Now; key.LastUpdateUserID = UserId; key.LastUpdateUserName = UserInfo.DisplayName; key.RegistrationProductID = _regID; ctrlKey.Create(key); string strMessage; //auto gen key if (_regProduct.Approved) { key.RegKey = ctrlKey.GenerateRegistrationKey(Settings["Seed"].ToString(), key, _regProduct); ctrlKey.Update(key); strMessage = "Success=New site alias requested and registration key generated!"; SendCustomerNotification(key.HostName, key.RegKey); _regProduct.Status = "Keys Generated"; } else { //TODO send notification to admin strMessage = "Message=New site alias requested and sent for approval. You will receive an email notification when the key is generated."; SendAdminNotification(key.ID, key.HostName); _regProduct.Status = "Key Requested"; } RegistrationProductController ctrlProd = new RegistrationProductController(); ctrlProd.Update(_regProduct); txtAddHostName.Text = ""; Response.Redirect(EditUrl("RegID", _regID.ToString(), "Edit", strMessage)); }