コード例 #1
0
		public LoginViewModel (IMeetupService meetupService, ILogin login, IMessageDialog dialog) : base(meetupService) 
		{
			this.login = login;
			this.dialog = dialog;

			ExecuteRefreshLoginCommand ();
		}
コード例 #2
0
        public LoginResponseMessage AuthenticateUser(LoginRequestMessage RequestMessage)
        {
            LoginResponseMessage response = null;
            try
            {
                response = ValidateAuthenticateUser(RequestMessage);

                if (response != null && response.Error==null)
                {
                    loginDataProvider = new LoginDataProvider();
                    response = loginDataProvider.AuthenticateUser(RequestMessage);

                    if (response != null && response.Error == null)
                    {
                        //Generate token
                        response.Success = true;
                    }
                }
            }
            catch(Exception ex)
            {
                ErrorLogManager.WriteLog(response, "999", ex.Message);
            }
            return response;
        }
コード例 #3
0
 public NovaEnqueteViewModel(ILogin _service)
 {
     this.Enquete = new Enquete();
     this.Pergunta = new Pergunta();
     this.Respostas = new List<Resposta>();
     this.service = _service;
 }
コード例 #4
0
 /// <summary>
 /// This method supports the framework directly and should not be used from your code
 /// </summary>
 /// <param name="handler">The handler which processed the login.</param>
 /// <param name="context">The context.</param>
 /// <returns></returns>
 public static void Impl(ILogin handler, IContext context)
 {
     if (handler.LoggedInUser != null)
     {
         SimpleWeb.Configuration.AuthenticationProvider.SetLoggedInUser(context, handler.LoggedInUser);
     }
 }
コード例 #5
0
ファイル: LoginPresenter.cs プロジェクト: SPKT/MHX2
 public void Init(ILogin view)
 {
     _view = view;
     _accountService = new SPKTCore.Core.Impl.AccountService();
     _redirector = new SPKTCore.Core.Impl.Redirector();
     _webContext = new SPKTCore.Core.Impl.WebContext();
     if (!string.IsNullOrEmpty(_webContext.FriendshipRequest))
         _view.DisplayMessage("Đăng nhập để xác nhận");
 }
コード例 #6
0
ファイル: LoginExtendAction.cs プロジェクト: daneric/Scut
 /// <summary>
 /// Sets the parameter.
 /// </summary>
 /// <param name="login">Login.</param>
 protected override void SetParameter(ILogin login) {
     AbstractLogin baseLogin = login as AbstractLogin;
     if (baseLogin != null) {
         refreshToken = baseLogin.RefreshToken;
         retailUserId = baseLogin.RetailUserId;
         scope = baseLogin.Scope;
         accessToken = baseLogin.AccessToken;
     }
 }
コード例 #7
0
ファイル: AdminLoginTasks.cs プロジェクト: stevan001/Solomons
 private string ResetPassword(ILogin login)
 {
     string generatedPassword = System.IO.Path.GetRandomFileName().Replace(".", "");
     if (login != null)
     {
         login.Password = generatedPassword;
         _loginService.Update(login);
     }
     return generatedPassword;
 }
コード例 #8
0
 public void SetOneTimePassword(ILogin login, string password)
 {
     var session = EntityHelper.GetSession(login);
       ChangeUserPassword(login, password, oneTimeByAdmin: true);
       session.SaveChanges();
       var email = FindLoginFactor(login, ExtraFactorTypes.Email);
       if(email != null)
     SendNotification(session.Context, LoginNotificationTypes.OneTimePassword, NotificationMediaTypes.Email, email, login.UserId,
       new Dictionary<string, object>() {
       { LoginNotificationKeys.UserName, login.UserName}, { LoginNotificationKeys.OneTimePassword, password } });
 }
コード例 #9
0
 public void ChangePassword(ILogin login, string oldPassword, string password)
 {
     var checkOld = _settings.Options.IsSet(LoginModuleOptions.AskOldPasswordOnChange);
       var oldIsOneTime = login.Flags.IsSet(LoginFlags.OneTimePassword);
       if (checkOld && ! oldIsOneTime) {
     var pwdHash = GetWeakPasswordHash(oldPassword);
     var session = EntityHelper.GetSession(login);
     session.Context.ThrowIf(login.WeakPasswordHash != pwdHash, ClientFaultCodes.InvalidValue, "OldPassword", "Invalid old password.");
       }
       ChangeUserPassword(login, password, false);
 }
