Example #1
0
        public void ReFresh()
        {
            txtID.Text        = "";
            txtUser.Text      = "";
            txtFullname.Text  = "";
            txtAccount.Text   = "";
            txtPassword.Text  = "";
            btnUpdate.Enabled = true;
            txtID.Enabled     = true;

            button6.Text        = "New";
            txtAccountCode.Text = "";
            txtAccountDesc.Text = "";
            button5.Enabled     = true;

            ServerConnection server = new ServerConnection();

            listView1.Items.Clear();
            listView2.Items.Clear();
            txtAccount.Items.Clear();

            #region Get the Acnt User
            try
            {
                string sqlAdd = "select * from acnt_usr a join usr_scrty_qustn b on a.usr_id = b.user_id order by a.usr_id;";
                server.Connection();
                MySqlCommand    cmd = new MySqlCommand(sqlAdd, server.con);
                MySqlDataReader read;
                server.OpenConnection();
                read = cmd.ExecuteReader();
                while (read.Read())
                {
                    ListViewItem item = new ListViewItem(read["usr_id"].ToString());
                    item.SubItems.Add(read["usr_name"].ToString());
                    item.SubItems.Add(read["usr_fullname"].ToString());
                    item.SubItems.Add(read["usr_rspnsblty"].ToString());
                    item.SubItems.Add(read["usr_password"].ToString());
                    item.SubItems.Add(read["usr_question"].ToString());
                    item.SubItems.Add(read["usr_answer"].ToString());
                    listView1.Items.Add(item);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Contact Administrator or POS provider", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            #endregion

            #region Get The Acnt Responsibility
            try
            {
                string sqlAdd = "SELECT * FROM acnt_rspnsblty";
                server.Connection();
                MySqlCommand    cmd = new MySqlCommand(sqlAdd, server.con);
                MySqlDataReader read;
                server.OpenConnection();
                read = cmd.ExecuteReader();
                while (read.Read())
                {
                    txtAccount.Items.Add(read["acnt_code"].ToString());
                    ListViewItem item = new ListViewItem(read["acnt_code"].ToString());
                    item.SubItems.Add(read["acnt_desc"].ToString());
                    listView2.Items.Add(item);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Contact Administrator or POS provider", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            #endregion
        }