public LoginViewModel(LoginView view)
        {
            try
            {
                this.view = view;
                this.ConfirmPasswordVisible = Visibility.Collapsed;

                CommandBinding cmdAccept = new CommandBinding(
                    AcceptCommand,
                    (s, e) => Accept(),
                    (s, e) =>
                    {
                        e.CanExecute =
                            !String.IsNullOrEmpty(Username) &&
                            !String.IsNullOrEmpty(Password);
                    });
                CommandBinding cmdCancel = new CommandBinding(
                    CancelCommand,
                    (s, e) => Cancel(),
                    (s, e) =>
                    {
                        e.CanExecute = true;
                    });

                view.CommandBindings.Add(cmdAccept);
                view.CommandBindings.Add(cmdCancel);
            }
            catch (Exception ex)
            {
                ex.ShowMessageBox();
            }
        }
 private void btnSair_Click(object sender, EventArgs e)
 {
     LoginView loginView = new LoginView();
     this.Hide();
     loginView.Closed += (s, args) => this.Close();
     loginView.Show();
 }
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            string val = e.Parameter as string;
            model = new LoginView();

            

            i = model.getSubOfferId(val);
            // string me = i.insitution;
            //int id = i.Id;
            string name = i.course;
            //string subname = i.subjectName ;
            //string code = i.code;
            //double price = i.price;


            // messageBox(me + "");
            list = model.getSubjectsOffered(name);
            // list = model.getCourses(2);
            foreach (var inst in list)
            {
                listView.Items.Add(inst.SubjectName + " " + inst.Code + " " + inst.Price );

            }
            
            //messageBox(val);
            base.OnNavigatedTo(e);

        }
        public ActionResult Login(LoginView m)
        {
            m.Messages = DataAccess.GetActiveLoginMesssages();
            if (!ModelState.IsValid) return View(m);

            var user = DataAccess.Authenticate(m.UserName, m.Password);

            if (user != null)
            {

                var cookie = Request.Cookies["rephidim_user"];
                if (cookie == null)
                {
                    cookie = new HttpCookie("rephidim_user");
                }
                cookie["rephidim_user"] = m.UserName;
                cookie.Expires = DateTime.Now.AddMonths(12);
                Response.Cookies.Add(cookie);

                var ticket = new FormsAuthenticationTicket(1, user.Name, DateTime.Now, DateTime.Now.AddDays(30), false, user.Rights);
                var encTicket = FormsAuthentication.Encrypt(ticket);

                var authCookie = FormsAuthentication.GetAuthCookie(FormsAuthentication.FormsCookieName, false);
                authCookie.Value = encTicket;
                Response.SetCookie(authCookie);

                if (!string.IsNullOrEmpty(m.ReturnUrl)) return Redirect(m.ReturnUrl);
                else return this.RedirectToAction<HomeController>(x => x.Home()); ;
            }
            else
            {
                ModelState.AddModelError("Error", "Authentication Failed.");
                return View(m);
            }
        }
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            string val = e.Parameter as string;
            model = new LoginView();

            //

            i = model.getCourseId(val);
           // string me = i.insitution;
            //int id = i.Id;
            string name = i.course;


           // messageBox(me + "");
           list = model.getPossibleCareer(name);
            // list = model.getCourses(2);
            foreach (var inst in list)
            {
                listView.Items.Add(inst.Name);

            }

            base.OnNavigatedTo(e);

        }
 protected override void OnNavigatedTo(NavigationEventArgs e)
 {
     model = new LoginView();
     list = model.getAllInstitution();
     foreach (var inst in list)
     { 
         listView.Items.Add(inst.Name);
     }
     
     base.OnNavigatedTo(e);
 }
		public override void LoadView ()
		{
			base.LoadView ();
			View.AddSubview (scrollView = new UIScrollView (View.Bounds));
			if (ShouldShowInstructions) {
				scrollView.Add (ContentView = new PrefillXamarinAccountInstructionsView ());
			} else {
				LoginView = new LoginView (XamarinAccountEmail);
				LoginView.UserDidLogin += _ => Login (XamarinAccountEmail, LoginView.PasswordField.Text);
				scrollView.Add (ContentView = LoginView);
			}
		}
