Пример #1
0
        private void btnAddStock_Click(object sender, EventArgs e)
        {
            if (!TextUtil.IsNull(txtAddStockCompanyName.Text) &&
                !TextUtil.IsNull(txtAddStockUnitPrice.Text) &&
                !TextUtil.IsNull(txtAddStockQuantity.Text) &&
                TextUtil.IsDigit(txtAddStockQuantity.Text) &&
                TextUtil.IsMoney(txtAddStockUnitPrice.Text))
            {
                Stock stock = new Stock()
                {
                    Item_Id     = selectedStockItem.Id,
                    CompanyName = txtAddStockCompanyName.Text,
                    Quantity    = Convert.ToInt32(txtAddStockQuantity.Text),
                    UnitPrice   = TextUtil.ParseMoney(txtAddStockUnitPrice.Text),
                    TotalPrice  = Convert.ToInt32(txtAddStockQuantity.Text) * TextUtil.ParseMoney(txtAddStockUnitPrice.Text),
                    CreatedAt   = DateTime.Now,
                };
                userController.ManageStock(stock, EntityState.Added);

                int lastStockCount = Convert.ToInt32(lblAddStockItemStockQuantity.Text);
                lblAddStockItemStockQuantity.Text = lastStockCount++.ToString();

                AnimationUtil.HideSync(pnlAddStockFailAlert);
                AnimationUtil.ShowSync(pnlAddStockSuccessAlert);
            }
            else
            {
                AnimationUtil.HideSync(pnlAddStockSuccessAlert);
                AnimationUtil.ShowSync(pnlAddStockFailAlert);
            }
            BorrowItems = userController.GetItems(true).ToList();
            ListUtil.InitializeListView(mlvSearchItemForAddStock, BorrowItems);
        }
Пример #2
0
        private void InitializeDetails()
        {
            tbcReport.SelectedTab = tbpReportByEmployee;
            Files = FileUtil.GetFileList()
                    .OrderByDescending(x => x.CreationTime).ToList();

            if (isReporterAdmin)
            {
                Users       = userController.GetAllUsers(true);
                Departments = userController.GetDepartments();
            }
            else
            {
                Users = userController.GetAllUsers(true)
                        .Where(x => x.Department_Id.Equals(userController.GetUser().Department_Id)).ToList();
                Departments = userController.GetDepartments()
                              .Where(x => x.Id.Equals(userController.GetUser().Department_Id)).ToList();
                cboxIsActive.Enabled = false;
                cboxIsActive.Checked = false;
                lblSearchEmployeeContainPassives.Enabled = false;
            }

            ListUtil.InitializeListView(mlvEmployeeReport, Users.OrderByDescending(x => x.Borrows.Count).ToList());

            ListUtil.InitializeListView(mlvDepartments, Departments.OrderByDescending(x => x.Users.Count).ToList());

            ListUtil.InitializeListView(mlvReports, Files);
        }
Пример #3
0
        // Search By parameters after selected from dropdown list
        private void dropEmployeeSearchKey_onItemSelected(object sender, EventArgs e)
        {
            string searchVal = txtSearchEmployee.Text.ToLower();

            Users = userController.GetAllUsers(withPassives);
            switch (dropEmployeeSearchKey.selectedIndex)
            {
            case 0:
                Users = Users.Where(x => x.Username.ToLower().Contains(searchVal)).ToList();
                break;

            case 1:
                Users = Users.Where(x => x.Employee.FirstName.ToLower().Contains(searchVal)).ToList();
                break;

            case 2:
                Users = Users.Where(x => x.Employee.LastName.ToLower().Contains(searchVal)).ToList();
                break;

            case 3:
                Users = Users.Where(x => x.Department.Name.ToLower().Contains(searchVal)).ToList();
                break;

            case 4:
                Users = Users.Where(x => x.Role.Name.ToLower().Contains(searchVal)).ToList();
                break;

            default:
                Users = Users.Where(x => x.Username.ToLower().Contains(searchVal)).ToList();
                break;
            }

            ListUtil.InitializeListView(mlvUsers, Users);
        }
