コード例 #1
0
 private void setToDTOSach(DataGridViewRow dt)
 {
     sach             = new DTO.DTO_Sach();
     sach.maSach      = dt.Cells["colMaSach"].Value.ToString();
     sach.maTL        = dt.Cells["colMaTL"].Value.ToString();
     sach.tenSach     = dt.Cells["colTenSach"].Value.ToString();
     sach.hoTenTG     = dt.Cells["colHoTenTG"].Value.ToString();
     sach.soLuong     = Convert.ToInt32(dt.Cells["colSoLuong"].Value.ToString());
     sach.giaSach     = Convert.ToInt32(dt.Cells["colGiaSach"].Value.ToString());
     sach.ngayXuatBan = dt.Cells["colNgayXuatBan"].Value.ToString();
 }
コード例 #2
0
 private void setControl(DTO.DTO_Sach sach)
 {
     if (!string.IsNullOrEmpty(sach.maSach))
     {
         SqlParameter pa = new SqlParameter("HoTenTG", sach.hoTenTG);
         DataTable    tg = dt.sqlLayDuLieu("PSP_ShowMaTG", pa);
         txtMaSach.Text          = sach.maSach;
         txtTenSach.Text         = sach.tenSach;
         cmbTheLoai.SelectedItem = sach.maTL.ToString();
         cmbTacGia.SelectedItem  = tg.Rows[0]["MaTG"].ToString();
         txtGiaSach.Text         = Convert.ToInt32(sach.giaSach).ToString();
         dtpNgayXB.Text          = sach.ngayXuatBan;
         txtSoLuong.Text         = Convert.ToInt32(sach.soLuong).ToString();
     }
 }
コード例 #3
0
 private void toolStripButton2_Click(object sender, EventArgs e)
 {
     if (sach != null)
     {
         frm_capnhat sua = new frm_capnhat();
         sua.them = false;
         sua.sach = this.sach;
         sua.ShowDialog();
         DataTable dulieu = dt.sqlLayDuLieu("PSP_ThongKeSachCon");
         dgvSach.DataSource = dulieu;
         this.sach          = null;
     }
     else
     {
         MessageBox.Show("Chưa chọn sách cần sửa", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
     }
 }