Exemplo n.º 1
0
        private void Button_Click_10(object sender, RoutedEventArgs e)
        {
            string          user       = sID.Content.ToString();
            MySqlConnection connection = new MySqlConnection("server=localHost;uid=root;pwd=nakr1234;database=library;");

            connection.Open();
            MySqlDataReader mdr;

            string       s   = "select * from library.staff,library.address where staff.staff_id='" + user + "' AND  staff.staff_id=address.s_id;";
            MySqlCommand cmd = new MySqlCommand(s, connection);

            mdr = cmd.ExecuteReader();
            updateAccount update = new updateAccount(mdr, "staff", user);

            connection.Close();
            update.Owner = this;
            this.Hide();
            update.Show();
        }
Exemplo n.º 2
0
        private void updateMember_Click(object sender, RoutedEventArgs e)
        {
            string user = "";

            if (memCheck.IsChecked == true)
            {
                user = Convert.ToString("member");
            }
            else if (staffCheck.IsChecked == true)
            {
                user = Convert.ToString("staff");
            }

            if (user == "")
            {
                MessageBox.Show("Please Select Member or Staff", "error");
            }
            else
            {
                MySqlConnection connection = new MySqlConnection("server=localHost;uid=root;pwd=nakr1234;database=library;");
                connection.Open();
                MySqlDataReader mdr;
                string          s = "";
                if (user == "member")
                {
                    s = "select * from library.members,library.address where members.mem_id='" + up_id.Text + "' AND members.mem_id=address.m_id;";
                }
                else if (user == "staff")
                {
                    s = "select * from library.staff,library.address where staff.staff_id='" + up_id.Text + "' AND  staff.staff_id=address.s_id;";
                }
                MySqlCommand cmd = new MySqlCommand(s, connection);
                mdr = cmd.ExecuteReader();
                updateAccount update = new updateAccount(mdr, user, up_id.Text);
                connection.Close();
                update.Owner = this;
                this.Hide();
                update.Show();
            }
        }