Пример #4
0
        // Select Borrower User Screen Dropdownbox operations
        private void dropSelectBorrowerUserDepartment_onItemSelected(object sender, EventArgs e)
        {
            switch (dropSelectBorrowerUserDepartment.selectedIndex)
            {
            case -1:
                Users = userController.GetAllUsers(false)
                        .Where(x => x.Employee.FirstName.ToLower()
                               .Contains(txtSearchBorrower.Text.ToLower()) ||
                               x.Employee.FirstName.ToLower()
                               .Contains(txtSearchBorrower.Text.ToLower()))
                        .ToList();
                break;

            default:
                Users = userController.GetAllUsers(false).Where(x =>
                                                                x.Department.Name.Equals(dropSelectBorrowerUserDepartment.selectedValue))
                        .Where(x => x.Employee.FirstName.ToLower()
                               .Contains(txtSearchBorrower.Text.ToLower()) ||
                               x.Employee.FirstName.ToLower()
                               .Contains(txtSearchBorrower.Text.ToLower()))
                        .ToList();
                break;
            }
            ListUtil.InitializeListView(mlvSelectBorrowerUsers, Users);
        }
Пример #5
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();
        }
Пример #6
0
        private void btnUpdateStock_Click(object sender, EventArgs e)
        {
            if (!TextUtil.IsNull(txtUpdateStockCompanyName.Text) &&
                !TextUtil.IsNull(txtUpdateStockUnitPrice.Text) &&
                !TextUtil.IsNull(txtUpdateStockQuantity.Text) &&
                TextUtil.IsDigit(txtUpdateStockQuantity.Text) &&
                TextUtil.IsMoney(txtUpdateStockUnitPrice.Text))
            {
                selectedStock.Quantity    = Convert.ToInt32(txtUpdateStockQuantity.Text);
                selectedStock.UnitPrice   = TextUtil.ParseMoney(txtUpdateStockUnitPrice.Text);
                selectedStock.TotalPrice  = selectedStock.Quantity * selectedStock.UnitPrice;
                selectedStock.UpdatedAt   = DateTime.Now;
                selectedStock.CompanyName = txtUpdateStockCompanyName.Text;
                userController.ManageStock(selectedStock, EntityState.Modified);

                AnimationUtil.HideSync(pnlUpdateStockFailAlert);
                AnimationUtil.ShowSync(pnlUpdateStockSuccessfulAlert);
                btnUpdateStock.Enabled = false;
            }
            else
            {
                AnimationUtil.HideSync(pnlUpdateStockSuccessfulAlert);
                AnimationUtil.ShowSync(pnlUpdateStockFailAlert);
            }
            Stocks = userController.GetItems(true).SelectMany(x => x.Stocks).ToList();
            ListUtil.InitializeListView(mlvSearchStock, Stocks, userController.GetItems(true));
        }
Пример #7
0
 private void InitializeDetails()
 {
     // Fills the listview with lists required
     Items    = userController.GetItems(true);
     Garbages = Items.SelectMany(x => x.Garbages).ToList();
     ListUtil.InitializeListView(mlvManageGarbage, Garbages, Items);
 }
Пример #8
0
        // Select Refunders department dropbox
        private void dropSelectRefunderDepartment_onItemSelected(object sender, EventArgs e)
        {
            Users = userController.GetAllUsers(false)
                    .Where(x => x.Department.Name.Equals(dropSelectRefunderDepartment.selectedValue)).ToList();

            Borrows = RefundItems.SelectMany(x => x.Borrows.Where(y => !y.IsReturn)).ToList().Where(x => Users.Any(y => y.Id.Equals(x.User_Id))).ToList();
            ListUtil.InitializeListView(mlvSelectRefunderUser, Borrows, Users);
        }