コード例 #10
0
ファイル: Facade.cs プロジェクト: eviternity/Apps4KidsWebApp
 /// <summary>
 /// Logs the user in
 /// </summary>
 /// <param name="login">The login data</param>
 /// <returns>The user</returns>
 public static IUser Login(ILogin login)
 {
     using (var context = Connection.GetContext())
     {
         sp_Login_Result result = context.sp_Login(login.UserName, login.Password).FirstOrDefault();
         if (result == null)
         {
             return null;
         }
         return new User(result);
     }
 }
コード例 #11
0
 public LoginResult CompleteMultiFactorLogin(OperationContext context, ILogin login)
 {
     PostLoginActions actions = GetPostLoginActions(login);
       context.User = login.CreateUserInfo();
       var lastLogin = login.LastLoggedInOn;
       UpdateLastLoggedInOn(login);
       AttachUserSession(context, login);
       OnLoginEvent(context, LoginEventType.MultiFactorLoginCompleted, login);
       App.UserLoggedIn(context);
       return new LoginResult() {
     Status = LoginAttemptStatus.Success, Login = login, Actions = actions, User = context.User, SessionToken = context.UserSession.Token, LastLoggedInOn = lastLogin };
 }
コード例 #12
0
ファイル: LoginExtendAction.cs プロジェクト: lvshiling/Scut
		/// <summary>
		/// Sets the parameter.
		/// </summary>
		/// <param name="login">Login.</param>
        protected override void SetParameter(ILogin login)
        {
            AbstractLogin baseLogin = login as AbstractLogin;
            if (baseLogin != null)
            {
                //AccessToken = baseLogin.AccessToken;
                RefeshToken = baseLogin.RefeshToken;
                QihooUserID = baseLogin.QihooUserID;
                Scope = baseLogin.Scope;
                AccessToken360 = baseLogin.AccessToken;
            }
        }
コード例 #13
0
ファイル: LoginPresenter.cs プロジェクト: SPKT/MangXaHoi
 public void Init(ILogin view)
 {
     _view = view;
     //_accountService = ObjectFactory.GetInstance<IAccountService>();
        //_redirector = ObjectFactory.GetInstance<IRedirector>();
        //_webContext = ObjectFactory.GetInstance<IWebContext>();
     _accountService = new SPKTCore.Core.Impl.AccountService();
     _redirector = new SPKTCore.Core.Impl.Redirector();
     _webContext = new SPKTCore.Core.Impl.WebContext();
        // if(_webContext.LoggedIn)
       //  _redirector.Redirect("~\\Profiles\\ManageProfile.aspx");
 }
コード例 #14
0
ファイル: LoginLogModule.cs プロジェクト: yuanfei05/vita
 public void LogEvent(OperationContext context, LoginEventType eventType, ILogin login = null, string notes = null, string userName = null)
 {
     var webCtx = context.WebContext;
       Guid? loginId = null;
       if(login != null) {
     loginId = login.Id;
     if(userName == null)
       userName = login.UserName;
       }
       var logEntry = new LoginLogEntry(context, loginId, eventType.ToString(), notes, userName);
       _backgroundSave.AddObject(logEntry);
 }
コード例 #15
0
 public LoginExtraFactor AddFactor(ILogin login, ExtraFactorTypes type, string value)
 {
     var session = EntityHelper.GetSession(login);
       if (type == ExtraFactorTypes.GoogleAuthenticator)
     value = GoogleAuthenticator.GoogleAuthenticatorUtil.GenerateSecret();
       var factor = session.NewEntity<ILoginExtraFactor>();
       factor.Login = login;
       factor.FactorType = type;
       factor.Info = session.NewOrUpdate(factor.Info, value, _settings.EncryptionChannelName);
       factor.InfoHash = Util.StableHash(value);
       if (type == ExtraFactorTypes.GoogleAuthenticator)
     factor.SetVerified(App.TimeService.UtcNow);
       return ToModel(factor);
 }
