コード例 #1
0
        private void ribeAction_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e)
        {
            if (e.Button.Kind == ButtonPredefines.Ellipsis)
            {

            }
            else
            {
                if (e.Button.Kind == ButtonPredefines.Delete)
                {
                    CopyBUS copyBus = new CopyBUS();
                    CopyDTO dto = (CopyDTO)grvCopyDetail.GetFocusedRow();
                    if (dto.Status == (int)CopyStatus.AVAILABLE)
                    {
                        if (copyBus.DeleteCopy(dto, null) == 1)
                        {
                            _listCopy.Remove(dto);
                            _copyResult.Remove(dto);
                            grdDetailedCopy.RefreshDataSource();

                            _catalogue.NumberOfCopies--;
                            if (dto.Status == (int) CopyStatus.AVAILABLE)
                            {
                                _catalogue.AvailableCopies--;
                            }

                            CatalogueBUS bus = new CatalogueBUS();
                            if (bus.UpdateCatalogue(_catalogue, null) == 0)
                            {
                                MessageBox.Show("Có lỗi trong quá trình xóa bản sao !!!");
                            }
                            MessageBox.Show("Đã xóa bản sao thành công !!!");
                        }
                        else
                        {
                            MessageBox.Show("Xóa bản sao thất bại !!!");
                        }
                    }
                    else
                    {
                        MessageBox.Show("Không thể xoá bản sao này vì bản sao đã bị xoá hoặc đang được mượn!");
                    }
                }
            }
        }
コード例 #2
0
        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();
        }