Exemple #1
0
        private void timer1_Tick(object sender, EventArgs e)
        {
            load.Width += 5;

            if (load.Width == 90)
            {
                label1.Text = "waiting...";
            }
            else if (load.Width == 150)
            {
                label1.Text = "Completing the system requirements...";
            }
            else if (load.Width == 200)
            {
                label1.Text = "preparing login form...";
            }
            else if (load.Width == 270)
            {
                ///load.BackColor = Color.Lime;
                // bar.BackColor = Color.Yellow;
                label1.Text = "preparing Inventory UI...";
            }
            else if (load.Width == 350)
            {
                label1.Text = "preparing POS UI...";
            }
            else if (load.Width == 450)
            {
                label1.Text = "Getting Ready...";
            }
            else if (load.Width == 490)
            {
                label1.Text = "This is made by BRIGHTSIDE IDEA GROUP...";
            }
            else if (load.Width == 700)
            {
                label1.Text = "All Data is ready..";
            }
            else if (load.Width >= 800)
            {
                timer1.Stop();
                mform log = new mform();
                log.Show();
                this.Hide();
            }
        }
Exemple #2
0
        void generatePassword()
        {
            string Username = textUsername1.Text.Trim();
            string Password = textPassword.Text.Trim();

            User user = new User();

            Cursor.Current = Cursors.WaitCursor;

            if (String.IsNullOrEmpty(Username) || String.IsNullOrEmpty(Password))
            {
                MessageBox.Show("Please fill all given fields!");
            }
            else
            {
                string position = null;
                string pos_id   = null;
                //call function login
                user = User.login(Username, Password, position, pos_id);

                mform pt = null; //not create object
                pt = new mform();

                //if match
                if (Username == user.username && Password == user.password)
                {
                    if (user.position == "cashier")
                    {
                        getid.Text = user.pos_id;

                        string query1 = "SELECT * FROM user_information WHERE  user_id=" + getid.Text + " ";


                        Cmd = new MySqlCommand(query1, connection);

                        connection.Open();

                        //execute reader
                        reader = Cmd.ExecuteReader();

                        if (reader.Read())
                        {
                            getid.Text = reader.GetString("firstname").ToString();

                            POS ca = new POS(getid.Text, atime.Text);
                            ca.Show();
                            this.Hide();
                        }
                        else
                        {
                            MessageBox.Show("Wrong Username or Password", "Wrong", MessageBoxButtons.RetryCancel, MessageBoxIcon.Error);
                        }
                        reader.Close();

                        connection.Close();
                    }
                    else if (user.position == "admin")
                    {
                        getid.Text = user.pos_id;

                        string query1 = "SELECT * FROM user_information WHERE  user_id=" + getid.Text + " ";


                        Cmd = new MySqlCommand(query1, connection);

                        connection.Open();

                        //execute reader
                        reader = Cmd.ExecuteReader();

                        if (reader.Read())
                        {
                            getid.Text = reader.GetString("firstname").ToString();

                            InventoryForm form = new InventoryForm(getid.Text, atime.Text);
                            form.Show();
                            this.Hide();
                        }
                        else
                        {
                            MessageBox.Show("Wrong Username or Password", "Wrong", MessageBoxButtons.RetryCancel, MessageBoxIcon.Error);
                        }
                        reader.Close();

                        connection.Close();
                    }
                }
                else
                {
                    MessageBox.Show("Wrong Username or Password", "Wrong", MessageBoxButtons.RetryCancel, MessageBoxIcon.Error);
                    textPassword.Text = "";
                    if (textPassword.Text == "")
                    {
                        lblhint.Visible = true;
                    }
                    else
                    {
                        lblhint.Visible = false;
                    }
                }
            }
        }