private void button1_Click(object sender, EventArgs e) { if ((logInUserText.Text != null && logInUserText.Text.Length > 0) && (loginPassText.Text != null && loginPassText.Text.Length > 0)) { LogInService log = new LogInService(); int result = log.LoginValidation(logInUserText.Text, loginPassText.Text); if (result == 1) { MessageBox.Show("Welcome " + logInUserText.Text); CurrentLog = logInUserText.Text; Form5 f5 = new Form5(); this.Hide(); f5.Show(); } else { MessageBox.Show("Invalid User."); } } else { MessageBox.Show("Please Fill all field."); } }
private void btnAdd_Click(object sender, EventArgs e) { try { using (LogInService service = new LogInService()) { LogIn logIn = new LogIn() { Login_id = this.LoginId, Pass_word = this.Password, User_name = this.UserName, Faculty_id = "B66750", Student_id = "J77896" }; service.CrateObject(logIn); MessageBox.Show(this, "Usuario Usuario Creado Conrrectamente", "CSE_DEPT", MessageBoxButtons.OK, MessageBoxIcon.Information); } } catch (Exception ex) { throw new Exception(ex.Message); } }
private static void Main(string[] args) { IUserService userService; DomainManager domainManager = new DomainManager(); InventoryContext context = new InventoryContext(); UserServiceProvider userServiceProvider = new UserServiceProvider(context, domainManager); LogInService logInService = new LogInService(domainManager, userServiceProvider); var responce = logInService.LogInWithPassword("AElmendo", "Drizzle123!", false, InventorySoftwareType.PRODUCTS_SALES); userService = responce.Service; ProductDataManager dataManager = new ProductDataManager(context, userService); ImportService importService = new ImportService(dataManager); Console.WriteLine("Starting Service"); importService.Load(); Console.WriteLine("Importing Data"); importService.ImportData(); importService.Parse(); Console.WriteLine("Import Finsihed"); Console.WriteLine("Create Lots"); var response = importService.Create(); Console.WriteLine("Should be finished. See results below:"); Console.WriteLine(response.Message); Console.ReadKey(); }
public void GePositionReturnsPosition() { DummyMockedLoginRepository _dummyMockedLoginRepository = new DummyMockedLoginRepository(); ILogInService _logInService = new LogInService(_dummyMockedLoginRepository._logInRepository); Assert.AreEqual("Admin", _logInService.GetPosition()); }
private bool ShowLogin() { //Startup Login LoginWindow loginWindow = new LoginWindow(); DomainManager domainManager = new DomainManager(); UserServiceProvider userServiceProvider = new UserServiceProvider(new InventoryContext(), domainManager); LogInService logInService = new LogInService(domainManager, userServiceProvider); var loginVM = new LoginViewModel(logInService); loginVM.LoginCompleted += (sender, args) => { if (loginVM.LoginResponce.Success) { this.userService = loginVM.LoginResponce.Service; DXSplashScreen.Show <SETSplashScreen>(); } loginWindow.Close(); }; loginWindow.DataContext = loginVM; if (DXSplashScreen.IsActive) { DXSplashScreen.Close(); } loginWindow.ShowDialog(); return(this.userService.IsValid()); }
private async void btnLogin_Click(object sender, EventArgs e) { panel3.Visible = false; List <string> lstInput = new List <string> { txtUsername.Text, txtPassword.Text }; if (Helper.ValidateTextFields(lstInput)) { LogInService _service = new LogInService(); var user = await _service.GetUserLoggedIn(txtUsername.Text, txtPassword.Text); if (user != null) { MessageBox.Show("Logged in."); } else { txtPassword.Text = ""; lblError.Text = "Invalid Username or Password"; panel3.Visible = true; } } else { lblError.Text = "Username and password are required"; panel3.Visible = true; } }
public void CreateNewPassThrowsException() { DummyMockedLoginRepository _dummyMockedLoginRepository = new DummyMockedLoginRepository(); ILogInService _logInService = new LogInService(_dummyMockedLoginRepository._logInRepository); Assert.Throws <LogInException>(() => _logInService.CreateNewPass("Wolf", "lucho22v.bg")); }
public ActionResult Login(LoginUser u, bool captchaValid) { if (ModelState.IsValid) { using (LogInService ls = new LogInService()) { User user = ls.Login(u.Username, u.Password); if (user != null) { String userType = ls.GetUserType(user.UserId); int id = user.UserId; Session["Id"] = id; Session["Username"] = user.Username; Session["UserType"] = userType; return(RedirectToAction("Index", "Home")); } else { ViewBag.LoginError = "Invalid username or password"; return(View(u)); } } } return(View(u)); }
public void SaveDataFromViewisSavingDataInModel() { LogInService _logInService = new LogInService(); _logInService.SaveDataFromView("Wolf", "1234"); Assert.AreEqual(_logInService.GetUser().userName, "Wolf"); Assert.AreEqual(_logInService.GetUser().password, "1234"); }
public void GetPasswordFromDBIsGettingPassword() { DummyMockedLoginRepository _dummyMockedLoginRepository = new DummyMockedLoginRepository(); ILogInService _logInService = new LogInService(_dummyMockedLoginRepository._logInRepository); _logInService.SaveDataFromView("Wolf", "1234"); Assert.AreEqual(_logInService.GetIDLoggedUser(), 1); }
public void CorrectLogInReturnsTrue() { DummyMockedLoginRepository _dummyMockedLoginRepository = new DummyMockedLoginRepository(); ILogInService _logInService = new LogInService(_dummyMockedLoginRepository._logInRepository); _logInService.SaveDataFromView("Wolf4", "1234"); Assert.IsTrue(_logInService.CorrectLogin()); }
public void CorrectLogInThrowsException() { DummyMockedLoginRepository _dummyMockedLoginRepository = new DummyMockedLoginRepository(); ILogInService _logInService = new LogInService(_dummyMockedLoginRepository._logInRepository); _logInService.SaveDataFromView("Wolf4", "123"); Assert.Throws <LogInException>(() => _logInService.CorrectLogin()); }
public void CreateNewPassCreates() { DummyMockedLoginRepository _dummyMockedLoginRepository = new DummyMockedLoginRepository(); ILogInService _logInService = new LogInService(_dummyMockedLoginRepository._logInRepository); _logInService.CreateNewPass("Wolf", "*****@*****.**"); Assert.AreNotEqual("1234", _dummyMockedLoginRepository._logInRepository.GetPasswordForUser("Wolf")); }
public int InsertIntoEntity(LogInService l) { LogMessage lm = new LogMessage(); lm.LogId = l.LogId; lm.ShareUserId = l.ShareUserId; lm.UserId = l.WriteUserId; lm.TimeStamp = l.TimeStamp; lm.State = 0; lm.IsRead = 0; context.LogMessages.Add(lm); context.SaveChanges(); return lm.Id; }
public int InsertIntoEntity(LogInService l) { LogMessage lm = new LogMessage(); lm.LogId = l.LogId; lm.ShareUserId = l.ShareUserId; lm.UserId = l.WriteUserId; lm.TimeStamp = l.TimeStamp; lm.State = 0; lm.IsRead = 0; context.LogMessages.Add(lm); context.SaveChanges(); return(lm.Id); }
private void LogIn(object?_) { var logInResult = LogInService.LogIn(MailAddress, Password); Password = ""; if (logInResult) { onLogInSucceededAsSubject.OnNext(Unit.Default); } else { onLogInFailedAsSubject.OnNext(Unit.Default); } }
public void TestInterface_Implementation() { // Assamble // Login types LogInToken logInToken = new LogInToken("token"); LogInBasicAuth logInBasicAuth = new LogInBasicAuth("user", "password"); // Login service that can go for either ways LogInService serviceToken = new LogInService(logInToken); LogInService serviceBasicAuth = new LogInService(logInBasicAuth); // Act serviceToken.LogIn(); serviceBasicAuth.LogIn(); // Assert Assert.AreEqual(serviceToken.IsLogged(), serviceBasicAuth.IsLogged()); }
private async Task LoggingInAsync(User user) { AccessToken = await LogInService.LogIn(user); if (AccessToken == "") { LoginSuccess = false; Password = ""; return; } var userService = new UserService(); LoggedInUser = await userService.GetUserByName(user.Username); LoginSuccess = true; NavigationService.Navigate(typeof(LoggedInPage), LoggedInUser); }
private void btnEntrar_Click(object sender, EventArgs e) { using (LogInService service = new LogInService()) { LogIn logIn = new LogIn() { Pass_word = this.Password, User_name = this.UserName }; // if (service.ValidaLogIn(logIn)) { FrmMenu frmMenu = new FrmMenu(); frmMenu.Show(); this.Hide(); } else { MessageBox.Show(this, "Usuario y Password Inconrrectas", "CSE_DEPT", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }
static void Main(string[] args) { while (true) { int chosenMenu; var registrationService = new RegistrationService(); var loginService = new LogInService(); var messanger = new ConsoleMessage(); Clear(); messanger.Send("1.Войти"); messanger.Send("2.Регистрация"); chosenMenu = ToInt32(ReadLine()); switch (chosenMenu) { case 1: messanger.Send("Введите email: "); var email = ReadLine(); messanger.Send("Введите пароль: "); var password = ReadLine(); if (loginService.LogIn(email, password)) { messanger.Send("Вы успешно авторизовались"); } else { messanger.Send("Вы ввели неверные данныe!"); } ReadLine(); break; case 2: Clear(); registrationService.Register(messanger); break; } } }
private void Window_Closed(object sender, EventArgs e) { LogInService.LogOut(); }
public LogInController(LogInService service) { login = service; }
public App(LogInService logInService, ControlService controlService, GpioService gpioService) { _logInService = logInService; _controlService = controlService; _gpioService = gpioService; }
/// <summary> /// Constructor for Homecontroller /// </summary> public HomeController() { eS = new EntertainmentService(); lis = new LogInService(); }
public LoginController(LogInService logInService) { this.logInService = logInService; }