コード例 #16
0
 public bool CheckLoginFactorsSetupCompleted(ILogin login)
 {
     var session = EntityHelper.GetSession(login);
       var hadPendingChanges = session.GetChangeCount() > 0; //true if there are pending changes
       //Password reset
       if (login.PasswordResetFactors == ExtraFactorTypes.None)
     login.PasswordResetFactors = _settings.DefaultPasswordResetFactors;
       var incompleteFactors = GetIncompleteFactors(login);
       if(login.IncompleteFactors != incompleteFactors)
     login.IncompleteFactors = incompleteFactors;
       if (!hadPendingChanges) //save changes unless there were already changes so caller will save all
     session.SaveChanges();
       return login.IncompleteFactors == ExtraFactorTypes.None;
 }
コード例 #17
0
ファイル: LoginPresenter.cs プロジェクト: lengocluyen/pescode
        public void Init(ILogin view)
        {
            _view = view;
            _userSession = ObjectFactory.GetInstance<IUserSession>();
            _redirector = ObjectFactory.GetInstance<IRedirector>();
            _webContext = ObjectFactory.GetInstance<IWebContext>();

            if (_userSession.LoggedIn == true && _userSession.CurrentUser != null)
                _redirector.GoToHomePage();

            _accountService = ObjectFactory.GetInstance<IAccountService>();

            if (!string.IsNullOrEmpty(_webContext.FriendshipRequest))
                _view.DisplayMessage("Đăng nhập để kết bạn!");
        }
コード例 #18
0
        /// <summary> 检查 <see cref="ILogin"/> 是否可以被删除. </summary>
        /// <returns> 可以被删除时返回 <c>true</c>, 否则返回 <c>false</c>. </returns>
        public static LoginRemovableResult Check(IAccountManager accountManager, ILogin login)
        {
            if (accountManager == null) throw new ArgumentNullException("accountManager");
            if (login == null) throw new ArgumentNullException("login");

            var account = login.Account;
            if (account.Logins.Count == 1)
            {
                if (String.IsNullOrEmpty(account.Password))
                {
                    String message = String.Format(m_LastLoginErrorFmt, login.Id);
                    return new LoginRemovableResult(false, message, login);
                }
            }
            return new LoginRemovableResult(true, null, login);
        }
コード例 #19
0
 public PostLoginActions GetPostLoginActions(ILogin login)
 {
     // Success, figure out action flags --------------------------
       var actions = PostLoginActions.None;
       //Check if HashWorkFactor has changed since password was set - if yes, we need to reset password.
       if(login.Flags.IsSet(LoginFlags.OneTimePassword) || login.HashWorkFactor != _settings.PasswordHasher.WorkFactor)
     actions |= PostLoginActions.ForceChangePassword;
       if(login.IncompleteFactors != ExtraFactorTypes.None)
     actions |= PostLoginActions.SetupExtraFactors;
       if(_settings.WarnPasswordExpiresDays > 0) {
     var expiresDays = login.GetExpiresDays();
     if(expiresDays < _settings.WarnPasswordExpiresDays)
       actions |= PostLoginActions.WarnPasswordExpires;
       }
       return actions;
 }
コード例 #20
0
        public HttpResponseMessage AuthenticateUser([FromBody]LoginRequestMessage requestMessage)
        {
            loginBusinessProvider = new LoginBusinessAccessProvider();
            //requestMessage = new LoginRequestMessage();
            //requestMessage.LoginName = "frankanders";
            //requestMessage.Password = "******";
            LoginResponseMessage response = loginBusinessProvider.AuthenticateUser(requestMessage);
            HttpResponseMessage tempResponse = Request.CreateResponse(HttpStatusCode.OK, response);

            //string jsonMessage;
            //using (Stream responseStream = tempResponse.Content.ReadAsStreamAsync().Result)
            //{
            //    jsonMessage = new StreamReader(responseStream).ReadToEnd();
            //}
            return tempResponse;
        }
コード例 #21
0
        /// <summary>
        /// Initializes a new instance of the <see cref="AcomScraper"/> class.
        /// </summary>
        /// <param name="factory">The factory.</param>
        /// <param name="login">The login.</param>
        /// <exception cref="System.ArgumentNullException">
        /// factory
        /// or
        /// login
        /// </exception>
        public BaseScraper(IConnectionFactory factory, ILogin login)
        {
            if (factory == null)
            {
                throw new ArgumentNullException("factory");
            }

            if (login == null)
            {
                throw new ArgumentNullException("login");
            }

            this.Factory = factory;

            this.Login = login;
        }
