Ejemplo n.º 1
0
        public Screen()
        {
            InitializeComponent();

            PageSwitch.CurrentPage = this;
            PageSwitch.Forward(new LoginPage());
        }
Ejemplo n.º 2
0
 public LoginPage()
 {
     InitializeComponent();
     if (MainControl.Session != null)
     {
         PageSwitch.Forward(new UserPage());
     }
 }
Ejemplo 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;
            }
        }
Ejemplo n.º 4
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;
                }
            }
        }
Ejemplo n.º 5
0
 private void buttonSignup_Click(object sender, RoutedEventArgs e)
 {
     PageSwitch.Forward(new SignupPage());
 }