Пример #9
0
        private void InitializeDetails()
        {
            txtManageDepartmentsAdd.Text    = "";
            txtManageDepartmentUpdate.Text  = "";
            txtManageDepartmentsSearch.Text = "";

            selectedDepartmentIndex = -1;
            Departments             = userController.GetDepartments();
            ListUtil.InitializeListView(mlvDepartments, Departments);
        }
Пример #10
0
        //Select Item Stock
        private void mlvSelectRefundItemStock_ItemSelectionChanged(object sender, ListViewItemSelectionChangedEventArgs e)
        {
            if (e.IsSelected)
            {
                selectedRefundedItemStock = mlvSelectRefundItemStock.FocusedItem.Index;
                selectedRefundBorrow      = selectedRefunderUser.Borrows.Where(x => !x.IsReturn).ElementAt(selectedRefundedItemStock);
                selectedItem = RefundItems.FirstOrDefault(x => x.Id.Equals(selectedRefundBorrow.Item_Id));

                SelectedItems = new List <int>();
                ListUtil.InitializeListView(mlvSelectRefundItem, Borrows.Where(x => x.Id.Equals(selectedRefundBorrow.Id)).ToList(), RefundItems, (int)selectedRefundBorrow.Quantity);
                tbcManageRefund.SelectedTab = tbpAcceptRefund;
            }
        }
Пример #11
0
        // Item List Selected Operations
        private void mlvSearchBorrowItem_ItemSelectionChanged(object sender, ListViewItemSelectionChangedEventArgs e)
        {
            if (e.IsSelected)
            {
                selectedBorrowItemIndex = mlvSearchBorrowItem.FocusedItem.Index;
                selectedBorrowItem      = Items.ElementAt(selectedBorrowItemIndex);

                Stocks = selectedBorrowItem.Stocks.Count != 0 ? selectedBorrowItem.Stocks.ToList() : new List <Stock>();
                ListUtil.InitializeListView(mlvSearchBorrowStock, Stocks);

                tbcBorrow.SelectedTab = tbpSelectBorrowStock;
            }
        }
Пример #12
0
 // Search Departments by name
 private void txtManageDepartmentsSearch_OnValueChanged(object sender, EventArgs e)
 {
     txtManageDepartmentsSearch.Text = txtManageDepartmentsSearch.MaximumLength(200);
     if (isReporterAdmin)
     {
         Departments = userController.GetDepartments().Where(x => x.Name.ToLower().Contains(txtManageDepartmentsSearch.Text.ToLower())).ToList();
     }
     else
     {
         Departments = userController.GetDepartments().Where(x => x.Id.Equals(userController.GetUser().Department_Id) && x.Name.ToLower().Contains(txtManageDepartmentsSearch.Text.ToLower())).ToList();
     }
     ListUtil.InitializeListView(mlvDepartments, Departments);
 }
Пример #13
0
        private void InitializeDetails()
        {
            // Search Stock Tab
            Stocks = userController.GetItems(true).SelectMany(x => x.Stocks).ToList();
            ListUtil.InitializeListView(mlvSearchStock, Stocks, userController.GetItems(true));

            // Add Stock Tab
            BorrowItems = userController.GetItems(true).ToList();
            ListUtil.InitializeListView(mlvSearchItemForAddStock, BorrowItems);

            // Add Item Tab
            Items = userController.GetItems(true).ToList();
            ListUtil.InitializeListView(mlvAddItemSearch, Items);
        }
Пример #14
0
        // Select Refunder User
        private void mlvSelectRefunderUser_ItemSelectionChanged(object sender, ListViewItemSelectionChangedEventArgs e)
        {
            if (e.IsSelected)
            {
                selectedRefunderUserIndex = mlvSelectRefunderUser.FocusedItem.Index;
                selectedRefunderUser      = Users.ElementAt(selectedRefunderUserIndex);

                RefundItems = userController.GetItems(true).Where(x => x.Borrows.Any(y => !y.IsReturn)).ToList();
                ListUtil.InitializeListView(mlvSelectRefundItemStock, selectedRefunderUser.Borrows.Where(x => !x.IsReturn).ToList(), RefundItems);

                selectedRefundedItemStock   = -1;
                tbcManageRefund.SelectedTab = tbpSelectRefundedItem;
            }
        }
