Example #1
0
        private void cbQuan_SelectedIndexChanged(object sender, EventArgs e)
        {
            ComboBox cb = sender as ComboBox;

            if (cb.SelectedItem == null)
            {
                return;
            }
            Quan selectQuan = cb.SelectedItem as Quan;
            int  id         = selectQuan.Id;

            LoadPhuongTheoQuan(id);
        }
Example #2
0
        public List <Quan> LayDanhSachQuan()
        {
            List <Quan> dsQuan = new List <Quan>();

            kn = new KetNoi();
            SqlCommand cmd = new SqlCommand();

            cmd.Connection  = kn.con;
            cmd.CommandText = "select * from Quan";
            kn.Connect();
            SqlDataReader dr = cmd.ExecuteReader();
            DataTable     dt = new DataTable();

            dt.Load(dr);

            foreach (DataRow row in dt.Rows)
            {
                Quan quan = new Quan(row);
                dsQuan.Add(quan);
            }
            kn.con.Close();
            return(dsQuan);
        }