コード例 #1
0
        public void Insert(TheLoai info)
        {
            string sqlQuery = "insert into TheLoai values ('" +
                info.MaTheLoai + "',N'" +
                info.TenTheLoai + "',N'" +
                info.GhiChu + "')";

            ExecuteNonQuery(sqlQuery);
        }
コード例 #2
0
        public void Update(TheLoai info)
        {
            string sqlQuery = "update TheLoai" +
                              " set TenTheLoai=N'" + info.TenTheLoai + "'," +
                              "GhiChu=N'" + info.GhiChu + "' " +
                              "where MaTheLoai='" + info.MaTheLoai + "'";

            ExecuteNonQuery(sqlQuery);
        }
コード例 #3
0
        private void btSua_Click(object sender, RoutedEventArgs e)
        {
            TheLoai theLoai = new TheLoai() { MaTheLoai = tbMaTheLoai.Text, TenTheLoai = tbTenTheLoai.Text, GhiChu = tbGhiChu.Text };

            TheLoaiBUS bus = new TheLoaiBUS();

            try
            {
                bus.Update(theLoai);

                MessageBox.Show("Sửa thành công !");
            }
            catch (Exception)
            {
                MessageBox.Show("Sửa thất bại !");
            }
            
            LoadData();
        }
コード例 #4
0
        private void btThem_Click(object sender, RoutedEventArgs e)
        {
            TheLoai theLoai = new TheLoai() { MaTheLoai = (++id).ToString(), TenTheLoai = tbTenTheLoai.Text, GhiChu = tbGhiChu.Text };
          
            TheLoaiBUS bus = new TheLoaiBUS();

            try
            {
                bus.Insert(theLoai);

                MessageBox.Show("Thêm thành công !");
            }
            catch (Exception)
            {
                MessageBox.Show("Thêm thất bại !");
            }
           

            LoadData();
        }
コード例 #5
0
        public List<TheLoai> GetList()
        {
            List<TheLoai> list = new List<TheLoai>();

            string sqlQuery = "select * from TheLoai";

            reader = ExecuteReader(sqlQuery);

            while (reader.Read())
            {
                TheLoai tacGia = new TheLoai();

                tacGia.MaTheLoai = reader["MaTheLoai"].ToString();
                tacGia.TenTheLoai = reader["TenTheLoai"].ToString();
                tacGia.GhiChu = reader["GhiChu"].ToString();

                list.Add(tacGia);
            }

            return list;
        }
コード例 #6
0
 public void Update(TheLoai info)
 {
     data.Update(info);
 }
コード例 #7
0
 public void Insert(TheLoai info)
 {
     data.Insert(info);
 }