private void B_SetKey_Click(object sender, EventArgs e) { Dialogs.PressKeyDialog dlg = new PressKeyDialog(); DialogResult res = dlg.ShowDialog(); if (res == DialogResult.OK) { this.ReturnKey = dlg.ReturnedKey; this.TB_Key.Text = ReturnKey.ToString(); } }
public void ShouldGetAndSeReturnKeytProperties() { var textBox = new TextBox(); const string defaultText = "Default Text"; var command = new MockCommand(); ReturnKey.SetCommand(textBox, command); Assert.AreEqual(command, ReturnKey.GetCommand(textBox)); ReturnKey.SetDefaultTextAfterCommandExecution(textBox, defaultText); Assert.AreEqual(defaultText, ReturnKey.GetDefaultTextAfterCommandExecution(textBox)); }
public ReturnKey Post([FromBody] Signin signin) { var rtnKey = new ReturnKey(); if (signin?.UserName != null && signin.Password != null) { var salt = (from i in _db.TbSubscriptions where string.Equals(i.Email, signin.UserName, StringComparison.CurrentCultureIgnoreCase) select i.Salt).FirstOrDefault(); var subscription = (from i in _db.TbSubscriptions where i.SubscriptionStatusId == 2 && i.Email == signin.UserName && i.Password == Security.EncryptPassword(signin.Password, salt) select i).FirstOrDefault(); if (subscription != null) { var token = (from i in _db.TbSubscriptionTokens where i.Email == subscription.Email && i.ExpiresOn > DateTime.Now select i).FirstOrDefault(); if (token == null) { double.TryParse(_configuration["Setting:AuthTokenExpiry"], out var authTokenExpiry); token = new TbSubscriptionTokens { Email = subscription.Email, AuthToken = Guid.NewGuid().ToString(), IssuedOn = DateTime.Now, ExpiresOn = DateTime.Now.AddSeconds(authTokenExpiry) }; _db.TbSubscriptionTokens.Add(token); _db.SaveChanges(); } rtnKey.UID = subscription.UniqueId.ToString(); rtnKey.AuthToken = token.AuthToken; rtnKey.Message = "success!!!"; rtnKey.Role = subscription.GroupId; } else { rtnKey.Message = _localizer["NotValid"]; } } else { rtnKey.Message = _localizer["NotValid"]; } return(rtnKey); }
public void ShouldThrowExceptionInSetDefaultTextAfterCommandExecutionIfTextboxIsNull() { ReturnKey.SetDefaultTextAfterCommandExecution(null, "Some Text"); }
public void ShouldThrowExceptionInGetDefaultTextAfterCommandExecutionIfTextboxIsNull() { ReturnKey.GetDefaultTextAfterCommandExecution(null); }
public void ShouldThrowExceptionInSetCommandIfTextboxIsNull() { ReturnKey.SetCommand(null, new MockCommand()); }
public void ShouldThrowExceptionInGetCommandIfTextboxIsNull() { ReturnKey.GetCommand(null); }