コード例 #22
0
 public bool CheckPasswordWasUsed(ILogin login, string password, TimeSpan? period, int? lastUsedCount)
 {
     var session = EntityHelper.GetSession(login);
       var hash = GetWeakPasswordHash(password);
       var where = session.NewPredicate<IPasswordHistory>()
     .And(h => h.Login == login);
       if(period != null) {
     var startDate = session.Context.App.TimeService.UtcNow.Subtract(period.Value);
     where = where.And(h => h.DisabledOn == null || h.DisabledOn > startDate);
       }
       IQueryable<IPasswordHistory> query = session.EntitySet<IPasswordHistory>().Where(where).OrderByDescending(h => h.CreatedOn); ;
       if(lastUsedCount != null)
     query = query.Take(lastUsedCount.Value);
       var list = query.ToList();
       var match = list.FirstOrDefault(h => h.WeakPasswordHash == hash);
       return match != null;
 }
コード例 #23
0
        public HttpClient CreateClient(ILogin login, Dictionary<Uri, IList<Cookie>> cookies)
        {
            var handler = new HttpClientHandler();

            if (login != null)
            {
                CookieContainer cookieContainer;
                string loginName = login.GetType().FullName;
                lock (lockObject)
                {
                    cachedCookies.TryGetValue(loginName, out cookieContainer);
                }

                if (cookieContainer == null)
                {
                    cookieContainer = new CookieContainer();
                    login.Login(cookieContainer);
                    lock (lockObject)
                    {
                        cachedCookies[loginName] = cookieContainer;
                    }

                }
                handler.CookieContainer = cookieContainer;
            }

            if (cookies != null)
            {
                foreach (var k in cookies)
                {
                    foreach (var cookie in k.Value)
                    {
                        handler.CookieContainer.Add(k.Key, cookie);
                    }
                }

            }

            return new HttpClient(handler);
        }
コード例 #24
0
 public LoginController()
 {
     _ILogin        = new LoginConcrete();
     _IAssignRoles  = new AssignRolesConcrete();
     _ICacheManager = new CacheManager();
 }
コード例 #25
0
ファイル: LoginModule_Management.cs プロジェクト: radtek/vita
 public ILoginExtraFactor FindLoginFactor(ILogin login, ExtraFactorTypes factorType)
 {
     return(login.ExtraFactors.FirstOrDefault(f => f.FactorType == factorType));
 }
コード例 #26
0
 public LoginController(ILogin Login)
 {
     this._login = Login;
 }
コード例 #27
0
 /// <summary>
 /// 类构造方法
 /// <param name="context">HTTP请求上下文</param>
 /// <param name="loginSession">登录对象信息</param>
 /// </summary>
 public Combobox(HttpContext context, ILogin loginSession)
 {
     this.context      = context;
     this.loginSession = loginSession;
 }
コード例 #28
0
 public GrupoCustoController(IBaseService <GrupoCusto> service, ILogin login)
 {
     this.service = service;
     this.login   = login;
 }
コード例 #29
0
 public LoginController(ILogin ILogin)
 {
     _ILogin = ILogin;
 }
コード例 #30
0
ファイル: LoginAction.cs プロジェクト: liucy2007975/ddz-1
 /// <summary>
 /// Sets the parameter.
 /// </summary>
 /// <param name="login">Login.</param>
 protected virtual void SetParameter(ILogin login)
 {
 }