Пример #15
0
        private void UpdateRefundItemList()
        {
            selectedItemIndex = -1;
            RefundItems       = userController.GetItems(true);
            Borrows           = RefundItems.SelectMany(x => x.Borrows).Where(x => x.IsReturn == false).ToList();

            if (selectedRefundBorrow != null)
            {
                selectedRefundBorrow = Borrows.First(x => x.Item_Id.Equals(selectedItem.Id) &&
                                                     x.User_Id.Equals(selectedRefunderUser.Id));
                ListUtil.InitializeListView(mlvSelectRefundItem,
                                            Borrows.Where(x => x.Id.Equals(selectedRefundBorrow.Id)).ToList(), RefundItems,
                                            (int)selectedRefundBorrow.Quantity);
            }
        }
Пример #16
0
        // Search borrow item operations
        private void mlvSearchBorrowStock_ItemSelectionChanged(object sender, ListViewItemSelectionChangedEventArgs e)
        {
            if (e.IsSelected)
            {
                selectedBorrowStockIndex = mlvSearchBorrowStock.FocusedItem.Index;
                selectedBorrowStock      = Stocks.ElementAt(selectedBorrowStockIndex);

                Users       = userController.GetAllUsers(false);
                Departments = userController.GetDepartments();

                ListUtil.InitializeListView(mlvSelectBorrowerUsers, Users);
                ListUtil.InitializeDropdownList(dropSelectBorrowerUserDepartment, Departments);

                tbcBorrow.SelectedTab = tbpSelectBorrowerUser;
            }
        }
Пример #17
0
 private void btnDeleteItem_Click(object sender, EventArgs e)
 {
     if (managedItem != null)
     {
         userController.ManageItem(managedItem, EntityState.Deleted);
         lblUpdateItemFailAlert.Visible       = false;
         lblUpdateItemSuccessfulAlert.Visible = true;
     }
     else
     {
         lblUpdateItemSuccessfulAlert.Visible = false;
         lblUpdateItemFailAlert.Visible       = true;
     }
     Items = userController.GetItems(true).ToList();
     ListUtil.InitializeListView(mlvAddItemSearch, Items);
 }
Пример #18
0
        // Search By dropdown operations in Select Item screen
        private void dropSearchBorrowItemBy_onItemSelected(object sender, EventArgs e)
        {
            switch (dropSearchBorrowItemBy.selectedIndex)
            {
            case 1:
                Items = userController.GetItems(false)
                        .Where(x => x.Description.ToLower().Contains(txtSearchBorrowItem.Text.ToLower())).ToList();
                break;

            default:
                Items = userController.GetItems(false)
                        .Where(x => x.Name.ToLower().Contains(txtSearchBorrowItem.Text.ToLower())).ToList();
                break;
            }
            ListUtil.InitializeListView(mlvSearchBorrowItem, Items);
        }
Пример #19
0
        private void btnDeleteStock_Click(object sender, EventArgs e)
        {
            if (selectedStock != null && selectedStock.Quantity != 0)
            {
                userController.AddGarbage(selectedStock, Convert.ToInt32(selectedStock.Quantity));

                AnimationUtil.HideSync(pnlUpdateStockFailAlert);
                AnimationUtil.ShowSync(pnlUpdateStockSuccessfulAlert);
            }
            else
            {
                AnimationUtil.HideSync(pnlUpdateStockSuccessfulAlert);
                AnimationUtil.ShowSync(pnlUpdateStockFailAlert);
            }
            Stocks = userController.GetItems(true).SelectMany(x => x.Stocks).ToList();
            ListUtil.InitializeListView(mlvSearchStock, Stocks, userController.GetItems(true));
        }