Example #8
0
        public MainViewModel()
        {
            User = new SystemMenagerService.LoginUser { RealName = "" };
            #region MyRegion
            //Messenger.Default.Send<GenericMessage<string>>(new GenericMessage<string>("登录"), "startToLogin");
            //System.Windows.MessageBox.Show("startToLogin");

            //this.IconPath = System.AppDomain.CurrentDomain.SetupInformation.ApplicationBase + @"..\..\Resources\anjilogo.ico"; 
            #endregion
            this._formTitle = "查询平台管理客户端";

            lv = new LoginView();
            _user = new SystemMenagerService.LoginUser();
            _isEnable = false;

            #region init spans
            this.keepSpan = int.Parse(System.Configuration.ConfigurationManager.AppSettings["keepSpan"]);
            this.checkCancelSpan = int.Parse(System.Configuration.ConfigurationManager.AppSettings["checkCancelSpan"]);
            this.checkSafeSpan = int.Parse(System.Configuration.ConfigurationManager.AppSettings["checkSafeSpan"]);

            this.syncBlack = int.Parse(System.Configuration.ConfigurationManager.AppSettings["SyacBlackNoteSpan"]);
            this.syncWhite = int.Parse(System.Configuration.ConfigurationManager.AppSettings["SyncWhiteNoteSpan"]);

            //初始化重置timeSpan间隔
            this.clearSpan = GetMinGongBeiShu(new List<int> { this.keepSpan, this.checkCancelSpan, this.checkSafeSpan, this.syncWhite, this.syncBlack });

            #endregion

            #region init
            this.IsPhoneOnline = true;
            this.IsWebOnline = true;
            this.IsWeinxinOnline = true;
            this.IsSmOnline = true;

            this.TotalTime = new DateTime(0);
            #endregion
            //init the timer
            timer.Interval = new TimeSpan(0, 0, 1);
            timer.Tick += timer_Tick;
            timer.Start();

            #region register msg

            Messenger.Default.Register<GenericMessage<bool>>("CheckWebSatus", msg => this.IsWebOnline = msg.Content);
            Messenger.Default.Register<GenericMessage<bool>>("CheckWeixinSatus", msg => this.IsWeinxinOnline = msg.Content);
            Messenger.Default.Register<GenericMessage<bool>>("CheckPhoneSatus", msg => this.IsPhoneOnline = msg.Content);
            #endregion
        }
        public ActionResult Login(string returnUrl)
        {
            var cookie = Request.Cookies["rephidim_user"];
            string lastUser = "rephidim";
            if (cookie != null)
            {
                lastUser = cookie["rephidim_user"];
            }

            var m = new LoginView();
            m.UserName = lastUser;
            m.ReturnUrl = returnUrl;
            m.Messages = DataAccess.GetActiveLoginMesssages();

            return View("Login", m);
        }
Example #10
0
 public static void Main()
 {
     bool otherEPOSIsNotRunning = false;
     AppMutex = new Mutex(false, APPLICATION_NAME, out otherEPOSIsNotRunning);
     if (AppMutex.WaitOne(0, false))
     {
         LoginView loginView = new LoginView();
         loginView.ShowDialog();
         if (loginView.DialogResult.Equals(true))
         {
             loginView.Close();
             App app = new App();
             app.InitializeComponent();
             app.Run();
         }
     }
 }
