Exemple #1
0
        private void InitializeDetails()
        {
            tbcManageItems.SelectedTab    = tbpBorrowItem;
            tbcBorrow.SelectedTab         = tbpSearchBorrowItem;
            tbpSelectBorrowerUser.Visible = false;

            // Borrow Tab
            Items = userController.GetItems(false);
            selectedBorrowItemIndex = -1;
            ListUtil.InitializeListView(mlvSearchBorrowItem, Items);

            // Refund Tab
            RefundItems = userController.GetItems(true);
            Borrows     = RefundItems.SelectMany(x => x.Borrows.Where(y => !y.IsReturn)).ToList();
            ListUtil.InitializeListView(mlvSelectRefunderUser, Borrows, userController.GetAllUsers(true));


            Departments = userController.GetDepartments();
            ListUtil.InitializeDropdownList(dropSelectRefunderDepartment, Departments);
        }
Exemple #2
0
        public void Update()
        {
            List <RefundItem> NotDeletedItems = RefundItems == null ? new List <RefundItem>() : RefundItems.Where(ri =>
                                                                                                                  ri.Status != RefundItemStatus.DELETED).ToList();

            //Status
            if (!NotDeletedItems.Any() ||
                NotDeletedItems.Any(ri => ri.Status == RefundItemStatus.UPDATED || ri.Status == RefundItemStatus.CREATED))
            {
                Status = RefundStatus.NON_EXISTENT;
            }
            else if (NotDeletedItems.All(r => r.Status == RefundItemStatus.REJECTED_NO_APPEAL))
            {
                Status = RefundStatus.REJECTED;
            }
            else if (NotDeletedItems.All(r => r.Status == RefundItemStatus.PAID || r.Status == RefundItemStatus.REJECTED_NO_APPEAL))
            {
                Status = RefundStatus.PAID;
            }
            else if (NotDeletedItems.All(r => r.Status == RefundItemStatus.ACCEPTED || r.Status == RefundItemStatus.REJECTED_NO_APPEAL || r.Status == RefundItemStatus.PAID))
            {
                Status = PaymentDate == SqlDateTime.MinValue.Value ? RefundStatus.ACCEPTED : RefundStatus.TO_BE_PAID;
            }
            else if (NotDeletedItems.Any(r => r.Status == RefundItemStatus.REJECTED))
            {
                Status = RefundStatus.WAITING_FOR_FREELANCER;
            }
            else
            {
                Status = RefundStatus.WAITING_FOR_MANAGER;
            }

            //Value
            Value = NotDeletedItems.Count > 0 ? NotDeletedItems.Sum(item => item.Value) : 0;

            //Approved Value
            AcceptedValue = RefundItems == null ? 0 : RefundItems.Sum(item => (item.Status == RefundItemStatus.ACCEPTED ||
                                                                               item.Status == RefundItemStatus.PAID) && item.Status != RefundItemStatus.DELETED ? item.Value : 0);
        }