Ejemplo n.º 1
0
 int[] request; //itemID of items that need to be requested
 public Inventory(empty parent)
 {
     InitializeComponent();
     conn = new MySqlConnection("Server=localhost;Database=dogpound;Uid=root;Pwd=root;");
     y    = -40;
     use  = Color.FromArgb(253, 208, 174);
     home = parent;
     end  = new EndorserIn(this);
     endO = new EndorserOut(this);
 }
Ejemplo n.º 2
0
        private void button1_Click(object sender, EventArgs e)
        {
            Boolean flag = false;

            try
            {
                conn.Open();
                MySqlCommand     comm = new MySqlCommand("SELECT * FROM admin", conn);
                MySqlDataAdapter adp  = new MySqlDataAdapter(comm);
                DataTable        dt   = new DataTable();
                adp.Fill(dt);

                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    String user = dt.Rows[i]["username"].ToString();
                    String pass = dt.Rows[i]["password"].ToString();
                    if (usernameTextBox.Text == user && passwordTextBox.Text == pass)
                    {
                        empty home = new empty();
                        home.dispUser = user;
                        home.adminID  = int.Parse(dt.Rows[0]["adminID"].ToString());
                        home.log      = this;
                        this.Hide();
                        home.Show();
                        flag = true;
                        break;
                    }
                }

                if (flag == false)
                {
                    label2.Text      = "Incorrect username and/or password";
                    label2.ForeColor = Color.White;
                }
                conn.Close();
            }
            catch (Exception ex) {
                MessageBox.Show(ex.ToString());
                conn.Close();
            }
            usernameTextBox.Text = "";
            passwordTextBox.Text = "";
        }