Example #11
0
        public string OnLogin(string email, string pass, int mode)
        {
            LoginView view = new LoginView();
            Validator validator = new Validator();

            // Validate the user input here.
            if (!validator.MatchRule(email, "email", "email") )
            {
                return view.Error(validator.GetDetail());
            }

            UserRepository userRepo = new UserRepository();
            if (userRepo.Login(email, pass, mode))
            {
                return view.Show(userRepo.SessionId);
            }

            return view.Error();
        }
        private void btnLogin_Click(object sender, RoutedEventArgs e)
        {
            view = new LoginView();
            string email = txtUsername.Text;
            string pass = txtPassword.Text;
            if (txtPassword.Text != "" && txtUsername.Text != "")
            {
                if (view.getData(email, pass) != null)
                {
                    this.Frame.Navigate(typeof(InstitutionPage));
                }
                else
                {
                    messageBox("You have entered wrong password");
                }
            }
            else
            {
                messageBox("please enter values");

            }
        }
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            i = new HowTheyWork();
            string val = e.Parameter as string;
            model = new LoginView();

            i = model.getWorkId(val); 

            string name = i.course;
         

            list = model.getHowTheyWork(name);
           // Image imageControl = new Image();

          
            //pic.Add(imageControl);


           
        
           // messageBox(val + pic.FindName("Assets/it.jpg"));
            foreach (var inst in list)
            {
                if (name.Equals("Information Technology"))
                {
                    pic.Source = new BitmapImage(new Uri(
                              "ms-appx:///Assets/it.jpg", UriKind.Absolute));
                }
                if (name.Equals("Policing"))
                {
                    pic.Source = new BitmapImage(new Uri(
                              "ms-appx:///Assets/download.jpg", UriKind.Absolute));
                }

            }

            base.OnNavigatedTo(e);
        }
	// This function will be called when scene loaded:
	void Awake () {   
		loginView = new LoginView();
		// Setup of login view:
		loginView.guiSkin = guiSkin;
		loginView.header1Style = header1Style;
		loginView.header2Style = header2Style;
		loginView.header2ErrorStyle = header2ErrorStyle;
		loginView.formFieldStyle = formFieldStyle;
		
		// Handler of registration button click:
		//loginView.openRegistrationHandler = function() {
			// Clear reistration fields:
		//	registrationView.data.clear();
			// Set active view to registration:
		//	activeViewName = RegistrationView.NAME;
		//};
		
		// Setup of login view:
/*		registrationView.guiSkin = guiSkin;
		registrationView.header2Style = header2Style;
		registrationView.formFieldStyle = formFieldStyle;
		registrationView.errorMessageStyle = errorMessageStyle;
*/		
		// Handler of cancel button click:
		/*registrationView.cancelHandler = function() {
			// Clear reistration fields:
			loginView.data.clear();
			// Set active view to registration:
			activeViewName = LoginView.NAME;
		};*/
		
		viewByName = new Hashtable();
		
		// Adding login view to views by name map:
		viewByName.Add(LoginView.NAME, loginView);
		//viewByName[RegistrationView.NAME] = registrationView;
	}
Example #15
0
 static AuthenticationResult ViewToResult(UserId id, LoginView view)
 {
     var auth = new AuthInfo(id, view.Token);
     var result =
         new AuthenticationResult(new SessionIdentity(id, view.Security, view.Display, auth.ToCookieString(),
             view.Permissions, view.Token));
     return result;
 }
 internal void Login()
 {
     try
     {
         if (LoginText == IniciarSesion)
         {
             LoginView login = new LoginView();
             if (login.ShowDialog() == true)
             {
                 this.Username = UserService.LoggedInUser.ToString();
                 this.LoginText = CerrarSesion;
             }
         }
         else
         {
             UserService.LoggedInUser = UserService.GetNullUser();
             this.Username = UserService.LoggedInUser.ToString();
             this.LoginText = IniciarSesion;
         }
     }
     catch (Exception ex)
     {
         ex.ShowMessageBox();
     }
 }
Example #17
0
 public LoginViewModel(LoginView view)
     : base(view.Dispatcher)
 {
 }
Example #18
0
 //Sets loginview
 public void setView()
 {
     LoginView view = new LoginView(bc);
 }
Example #19
0
 // Method that starts the application
 public void start()
 {
     if (user == null)
     {
         bv = new BaseView(this);
         lv = new LoginView(this);
         //this.user = new User(1, "docent", "meneer", "[email protected]", "test", true);
         Application.Run(lv);
     }
     else
     {
         lv.Hide();
         bv.Show();
     }
 }
 private void Login_Click(object sender, RoutedEventArgs e)
 {
     LoginView wnd = new LoginView();
     wnd.ShowDialog();
 }
 private void Window_Loaded(object sender, RoutedEventArgs e)
 {
     LoginView wnd = new LoginView();
     wnd.ShowDialog();
 }