Пример #20
0
        private void txtSearchBorrowStock_OnValueChanged(object sender, EventArgs e)
        {
            txtSearchBorrowStock.Text = txtSearchBorrowStock.MaximumLength(200);
            if (selectedBorrowItem != null)
            {
                if (TextUtil.IsNull(txtSearchBorrowStock.Text))
                {
                    Stocks = selectedBorrowItem.Stocks.ToList();
                }
                else
                {
                    Stocks = selectedBorrowItem.Stocks.Where(x => x.CompanyName.ToLower().Contains(txtSearchBorrowStock.Text.ToLower())).ToList();
                }

                ListUtil.InitializeListView(mlvSearchBorrowStock, Stocks);
            }
        }
Пример #21
0
        private void InitializeDetails()
        {
            ClearManageUserTextboxes();

            Users       = userController.GetAllUsers(true);
            Departments = userController.GetDepartments();
            Roles       = userController.GetRoles();
            ListUtil.InitializeDropdownList(dropManageEmployeeDepartment, Departments);
            ListUtil.InitializeDropdownList(dropManageEmployeeRole, Roles);

            selectedUserIndex = -1;
            ListUtil.InitializeListView(mlvUsers, Users);

            tbcEmployee.SelectedTab = tbpSearchEmployee;
            tbpManageEmployee.Text  = "Add Employee";
            btnManageEmployeeSubmit.BringToFront();
        }
Пример #22
0
        private void dropSelectRefunderSearchBy_onItemSelected(object sender, EventArgs e)
        {
            dropSelectRefunderDepartment_onItemSelected(this, e);
            switch (dropSelectRefunderSearchBy.selectedIndex)
            {
            case 1:
                Users = Users.Where(x => x.Employee.FirstName.ToLower().Contains(txtSelectRefunder.Text.ToLower()) ||
                                    x.Employee.LastName.ToLower().Contains(txtSelectRefunder.Text.ToLower())).ToList();
                break;

            default:
                Users = Users.Where(x => x.Username.ToLower().Contains(txtSelectRefunder.Text.ToLower())).ToList();
                break;
            }

            Borrows = RefundItems.SelectMany(x => x.Borrows.Where(y => !y.IsReturn)).ToList().Where(x => Users.Any(y => y.Id.Equals(x.User_Id))).ToList();
            ListUtil.InitializeListView(mlvSelectRefunderUser, Borrows, Users);
        }
Пример #23
0
        private void dropManageGarbageSearchBy_onItemSelected(object sender, EventArgs e)
        {
            // Set Filter Options Of Items With Selected Parameters
            Items = userController.GetItems(true);
            switch (dropManageGarbageSearchBy.selectedIndex)
            {
            case 1:
                Garbages = Items.Where(x => x.Stocks.Any(y => y.CompanyName.ToLower().Contains(txtManageGarbageSearch.Text.ToLower())))
                           .SelectMany(x => x.Garbages).ToList();
                break;

            default:
                Garbages = Items.Where(x => x.Name.ToLower().Contains(txtManageGarbageSearch.Text.ToLower()))
                           .SelectMany(x => x.Garbages).ToList();
                break;
            }

            ListUtil.InitializeListView(mlvManageGarbage, Garbages, Items);
        }
Пример #24
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);
        }
Пример #25
0
        private void dropSearchStockSearchBy_onItemSelected(object sender, EventArgs e)
        {
            IList <Item> searchItems = userController.GetItems(false);

            switch (dropSearchStockSearchBy.selectedIndex)
            {
            case 1:
                searchItems = searchItems
                              .Where(x => x.Stocks.Any(y => y.CompanyName.ToLower().Contains(txtSearchStock.Text.ToLower()))).ToList();
                break;

            default:
                searchItems = searchItems
                              .Where(x => x.Name.ToLower().Contains(txtSearchStock.Text.ToLower())).ToList();
                break;
            }

            Stocks = searchItems.SelectMany(x => x.Stocks).ToList();
            ListUtil.InitializeListView(mlvSearchStock, Stocks, searchItems);
        }
