Esempio n. 1
0
        public Screen()
        {
            InitializeComponent();

            PageSwitch.CurrentPage = this;
            PageSwitch.Forward(new LoginPage());
        }
Esempio n. 2
0
 public LoginPage()
 {
     InitializeComponent();
     if (MainControl.Session != null)
     {
         PageSwitch.Forward(new UserPage());
     }
 }
Esempio n. 3
0
        /// <summary>
        /// Do Login process
        /// when event is trigged
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void buttonLogin_Click(object sender, RoutedEventArgs e)
        {
            User data = new User();

            if (data.Login(this.boxUsername.Text, this.boxPassword.Password))
            {
                MainControl.Session = data;
                SolidColorBrush color = (SolidColorBrush)(new BrushConverter().ConvertFrom("#000000"));
                labelUsername.Foreground = color;
                labelPassword.Foreground = color;
                PageSwitch.Forward(new UserPage());
            }
            else
            {
                SolidColorBrush color = (SolidColorBrush)(new BrushConverter().ConvertFrom("#EE5555"));
                labelUsername.Foreground = color;
                labelPassword.Foreground = color;
            }
        }
Esempio n. 4
0
 private void button_Click(object sender, RoutedEventArgs e)
 {
     PageSwitch.Backward();
 }
Esempio n. 5
0
        private void buttonSignup_Click(object sender, RoutedEventArgs e)
        {
            User data = new User();

            bool[] status = { false, false, false, false };

            if (boxUsername.Text.Length > 2)
            {
                data.Username            = boxUsername.Text;
                labelUsername.Foreground = Brushes.Black;
                status[0] = true;
            }
            else
            {
                labelUsername.Foreground = Brushes.OrangeRed;
                status[0] = false;
            }

            if (boxPassword.Password.Length > 0 && boxPassword.Password == boxRepassword.Password)
            {
                data.Password              = boxPassword.Password;
                labelPassword.Foreground   = Brushes.Black;
                labelRepassword.Foreground = Brushes.Black;
                status[1] = true;
            }
            else
            {
                labelPassword.Foreground   = Brushes.OrangeRed;
                labelRepassword.Foreground = Brushes.OrangeRed;
                status[1] = false;
            }

            if (boxFirstname.Text.Length > 1)
            {
                data.Firstname            = boxFirstname.Text;
                labelFirstname.Foreground = Brushes.Black;
                status[2] = true;
            }
            else
            {
                labelFirstname.Foreground = Brushes.OrangeRed;
                status[2] = false;
            }

            if (boxLastname.Text.Length > 1)
            {
                data.Lastname            = boxLastname.Text;
                labelLastname.Foreground = Brushes.Black;
                status[3] = true;
            }
            else
            {
                labelLastname.Foreground = Brushes.OrangeRed;
                status[3] = false;
            }

            if (radioCustomer.IsChecked == true)
            {
                data.Type = User.Status.Customer;
            }
            else
            {
                data.Type = User.Status.Employee;
            }

            // Final check before process user register
            if (status.All(x => x == true))
            {
                // Check if user is already exist & do create user process
                if (data.CreateUser())
                {
                    labelUsername.Foreground = Brushes.Black;
                    PageSwitch.Forward(new LoginPage(boxUsername.Text));
                }
                else
                {
                    labelUsername.Foreground = Brushes.OrangeRed;
                }
            }
        }
Esempio n. 6
0
 private void buttonSignup_Click(object sender, RoutedEventArgs e)
 {
     PageSwitch.Forward(new SignupPage());
 }