コード例 #31
0
        public UserType TryLogin(string userName, string password, out ILogin token, out FacadeBase facade)
        {
            token  = null;
            facade = new AnonymousUserFacade();

            // Default Admin.
            if (userName.ToUpper() == FlyingCenterConfig.ADMIN_NAME.ToUpper())
            {
                if (password.ToUpper() == FlyingCenterConfig.ADMIN_PASSWORD.ToUpper())
                {
                    token = new LoginToken <Administrator>
                    {
                        User = new Administrator
                               (
                            0, //Admin Number
                            0, //Id
                            FlyingCenterConfig.ADMIN_NAME,
                            FlyingCenterConfig.ADMIN_PASSWORD
                               )
                    };
                    facade = new LoggedInAdministratorFacade();
                    return(UserType.Administrator);
                }
                else
                {
                    throw new WrongPasswordException("Sorry, But Your Password Isn't Match To Your User Name.");
                }
            }

            // DAO Users.
            User user = _userDAO.GetUserByUserName(userName);

            if (user != null)
            {
                if (user.User_Name == userName)
                {
                    if (password.ToUpper() == user.Password.ToUpper())
                    {
                        switch (user.MyType)
                        {
                        case UserType.Administrator:
                        {
                            Administrator admin = _administratorDAO.GetById(user.Id);
                            token = new LoginToken <Administrator>
                            {
                                User = new Administrator
                                       (
                                    admin.Admin_Number,
                                    user.Id,
                                    user.User_Name,
                                    user.Password
                                       )
                            };
                            facade = new LoggedInAdministratorFacade();
                            return(UserType.Administrator);
                        }

                        case UserType.Airline:
                        {
                            AirlineCompany airline = _airlineDAO.GetById(user.Id);
                            token = new LoginToken <AirlineCompany>
                            {
                                User = new AirlineCompany
                                       (
                                    airline.Airline_Number,
                                    user.Id,
                                    user.User_Name,
                                    user.Password,
                                    airline.Airline_Name,
                                    airline.Country_Code
                                       )
                            };
                            facade = new LoggedInAirlineFacade();
                            return(UserType.Airline);
                        }

                        case UserType.Customer:
                        {
                            Customer customer = _customerDAO.GetById(user.Id);
                            token = new LoginToken <Customer>
                            {
                                User = new Customer
                                       (
                                    customer.Customer_Number,
                                    user.Id,
                                    user.User_Name,
                                    user.Password,
                                    customer.First_Name,
                                    customer.Last_Name,
                                    customer.Address,
                                    customer.Phone_No,
                                    customer.Credit_Card_Number
                                       )
                            };
                            facade = new LoggedInCustomerFacade();
                            return(UserType.Customer);
                        }

                        default:
                        {
                            return(UserType.Anonymous);
                        }
                        }
                    }
                    else
                    {
                        throw new WrongPasswordException("Sorry, But Your Password Doe's Not Match To Your User Name.");
                    }
                }
                else
                {
                    throw new UserNotExistException($"Sorry, But {userName} Does Not Exist.");
                }
            }
            return(UserType.Anonymous);
        }
コード例 #32
0
 public RolesAndPermissionsController(IGlobalAdmin _IGlobalAdmin, ICommonMethod _ICommonMethod, IDashboardWidgetSettingManager _IDashboardWidgetSettingManager, ILogin _ILogin)
 {
     this._IGlobalAdmin  = _IGlobalAdmin;
     this._ICommonMethod = _ICommonMethod;
     this._IDashboardWidgetSettingManager = _IDashboardWidgetSettingManager;
     this._ILogin = _ILogin;
 }
コード例 #33
0
 public LoginViewModel(ILogin view)
 {
     view.IsLoginValid += IsLoginValid;
     view.IsWorker     += IsWorker;
 }
コード例 #34
0
 /// <summary>
 /// 类构造方法
 /// <param name="context">HTTP请求上下文</param>
 /// <param name="loginSession">登录对象信息</param>
 /// </summary>
 public RoleBLL(HttpContext context, ILogin loginSession)
 {
     this.context      = context;
     this.loginSession = loginSession;
 }
コード例 #35
0
 public LoginController(ILogin LoginRepo)
 {
     _ILogin = LoginRepo;
 }
コード例 #36
0
 public EmployeeLogin(ILogin <Employee> employeeRepo)
 {
     repo = employeeRepo;
 }
コード例 #37
0
 public FindMyPastScraper(IConnectionFactory factory, ILogin login)
     : base(factory, login)
 {
 }
コード例 #38
0
 public LoginPresenter(ILogin _view)
 {
     view = _view;
 }
コード例 #39
0
 public LogoutCommand(ILogin login)
 {
     this.login = login;
     this.Name  = Strings.Input_Logout;
 }
コード例 #40
0
 public UserProfileController()
 {
     _ILogin = new LoginConcrete();
 }
コード例 #41
0
 public LoginPresenter(ILogin view)
 {
     LoginView = view;
 }