Пример #26
0
        private void btnUpdateItem_Click(object sender, EventArgs e)
        {
            if (!TextUtil.IsNull(txtUpdateItemName.Text) && !TextUtil.IsNull(txtUpdateItemDescription.Text))
            {
                managedItem.Name        = txtUpdateItemName.Text;
                managedItem.Description = txtUpdateItemDescription.Text;
                userController.ManageItem(managedItem, EntityState.Modified);
                lblUpdateItemFailAlert.Visible       = false;
                lblUpdateItemSuccessfulAlert.Visible = true;
            }
            else
            {
                lblUpdateItemSuccessfulAlert.Visible = false;
                lblUpdateItemFailAlert.Visible       = true;
            }

            selectedManageItemIndex = -1;
            managedItem             = null;
            Items = userController.GetItems(true).ToList();
            ListUtil.InitializeListView(mlvAddItemSearch, Items);
        }
Пример #27
0
        private void dropSelectRefundItemSearchBy_onItemSelected(object sender, EventArgs e)
        {
            switch (dropSelectRefundItemSearchBy.selectedIndex)
            {
            case 1:
                RefundItems = userController.GetItems(true)
                              .Where(x => x.Stocks.Any(y => y.CompanyName.ToLower().Contains(txtSearchRefundItem.Text.ToLower()))).ToList();
                break;

            default:
                RefundItems = userController.GetItems(true)
                              .Where(x => x.Name.ToLower().Contains(txtSearchRefundItem.Text.ToLower())).ToList();
                break;
            }

            if (selectedRefunderUser != null)
            {
                Borrows = selectedRefunderUser.Borrows.Where(x => !x.IsReturn).ToList().Where(x => RefundItems.Any(y => y.Id.Equals(x.Item_Id))).ToList();
                ListUtil.InitializeListView(mlvSelectRefundItemStock, Borrows, RefundItems);
            }
        }
Пример #28
0
 private void btnAddItem_Click(object sender, EventArgs e)
 {
     if (!TextUtil.IsNull(txtAddItemName.Text) && !TextUtil.IsNull(txtAddItemDescription.Text))
     {
         Item item = new Item()
         {
             Name        = txtAddItemName.Text,
             Description = txtAddItemDescription.Text,
             IsActive    = true,
         };
         userController.ManageItem(item, EntityState.Added);
         lblAddItemFailAlert.Visible       = false;
         lblAddItemSuccessfulAlert.Visible = true;
     }
     else
     {
         lblAddItemSuccessfulAlert.Visible = false;
         lblAddItemFailAlert.Visible       = true;
     }
     Items = userController.GetItems(true).ToList();
     ListUtil.InitializeListView(mlvAddItemSearch, Items);
 }
Пример #29
0
        // When user clicks tabs in the tab control it prepares tab content for operations
        private void tbsEmployee_MouseClick(object sender, MouseEventArgs e)
        {
            if (tbcEmployee.SelectedTab == tbpManageEmployee)
            {
                btnManageEmployeeDelete.Text = "RESET";
                btnManageEmployeeDelete_Click(this, e);
                btnManageEmployeeSubmit.BringToFront();
                txtManageEmployeeUsername.Enabled = true;
                selectedUserIndex = -1;

                tbpManageEmployee.Text = "Add Employee";
            }

            if (tbcEmployee.SelectedTab == tbpSearchEmployee)
            {
                ListUtil.InitializeListView(mlvUsers, Users);
                InitializeDetails();
            }

            pnlManageFailAlert.Visible       = false;
            pnlManageSuccessfulAlert.Visible = false;
        }
Пример #30
0
 // Search Departments by name
 private void txtManageDepartmentsSearch_OnValueChanged(object sender, EventArgs e)
 {
     txtManageDepartmentsSearch.Text = txtManageDepartmentsSearch.MaximumLength(200);
     Departments = userController.GetDepartments().Where(x => x.Name.ToLower().Contains(txtManageDepartmentsSearch.Text.ToLower())).ToList();
     ListUtil.InitializeListView(mlvDepartments, Departments);
 }