Пример #1
0
        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.");
            }
        }
Пример #2
0
        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);
            }
        }
Пример #3
0
        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();
        }
Пример #4
0
        public void GePositionReturnsPosition()
        {
            DummyMockedLoginRepository _dummyMockedLoginRepository = new DummyMockedLoginRepository();
            ILogInService _logInService = new LogInService(_dummyMockedLoginRepository._logInRepository);

            Assert.AreEqual("Admin", _logInService.GetPosition());
        }
Пример #5
0
        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());
        }
Пример #6
0
        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;
            }
        }
Пример #7
0
        public void CreateNewPassThrowsException()
        {
            DummyMockedLoginRepository _dummyMockedLoginRepository = new DummyMockedLoginRepository();
            ILogInService _logInService = new LogInService(_dummyMockedLoginRepository._logInRepository);

            Assert.Throws <LogInException>(() => _logInService.CreateNewPass("Wolf", "lucho22v.bg"));
        }
Пример #8
0
 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));
 }
Пример #9
0
        public void SaveDataFromViewisSavingDataInModel()
        {
            LogInService _logInService = new LogInService();

            _logInService.SaveDataFromView("Wolf", "1234");
            Assert.AreEqual(_logInService.GetUser().userName, "Wolf");
            Assert.AreEqual(_logInService.GetUser().password, "1234");
        }
Пример #10
0
        public void GetPasswordFromDBIsGettingPassword()
        {
            DummyMockedLoginRepository _dummyMockedLoginRepository = new DummyMockedLoginRepository();
            ILogInService _logInService = new LogInService(_dummyMockedLoginRepository._logInRepository);

            _logInService.SaveDataFromView("Wolf", "1234");
            Assert.AreEqual(_logInService.GetIDLoggedUser(), 1);
        }
Пример #11
0
        public void CorrectLogInReturnsTrue()
        {
            DummyMockedLoginRepository _dummyMockedLoginRepository = new DummyMockedLoginRepository();
            ILogInService _logInService = new LogInService(_dummyMockedLoginRepository._logInRepository);

            _logInService.SaveDataFromView("Wolf4", "1234");
            Assert.IsTrue(_logInService.CorrectLogin());
        }
Пример #12
0
        public void CorrectLogInThrowsException()
        {
            DummyMockedLoginRepository _dummyMockedLoginRepository = new DummyMockedLoginRepository();
            ILogInService _logInService = new LogInService(_dummyMockedLoginRepository._logInRepository);

            _logInService.SaveDataFromView("Wolf4", "123");
            Assert.Throws <LogInException>(() => _logInService.CorrectLogin());
        }
Пример #13
0
        public void CreateNewPassCreates()
        {
            DummyMockedLoginRepository _dummyMockedLoginRepository = new DummyMockedLoginRepository();
            ILogInService _logInService = new LogInService(_dummyMockedLoginRepository._logInRepository);

            _logInService.CreateNewPass("Wolf", "*****@*****.**");

            Assert.AreNotEqual("1234", _dummyMockedLoginRepository._logInRepository.GetPasswordForUser("Wolf"));
        }
Пример #14
0
        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;
        }
Пример #15
0
        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);
        }
Пример #16
0
        private void LogIn(object?_)
        {
            var logInResult = LogInService.LogIn(MailAddress, Password);

            Password = "";

            if (logInResult)
            {
                onLogInSucceededAsSubject.OnNext(Unit.Default);
            }
            else
            {
                onLogInFailedAsSubject.OnNext(Unit.Default);
            }
        }
Пример #17
0
        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());
        }
Пример #18
0
        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);
        }
Пример #19
0
 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);
         }
     }
 }
Пример #20
0
        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();
 }
Пример #22
0
 public LogInController(LogInService service)
 {
     login = service;
 }
 public App(LogInService logInService, ControlService controlService, GpioService gpioService)
 {
     _logInService   = logInService;
     _controlService = controlService;
     _gpioService    = gpioService;
 }
Пример #24
0
 /// <summary>
 /// Constructor for Homecontroller
 /// </summary>
 public HomeController()
 {
     eS  = new EntertainmentService();
     lis = new LogInService();
 }
Пример #25
0
 public LoginController(LogInService logInService)
 {
     this.logInService = logInService;
 }