Example #1
0
        private void button2_Click(object sender, EventArgs e)
        {
            if (txbMaDauSach.Text.Length == 0)
            {
                MessageBox.Show("Mã đầu sách không được trống");
                return;
            }
            AddDauSach temp = new AddDauSach();

            temp.MaDauSach  = txbMaDauSach.Text;
            temp.TenDauSach = txbTenDauSach.Text;
            temp.TenTacGia  = txbTacGia.Text;
            temp.NgonNgu    = txbNgonNgu.Text;
            temp.TenTheLoai = txbTheLoai.Text;
            temp.NXB        = txbNXB.Text;
            if (SBLL.ThemDauSach(temp))
            {
                MessageBox.Show("Thêm đầu sách thành công");
                ThemThanhCong = true;
                this.Dispose();
            }
            else
            {
                MessageBox.Show("Thêm đầu sách thất bại");
            }
        }
Example #2
0
        public bool ThemDauSach(AddDauSach temp)
        {
            OpenConnection();
            SqlCommand command = new SqlCommand();

            command.CommandType = CommandType.StoredProcedure;
            command.CommandText = "ThemDauSach";
            command.Connection  = conn;

            command.Parameters.Add("@madausach", SqlDbType.NChar).Value     = temp.MaDauSach;
            command.Parameters.Add("@tendausach", SqlDbType.NVarChar).Value = temp.TenDauSach;
            command.Parameters.Add("@tacgia", SqlDbType.NVarChar).Value     = temp.TenTacGia;
            command.Parameters.Add("@NXB", SqlDbType.NVarChar).Value        = temp.NXB;
            command.Parameters.Add("@theloai", SqlDbType.NVarChar).Value    = temp.TenTheLoai;
            command.Parameters.Add("@ngonngu", SqlDbType.NVarChar).Value    = temp.NgonNgu;

            int kq = command.ExecuteNonQuery();

            return(kq > 0);
        }
Example #3
0
 public bool ThemDauSach(AddDauSach temp)
 {
     return(SAC.ThemDauSach(temp));
 }