コード例 #42
0
ファイル: LoginAction.cs プロジェクト: liucy2007975/ddz-1
 /// <summary>
 ///
 /// </summary>
 protected virtual void DoLoginFail(ILogin login)
 {
     ErrorCode = Language.Instance.ErrorCode;
     ErrorInfo = Language.Instance.PasswordError;
 }
コード例 #43
0
 // Only Here Is Place To Get Any Token Or Facade(Because It's Singelton)
 static public void GetUserAndFacade(string userName, string password, out ILogin token, out FacadeBase facade)
 {
     ls.TryLogin(userName, password, out ILogin myToken, out FacadeBase myFacade);
     token  = myToken;
     facade = myFacade;
 }
コード例 #44
0
 public PraticienController(IWebHostEnvironment env, IRdv rdv, IUpload uploadService, ILogin login)
 {
     _env          = env;
     _rdvService   = rdv;
     _uploadSerice = uploadService;
     _login        = login;
 }
コード例 #45
0
 public BoletoController(IBoleto service, IBaseService <Parcela> serviceParcela, ILogin login)
 {
     this.service        = service;
     this.serviceParcela = serviceParcela;
     this.login          = login;
 }
コード例 #46
0
 public CustomMembershipProvider()
 {
     _service = (ILogin)UnityConfig.GetConfiguredContainer().Resolve(typeof(ILogin), "");
 }
コード例 #47
0
 public FindMyPastScraper(IConnectionFactory factory, ILogin login) : base(factory, login)
 {
 }
コード例 #48
0
 public LoginViewModel(Page page) : base(page)
 {
     login = DependencyService.Get<ILogin>();
 }
コード例 #49
0
 public AuthController(IConfiguration config, ILogin login)
 {
     _config = config;
     _login  = login;
 }
コード例 #50
0
 public FornecedorController(IBaseService<Fornecedor> service, ILogin login)
 {
     _service = service;
     _login = login;
 }
コード例 #51
0
 /// <summary>
 /// 类构造方法
 /// <param name="context">HTTP请求上下文</param>
 /// <param name="loginSession">登录对象信息</param>
 /// </summary>
 public LotteryOrderBLL(HttpContext context, ILogin loginSession)
 {
     this.context      = context;
     this.loginSession = loginSession;
 }
コード例 #52
0
ファイル: LoginModule_Management.cs プロジェクト: radtek/vita
        public ISecretQuestionAnswer AddSecretQuestionAnswer(ILogin login, int number, ISecretQuestion question, string answer)
        {
            var hash = GetWeakSecretAnswerHash(answer, login.Id);

            return(login.AddSecretQuestionAnswer(number, question, hash));
        }
コード例 #53
0
ファイル: LoginAction.cs プロジェクト: 87170360/Maximus
 /// <summary>
 /// Sets the parameter.
 /// </summary>
 /// <param name="login">Login.</param>
 protected virtual void SetParameter(ILogin login)
 {
 }
コード例 #54
0
 public SistemaAreaController(IBaseService <SistemaArea> service, ILogin login)
 {
     this.service = service;
     this.login   = login;
 }
コード例 #55
0
ファイル: LoginExistsResult.cs プロジェクト: yaoyel/Finework
 public LoginExistsResult(bool isSucceed, String message, ILogin login)
     : base(isSucceed, message)
 {
     this.Login = login;
 }
コード例 #56
0
 /// <summary>
 ///  Initializes a new instance of the <see cref="LoginController" /> class.
 /// </summary>
 /// <param name="config"></param>
 /// <param name="login"></param>
 public LoginController(IConfiguration config, ILogin login)
 {
     _login = login;
 }
