private async void LoginWithFacebook() { try { var result = await LoginUserService.LoginWithFacebookAsync(); if (result == null) { throw new LoginException("Failed to Login in with Facebook"); } string username = await GetUsernameService.GetUsernameAsync(result.UserId); if (string.IsNullOrEmpty(username)) { await Navigation.PushAsync(new EnterUsernamePage(result)); return; } result.Username = username; SaveUserSecurityService.SaveUser(result); MessageBus.Publish(new LoginCompleteMessage()); await Navigation.PushModalAsync(new ScorePredictNavigationPage(new MainPage())); } catch (LoginException lex) { DialogService.Alert(lex.Message); } catch (Exception ex) { DialogService.Alert("Login Failed. Please try again."); } }
public ActionResult LoginCheck(LoginCheckDTO login) { LoginUserService userService = new LoginUserService(); LoginUser user = userService.CheckLogin(login.UserName, login.Password); if (user == null) { return(RedirectToAction("Login", "Home")); } else { Session[KeyManager.LoginSessionKey] = user;//Session dolu gidiyor.. return(RedirectToAction("Index1", "Home")); } }
private async void Button1_Click(object sender, EventArgs e) { var user1 = new User { DateOfBirth = new DateTime(1999, 4, 24), Email = "*****@*****.**", FirstName = "luka", Language = "kartuli", LastName = "nikoleishvili", Mobile = "+995577607123", Password = "******", PrivateID = "01001095795", RegistrarionIP = "1231.34235.231423", RegistrationDate = DateTime.Now, Resident = "borjomi", UserAddress = new Address { Addres1 = "gldani", Address2 = "zestafoni", City = "tbilisi", Country = "gori", Region = "cxinvali", } }; var repo = Repository.Layer.Repository.GetRepositoryInstance; var val = Validation.GetRepositoryInstance; var regi = new RegistreUserService(); await regi.RegistrationUserAsync(repo, user1, val); var ageVl = val.IsAgeValid(53); Dictionary <string, string> dict = new Dictionary <string, string>(); dict.Add("FirstName", "jora"); dict.Add("Mobile", "+995593724547"); EditUserInformatinService editUserInformatinService = new EditUserInformatinService(); editUserInformatinService.EditInformationService(1, dict, repo); LoginUserService loginUserService = new LoginUserService(); var logined = await loginUserService.LoginUserInSystemAsync("Gop143", "*****@*****.**", repo); //Repository.Layer.Repository.GetRepositoryInstance.EditUserInformation(1, dict); }
public DemoDataHelper() { Container = new UnityContainer(); Container.RegisterType <ICommonLog, UnitTestLog>(); var risProConnectionString = ConfigurationManager.ConnectionStrings["RisProContext"].ConnectionString; var consultationConnectionString = ConfigurationManager.ConnectionStrings["ConsultationContext"].ConnectionString; Container.RegisterType <IRisProContext, RisProContext>(new InjectionConstructor(risProConnectionString, Container.Resolve <ICommonLog>())); Container.RegisterType <IConsultationContext, ConsultationContext>(new InjectionConstructor(consultationConnectionString, Container.Resolve <ICommonLog>())); AutoRegisterTypes(Container); var ctx = new ServiceContext("test", "test", "test", "test", "test", "test", false, "en-us"); var loginUserServie = new LoginUserService(Container.Resolve <IConsultationContext>()) { ServiceContext = ctx }; Container.RegisterInstance(typeof(ILoginUserService), loginUserServie, new ContainerControlledLifetimeManager()); }
public static void AssemblyInitialize(TestContext context) { Container = new UnityContainer(); Container.RegisterType <ICommonLog, UnitTestLog>(); Container.RegisterType <IInitialDataService, InitialDataService>(); var risProConnectionString = ConfigurationManager.ConnectionStrings["RisProContext"].ConnectionString; var consultationConnectionString = ConfigurationManager.ConnectionStrings["ConsultationContext"].ConnectionString; Container.RegisterType <IRisProContext, RisProContext>(new InjectionConstructor(risProConnectionString, Container.Resolve <ICommonLog>())); Container.RegisterType <IConsultationContext, ConsultationContext>(new InjectionConstructor(consultationConnectionString, Container.Resolve <ICommonLog>(), Container.Resolve <IInitialDataService>())); AutoRegisterTypes(Container); var ctx = new ServiceContext("test", "test", "test", "test", "test", "test", false, "en-us"); var loginUserServie = new LoginUserService(Container.Resolve <IConsultationContext>()) { ServiceContext = ctx }; Container.RegisterInstance(typeof(ILoginUserService), loginUserServie, new ContainerControlledLifetimeManager()); // common out this method when you are doing performance testing. // check DB CompatibleWithModel have some cost may effect your testing result. var consultationContext = Container.Resolve <IConsultationContext>() as ConsultationContext; if (consultationContext != null) { consultationContext.Database.Log = null; InitDatabase(consultationContext.Database, "Scripts"); } var risProContext = Container.Resolve <IRisProContext>() as RisProContext; if (risProContext != null) { //risProContext.Database.Log = null; //InitDatabase(risProContext.Database, ""); } }
private async void Login() { try { DialogService.ShowLoading("Authenticating..."); var user = await LoginUserService.LoginAsync(Username, Password); if (user == null) { throw new LoginException("Invalid Username Password combination"); } if (string.IsNullOrEmpty(user.Username)) { await Navigation.PushAsync(new EnterUsernamePage(user)); return; // end execution } SaveUserSecurityService.SaveUser(user); Username = string.Empty; Password = string.Empty; MessageBus.Publish(new LoginCompleteMessage()); await Navigation.PushModalAsync(new ScorePredictNavigationPage(new MainPage())); } catch (LoginException lex) { DialogService.Alert(lex.Message); } catch (Exception ex) { DialogService.Alert("Login did not succeed. Please try again"); } finally { DialogService.HideLoading(); } }
public ServicesManager() { DataDicInfoService = new DataDicInfoService(); DataDicTypeService = new DataDicTypeService(); EmployeeService = new EmployeeService(); EquipmentService = new EquipmentService(); LoginUserService = new LoginUserService(); RightService = new RightService(); Role_Right_RelationService = new Role_Right_RelationService(); RoleService = new RoleService(); Base_FareService = new Base_FareService(); Base_PaymentService = new Base_PaymentService(); Base_ProductService = new Base_ProductService(); WorkFlow_TempleteService = new WorkFlow_TempleteService(); Test_Table_TempleteService = new Test_Table_TempleteService(); Test_TableService = new Test_TableService(); Test_Field_TempleteService = new Test_Field_TempleteService(); Test_FieldService = new Test_FieldService(); ProjectService = new ProjectService(); AccidentService = new AccidentService(); UploadImagesService = new UploadImagesService(); EmployeeAttendaceService = new EmployeeAttendaceService(); EquimentAttendaceService = new EquimentAttendaceService(); ExpatriateAttendaceService = new ExpatriateAttendaceService(); ProjectCostService = new ProjectCostService(); CostApplyService = new CostApplyService(); AuditService = new AuditService(); Role_WorkflowService = new Role_WorkflowService(); }
public override async void OnShow() { var user = ReadUserSecurityService.ReadUser(); if (user != null) { if (string.IsNullOrEmpty(user.Username)) { await Navigation.PushAsync(new EnterUsernamePage(user)); return; } try { DialogService.ShowLoading("Authenticating..."); StartupService.SetUser(user); // need to validate that the token is still valid var loginValid = await LoginUserService.CheckUserTokenAsync(); if (loginValid) { DialogService.HideLoading(); await Navigation.PushModalAsync(new ScorePredictNavigationPage(new MainPage())); } else { ClearUserSecurityService.ClearUserSecurity(); DialogService.Alert("You session has expired. Please log in again"); } } finally { DialogService.HideLoading(); } } }
public TokenController(ILoginUser loginUser) { Log.Info("LibraryController Started"); _libraryService = new LoginUserService(loginUser); }
public void SetUp() { _userManager = new Mock <IUserManager>(); _sut = new LoginUserService(_userManager.Object); }
public async System.Threading.Tasks.Task <IActionResult> LogIn(LoginUserService command) { return(Ok(await Mediator.Send(command))); }