Example #1
0
        // Start Borrowing Operations
        private void btnAcceptBorrowingBorrow_Click(object sender, EventArgs e)
        {
            Items = userController.GetItems(false);
            if (selectedBorrowItem != null && selectedBorrowStock != null)
            {
                selectedBorrowItem = Items.FirstOrDefault(x => x.Id.Equals(selectedBorrowItem.Id));
            }
            else
            {
                AnimationUtil.ShowSync(pnlAcceptBorrowingFailAlert);
                return;
            }

            int quantity = Convert.ToInt32(dropBorrowItemCount.selectedValue);

            if (selectedBorrowItem != null && selectedBorrowItem.InStock >= quantity)
            {
                userController.ChargeItem(selectedBorrowItem, selectedBorrowStock, selectedBorrowerUser, quantity);

                Items = userController.GetItems(false);
                ListUtil.InitializeListView(mlvSearchBorrowItem, Items);

                //Borrows = Items.SelectMany(x => x.Borrows).Where(x => x.IsReturn == false).ToList();
                tbcBorrow.SelectedTab = tbpSearchBorrowItem;

                ClearManageBorrowItem();
            }
            else
            {
                AnimationUtil.ShowSync(pnlAcceptBorrowingFailAlert);
            }
            InitializeDetails();
        }