コード例 #57
0
            public x(ILogin page)
            {
                Native.document.title = "x";


                // Uncaught Error: InvalidOperationException: { MethodToken = BgAABqe4Nzm_bBv4spuPWGg } function is not available at { href = http://192.168.43.252:24113/view-source#worker } 


                #region go 2
                new IHTMLButton { innerText = "go 2" }.AttachToDocument().WhenClicked(
                    //async
                 delegate
                 {
                     // hsc, why wont lambda declaration work within async scope?

                     // http://blogs.msdn.com/b/dotnet/archive/2012/06/06/async-in-4-5-enabling-progress-and-cancellation-in-async-apis.aspx

                     Console.WriteLine("before");

                     // https://sites.google.com/a/jsc-solutions.net/backlog/knowledge-base/2013/201309-1/20130904-iprogress
                     //var x =
                     //await 
                     Task.Factory.StartNewWithProgress(

                     new { value = "world!" },

                     progress:
                        xx =>
                        {
                            Console.WriteLine("DOM Progress: " + new { xx.value, Thread.CurrentThread.ManagedThreadId });

                            Native.document.title = new { xx.value, Thread.CurrentThread.ManagedThreadId }.ToString();
                        },

                     function:
                         scope =>
                         {
                             #region scope is null
                             if (scope == null)
                             {
                                 // { x = scope_progress is null { state = [object Object], BackgroundThread = 10 }, ManagedThreadId = 1 }
                                 return new { value = "scope is null " + new { BackgroundThread = Thread.CurrentThread.ManagedThreadId } };
                             }
                             #endregion



                             var state = scope.Item2;

                             #region scope_progress
                             var scope_progress = scope.Item1;
                             if (scope_progress == null)
                             {
                                 // { x = null { BackgroundThread = 10 }, ManagedThreadId = 1 }
                                 return new { value = "scope_progress is null " + new { state, BackgroundThread = Thread.CurrentThread.ManagedThreadId } };
                             }
                             #endregion

                             var e = new Stopwatch();
                             e.Start();

                             scope_progress.Report(
                                  new
                                  {
                                      value = "hi " + new { e.ElapsedMilliseconds, BackgroundThread = Thread.CurrentThread.ManagedThreadId }
                                  }
                             );


                             for (int i = 0; i < 20; i++)
                             {
                                 scope_progress.Report(
                                    new
                                    {
                                        value = ". " + new { i, state.value, e.ElapsedMilliseconds, BackgroundThread = Thread.CurrentThread.ManagedThreadId }
                                    }
                                 );

                                 Thread.Sleep(100);
                             }


                             return new { value = "done " + new { e.ElapsedMilliseconds, BackgroundThread = Thread.CurrentThread.ManagedThreadId } };
                         }
                 ).ContinueWithResult(
                     x =>
                     {
                         Console.WriteLine("after");
                         Native.document.title = new { x.value, Thread.CurrentThread.ManagedThreadId }.ToString();
                     }
                 );

                 }
             );
                #endregion

                //Uncaught Error: InvalidOperationException: { MethodToken = BgAABqe4Nzm_bBv4spuPWGg } function is not available at { href = http://192.168.43.252:18192/view-source#worker } 

                #region go
                Action<HistoryScope<InternalScriptApplicationSource>> go =
                    //async 
                      scope =>
                      {
                          var source = scope.state;

                          // show login

                          var layout = new App();

                          var newbody = layout.body;
                          var oldbody = Native.document.body;

                          // switch layouts

                          Native.document.body.parentNode.replaceChild(
                              newbody,
                              oldbody
                          );

                          // how did we get the source?
                          //var app = new y(layout);

                          //var src = new Blob(source).ToObjectURL().SetInternalScriptApplicationSource();
                          ////await new IHTMLScript { src = src };
                          //Native.window.eval(source);

                          source.eval();


#if FUTURE
                      var yy = await new y(default(IProgress<string>), data: default(string));
#endif


                      };
                #endregion


                #region onclick
                page.Login.onclick +=
                    async delegate
                    {
                        page.Login.disabled = true;

                        var source = await typeof(y);

                        // we can now Activate it?
                        //Activator.CreateInstance(typeof(x));

                        //Native.window.history.replaceState(
                        //     new
                        //     {
                        //         Native.window.history.state,

                        //         hint = "typeof(y)",

                        //         invoke = new { function = ((__MethodInfo)go.Method).MethodToken, arguments = new[] { source } }
                        //     }
                        //);

                        //// invoke as state?
                        ////go(source);

                        //Native.document.location.reload();

                        Native.window.history.replaceState(source, go);

                    };
                #endregion


                #region options
                new IHTMLButton { innerText = "pushState1", id = "pushState1" }.AttachToDocument().WhenClicked(
                    btn =>
                    {

                        Native.window.history.pushState(
                            new { pushState = "world1", btn.id },
                            async scope =>
                            {
                                ((IHTMLButton)Native.document.getElementById(scope.state.id)).disabled = true;
                                Native.document.title = "zz " + new { scope.state.pushState };
                                var x = new { Native.document.body.style.backgroundColor };
                                Native.document.body.style.backgroundColor = "yellow";

                                await scope;
                                //scope.TaskCompletionSource.Task.ContinueWithResult(
                                //    delegate
                                //    {

                                Native.document.body.style.backgroundColor = x.backgroundColor;

                                ((IHTMLButton)Native.document.getElementById(scope.state.id)).disabled = false;
                                Native.document.title = "zz!";
                                //    }
                                //);
                            }
                        );
                    }
                );


                new IHTMLButton { innerText = "pushState2", id = "pushState2" }.AttachToDocument().WhenClicked(
                    btn =>
                    {

                        Native.window.history.pushState(
                            new { pushState = "world2", btn.id },
                            async scope =>
                            {
                                ((IHTMLButton)Native.document.getElementById(scope.state.id)).disabled = true;
                                Native.document.title = "zz " + new { scope.state.pushState };

                                var x = new { Native.document.body.style.backgroundColor };
                                Native.document.body.style.backgroundColor = "green";

                                await scope;


                                Native.document.body.style.backgroundColor = x.backgroundColor;

                                ((IHTMLButton)Native.document.getElementById(scope.state.id)).disabled = false;
                                Native.document.title = "zz!";
                            }
                        );
                    }
                );
                #endregion


            }