Example #22
0
        public override void Run(bool runWithDefaultConfiguration)
        {
            AccessBehavior.Provider = new AccessLevelProvider();

            if (Debugger.IsAttached)
            {
                BindingListener.SetTrace();
            }

            Application.Current.DispatcherUnhandledException +=
                new DispatcherUnhandledExceptionEventHandler(
                    this.OnAppDispatcherUnhandledException);

            Application.Current.ShutdownMode = ShutdownMode.OnExplicitShutdown;

            // Authenticate the current user and set the default principal
            LoginView auth = new LoginView();
            auth.WindowStartupLocation = WindowStartupLocation.CenterScreen;
            bool? dialogResult = auth.ShowDialog();

            // deal with the results
            if (dialogResult.HasValue && dialogResult.Value)
            {
                //AppDomain.CurrentDomain.SetThreadPrincipal(auth.NewPrincipal);
                base.Run(runWithDefaultConfiguration);
                Application.Current.ShutdownMode = ShutdownMode.OnMainWindowClose;
            }
            else
            {
                Application.Current.Shutdown(-1);
            }
        }
Example #23
0
 private void Canvas_Loaded(object sender, RoutedEventArgs e)
 {
     LoginView dialog = new LoginView();
         dialog.Show();
 }
    // This function will be called when scene loaded:
    void Start()
    {
        //init components
        viewByName = new Hashtable ();
        loginService = (LoginService)gameObject.AddComponent("LoginService");
        registrationService = (RegistrationService)gameObject.AddComponent("RegistrationService");
        loginView = (LoginView)gameObject.AddComponent("LoginView");
        registrationView = (RegistrationView)gameObject.AddComponent("RegistrationView");

        // Setup of login view:
        loginView.guiSkin = guiSkin;
        loginView.header1Style = header1Style;
        loginView.header2Style = header2Style;
        loginView.header2ErrorStyle = header2ErrorStyle;
        loginView.formFieldStyle = formFieldStyle;

        // Handler of registration button click:
        loginView.registrationHandler = delegate(){
            // Clear reistration fields:
            registrationView.data.clear();
            // Set active view to registration:
            activeViewName = RegistrationView.NAME;
        };

        // Setup of login view:
        registrationView.guiSkin = guiSkin;
        registrationView.header2Style = header2Style;
        registrationView.formFieldStyle = formFieldStyle;
        registrationView.errorMessageStyle = errorMessageStyle;

        // Handler of cancel button click:
        registrationView.cancelHandler = delegate() {
            // Clear reistration fields:
            loginView.data.clear();
            // Set active view to registration:
            activeViewName = LoginView.NAME;
        };

        viewByName = new Hashtable();

        // Adding views to views by name map:
        viewByName[LoginView.NAME] = loginView;
        viewByName[RegistrationView.NAME] = registrationView;

        loginView.loginHandler = delegate() {
            blockUI = true;
            // Sending login request:
            loginService.sendLoginData(loginView.data, loginResponseHandler);
        };

        // Handler of Register button:
        registrationView.registrationHandler = delegate() {
            blockUI = true;
            // Sending registration request:
            registrationService.sendRegistrationData(registrationView.data, registrationResponseHandler);
        };
    }
Example #25
0
        static string ComposeLockoutMessage(LoginView view)
        {
            var lockoutTill = view.LockedOutTillUtc;

            var message = view.LockoutMessage;
            var current = DateTime.UtcNow;
            if (lockoutTill.Year - current.Year > 1)
            {
                // this is a really long lockout
                return message;
            }
            var diff = lockoutTill - current;
            string timer;
            if (diff.TotalHours > 1)
            {
                timer = string.Format("Account locked out till {0:yyyy-MM-dd HH:mm}", lockoutTill);
            }
            else
            {
                timer = string.Format("Account locked out for {0} minutes", Math.Ceiling(diff.TotalMinutes));
            }

            if (!string.IsNullOrEmpty(message))
                timer += ". " + message;
            return timer;
        }
Example #26
0
 void ReportLoginSuccess(UserId id, LoginView view)
 {
     // we are good. Now, report success, if needed, to update all the views
     var time = DateTime.UtcNow;
     string host = HttpContext.Current.Request.UserHostAddress;
     if ((view.LastLoginUtc == DateTime.MinValue) || ((time - view.LastLoginUtc) > view.LoginTrackingThreshold))
     {
         _webEndpoint.SendOne(new ReportUserLoginSuccess(id, time, host));
     }
 }