Beispiel #1
0
        private void btnTraSach_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
Cont:
            //Kiểm tra xem form DangNhap được mở hay đóng, nếu đóng thì tạo mới
            if (dx == null || dx.IsDisposed)
            {
                dx = new frmTraSach();
            }
            //dn.ShowDialog();
            //khi nhấn đăng nhập
            if (dx.ShowDialog() == DialogResult.OK)
            {
                if (dx.check == 0)
                {
                    goto Cont;
                }
                //Set lại menu theo quyền
                else
                {
                    string maSach = dx.maSach;
                    MuonTra_BUS.TraSach(maSach, "", DateTime.Now);
                    MessageBox.Show("Trả hoàn tất");
                    //cập nhật trên gridview
                    Load();
                    string maDS = gvDauSach.GetFocusedRowCellValue(colMaDS).ToString();
                    SbindingSource.DataSource = Sach_BUS.LoadDSSach(maDS);
                    gcSach.DataSource         = SbindingSource;
                }
            }
            //khi nhấn thoát
            else
            {
                dx.Hide();
            }
        }
Beispiel #2
0
 private void gvDauSach_FocusedRowChanged(object sender, DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs e)
 {
     if (gvDauSach.FocusedRowHandle >= 0)
     {
         string maDS = gvDauSach.GetFocusedRowCellValue(colMaDS).ToString();
         SbindingSource.DataSource = Sach_BUS.LoadDSSach(maDS);
         gcSach.DataSource         = SbindingSource;
         tbTenDS.Text       = gvDauSach.GetFocusedRowCellValue(colTenDS).ToString();
         gvSach.ViewCaption = tbTenDS.Text;
     }
 }
Beispiel #3
0
 private void barButtonItem2_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
 {
     Load();
     if (gvDauSach.FocusedRowHandle >= 0)
     {
         string maDS = gvDauSach.GetFocusedRowCellValue(colMaDS).ToString();
         SbindingSource.DataSource = Sach_BUS.LoadDSSach(maDS);
         gcSach.DataSource         = SbindingSource;
         tbTenDS.Text       = gvDauSach.GetFocusedRowCellValue(colTenDS).ToString();
         gvSach.ViewCaption = tbTenDS.Text;
     }
 }
Beispiel #4
0
 private void btnLuu_Click(object sender, EventArgs e)
 {
     nbcDS.OptionsNavPane.NavPaneState = DevExpress.XtraNavBar.NavPaneState.Collapsed;
     if (!them)
     {
         string maDS = gvDauSach.GetFocusedRowCellValue(colMaDS).ToString();
         int    sl   = Convert.ToInt32(tbSoLuong.Text);
         for (int i = 1; i <= sl; i++)
         {
             string maSach = nextMa(Sach_BUS.LastMaSach());
             Sach_BUS.themSach(maDS, maSach, "Tốt", "Không");
             SbindingSource.DataSource = Sach_BUS.LoadDSSach(maDS);
             gcSach.DataSource         = SbindingSource;
             Load();
         }
         MessageBox.Show("Thêm thành công!");
         them = true;
         tbSoLuong.Clear();
     }
 }