コード例 #58
0
 public LoginController(ILogin _ILogin, ICommonMethod ICommonMethod)
 {
     this._ILogin        = _ILogin;
     this._ICommonMethod = ICommonMethod;
 }
コード例 #59
0
 public ProfileController()
 {
     _login   = new Login();
     _profile = new Profile();
     _crypto  = new Crypto();
 }
コード例 #60
0
        public ILogon GetUserMenu(ILogin loginDetails)
        {
            SqlConnection objSQLConn    = null;
            SqlCommand    objSQLCommand = null;

            ILogon objLogOn = LogonBOFactory.CreateLogonObject();

            try
            {
                objSQLConn = new SqlConnection(strConnectionString);
                objSQLConn.Open();

                objSQLCommand = new SqlCommand("usp_GetUserName", objSQLConn);

                objSQLCommand.CommandType = System.Data.CommandType.StoredProcedure;
                objSQLCommand.Parameters.AddWithValue("@EmployeeID", loginDetails.EmployeeId);
                SqlDataReader objSQLReader = objSQLCommand.ExecuteReader();

                while (objSQLReader.Read())
                {
                    //objLogOn.EmployeeId = Convert.ToInt32(objSQLReader["EmployeeID"]);
                    objLogOn.EmployeeName = Convert.ToString(objSQLReader["EmployeeFirstName"]) + " " + Convert.ToString(objSQLReader["EmployeeLastName"]);
                    objLogOn.RoleName     = Convert.ToString(objSQLReader["RoleName"]);
                    objLogOn.EmployeeId   = Convert.ToInt32(objSQLReader["EmployeeID"]);
                }

                objSQLReader.Close();

                objSQLCommand = new SqlCommand("usp_GetMenuItems", objSQLConn);

                objSQLCommand.CommandType = System.Data.CommandType.StoredProcedure;
                objSQLCommand.Parameters.AddWithValue("@RoleID", loginDetails.Role);

                SqlDataReader objSQLReader1 = objSQLCommand.ExecuteReader();
                List <IMenu>  menuList      = new List <IMenu>();
                while (objSQLReader1.Read())
                {
                    IMenu menuItem = MenuBOFactory.CreateMenuObject();
                    menuItem.MenuId        = Convert.ToInt32(objSQLReader1["MenuID"]);
                    menuItem.MenuName      = Convert.ToString(objSQLReader1["Title"]);
                    menuItem.ToolTip       = Convert.ToString(objSQLReader1["ToolTip"]);
                    menuItem.NavigationUrl = Convert.ToString(objSQLReader1["NavigationURL"]);
                    menuItem.ParentMenuId  = Convert.ToInt32(objSQLReader1["RoleID"]);

                    menuList.Add(menuItem);
                }
                objLogOn.MenoBo = menuList;

                objSQLReader1.Close();
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                if (objSQLConn != null && objSQLConn.State != System.Data.ConnectionState.Closed)
                {
                    objSQLConn.Close();
                }
            }
            return(objLogOn);
        }