예제 #1
0
        private void btnBorrowReturn_Return_Click(object sender, EventArgs e)
        {
            TraSach_DTO ts_DTO = new TraSach_DTO
            {
                MaTra     = txtBorrowReturn_ReturnID.Text,
                NgayLap   = (DateTime)dtpReturnReturn_DateFound.Value,
                MaMuon    = txtBorrowReturn_BorrowID.Text,
                TrangThai = true
            };


            CTTraSach_DTO ctt_DTO = new CTTraSach_DTO
            {
                MaTra     = txtBorrowReturn_ReturnID.Text,
                MaSach    = dtgBorrow_Return.Rows[dtgBorrow_Return.SelectedRows[0].Index].Cells[2].Value.ToString(),
                NgayTra   = DateTime.Now,
                SoLuong   = int.Parse(txtBorrowReturn_Quantity.Text),
                TienThue  = 0,
                TrangThai = true
            };

            if (trasach_BUS.ThemTraSach(ts_DTO))
            {
                if (ctts_BUS.ThemCTTS(ctt_DTO) && sach_BUS.UpLoadSLTra(ctt_DTO.MaSach, ctt_DTO.SoLuong) && ctms_BUS.UpDateTraSach(ts_DTO.MaMuon, ctt_DTO.MaSach))

                {
                    frmSuccess frmSuccess = new frmSuccess(5);
                    frmSuccess.ShowDialog();
                    this.Hide();
                    frmBorrow_Return_Load(sender, e);
                }
                else
                {
                    frmFailed frmFailed = new frmFailed(5);
                    frmFailed.ShowDialog();
                }
            }
            else
            {
                frmFailed frmFailed = new frmFailed(5);
                frmFailed.ShowDialog();
            }
        }