public List<CopyDTO> GetCopyByISBN(String isbn)
        {
            List<CopyDTO> list = new List<CopyDTO>();

            try
            {
                SqlDataReader reader = ConnectionManager.GetCommand("SP0501ISBN",
                                                                    new Dictionary<string, SqlDbType>() {{"@Param1",SqlDbType.NVarChar} },
                                                                    new List<object>() { isbn }).ExecuteReader();

                while (reader.Read())
                {
                    CopyDTO copyDto = new CopyDTO();
                    copyDto.Barcode = reader["Barcode"].ToString();
                    copyDto.ISBN = reader["ISBN"].ToString();
                    copyDto.Status = int.Parse(reader["Status"].ToString());
                    copyDto.CreatedDate = (DateTime)reader["CreatedDate"];
                    copyDto.UpdatedDate = (DateTime)reader["UpdatedDate"];
                    list.Add(copyDto);
                }

                reader.Close();
            }
            catch (Exception e)
            {
                Log.Error("Error at AuthorDAO - GetAllAuthor", e);
                return null;
            }

            return list;
        }
        public CopyDTO GetCopyById(String barcode)
        {
            CopyDTO copyDto = null;

            try
            {
                SqlDataReader reader = ConnectionManager.GetCommand("SP0501BC",
                                                                    new Dictionary<string, SqlDbType>() { { "@Param1", SqlDbType.NVarChar } },
                                                                    new List<object>() { barcode }).ExecuteReader();

                if (reader.Read())
                {
                    copyDto = new CopyDTO();
                    copyDto.Barcode = reader["Barcode"].ToString();
                    copyDto.ISBN = reader["ISBN"].ToString();
                    copyDto.Status = int.Parse(reader["Status"].ToString());
                    copyDto.CreatedDate = (DateTime)reader["CreatedDate"];
                    copyDto.UpdatedDate = (DateTime)reader["UpdatedDate"];
                }
            }
            catch (Exception e)
            {
                Log.Error("Error at CopyDAO - GetCopyByID", e);
                return null;
            }

            return copyDto;
        }
        private void btnOk_Click(object sender, EventArgs e)
        {
            int NoC;
            bool isOK = int.TryParse(txtNumber.Text, out NoC);
            _barcodeList = Feature.GenerateBarcode(_catalogue, NoC);
            if (isOK && NoC>0)
            {
                foreach (string t in _barcodeList)
                {
                    CopyDTO copyDTO = new CopyDTO
                                          {
                                              Barcode = t,
                                              ISBN = _catalogue.ISBN,
                                              Status = (int) CopyStatus.AVAILABLE,
                                              CreatedDate = DateTime.Now,
                                              UpdatedDate = DateTime.Now
                                          };

                    CopyBUS copyBUS = new CopyBUS();
                    if (copyBUS.InsertCopy(copyDTO) == 0)
                    {
                        MessageBox.Show("Có lỗi trong quá trình thêm bản sao !!!");
                    }
                }

                _catalogue.NumberOfCopies += NoC;
                _catalogue.AvailableCopies += NoC;

                CatalogueBUS catalogueBUS = new CatalogueBUS();

                if (catalogueBUS.UpdateCatalogue(_catalogue, null) == 0)
                {
                    MessageBox.Show("Có lỗi trong quá trình thêm bản sao !!!");
                }

                Options.CountOfCopy += NoC;
                Options.SaveSystemVariable();
            }
            this.Close();
        }
        public int DeleteCopy(CopyDTO copy, SqlTransaction trans)
        {
            try
            {
                ConnectionManager.GetCommand("SP0504",
                                             new Dictionary<string, SqlDbType>()
                                                 {
                                                     {"@Param1", SqlDbType.NVarChar}
                                                 },
                                             new List<object>()
                                                 {
                                                     copy.Barcode
                                                 }, trans).ExecuteNonQuery();

            }
            catch (Exception e)
            {
                Log.Error("Error at CopyDAO - DeleteCopy", e);
                return 0;
            }

            return 1;
        }
        public int UpdateCopy(CopyDTO copy)
        {
            copy.UpdatedDate = DateTime.Now;
            try
            {
                ConnectionManager.GetCommand("SP0503",
                                             new Dictionary<string, SqlDbType>()
                                                 {
                                                     {"@Param1", SqlDbType.NVarChar},
                                                     {"@Param2", SqlDbType.NVarChar},
                                                     {"@Param3", SqlDbType.Int},
                                                     {"@Param4", SqlDbType.DateTime},
                                                     {"@Param5", SqlDbType.DateTime}
                                                 },
                                             new List<object>()
                                                 {
                                                     copy.Barcode,
                                                     copy.ISBN,
                                                     copy.Status,
                                                     copy.CreatedDate,
                                                     copy.UpdatedDate
                                                 }).ExecuteNonQuery();

            }
            catch (Exception e)
            {
                Log.Error("Error at CopyDAO - UpdateCopy", e);
                return 0;
            }

            return 1;
        }