Example #1
0
        public LookupLists GetLookupLists()
        {
            var defaultCompanyID    = _principal.CompanyId.ToString();
            var defaultDivisionID   = _principal.DivisionId.ToString();
            var defaultDepartmentID = _principal.DepartmentId.ToString();
            var countries           = _countryService.GetAllCountries();
            var currencies          = _currencyService.GetAllCurrencys();
            var customerTypes       = _customerTypeService.ListOfCustomerTypes();
            var despatchLocations   = _despatchService.GetAllDespatches();
            var packWtUnits         = _packWtUnitService.GetAllPackWtUnits();
            var ports                   = _portService.GetAllPorts();
            var porterages              = _porterageService.GetAllPorterages();
            var purchaseChargeTypes     = _purchaseChargeTypeService.GetAllPurchaseChargeTypes();
            var purchaseTypes           = _purchaseTypeService.GetAllPurchaseTypes();
            var transactionTaxLocations = _transactionTaxLocationService.GetAllTransactionLocations();
            var permissionDetails       = _permissionDetailService.GetPermissionDetailByUserID(_principal.Id);
            var companies               = _companyService.GetAllCompanies().Select(
                thisCompany => new CompanyDropDown
            {
                CompanyID   = thisCompany.CompanyID.ToString(),
                CompanyName = thisCompany.CompanyName,
                IsActive    = thisCompany.IsActive ?? true
            }
                ).ToList();
            var divisions = _divisionService.GetAllDivisions().Select(
                thisDivision => new DivisionDropDown
            {
                DivisionID   = thisDivision.DivisionID.ToString(),
                CompanyID    = thisDivision.CompanyID.ToString(),
                DivisionName = thisDivision.DivisionName,
                IsActive     = thisDivision.IsActive ?? true,
                AutogenerateConsignnmentReference = _setupGlobalService.GetSetupBooleanByNameAndDivisionID("AutogenerateConsignmentNumber", thisDivision.DivisionID) ?? true
            }
                ).ToList();
            var departments = _departmentService.GetAllDepartments().Select(
                thisDepartment => new DepartmentDropDown
            {
                DepartmentID   = thisDepartment.DepartmentID.ToString(),
                DivisionID     = thisDepartment.DivisionID.ToString(),
                DepartmentName = thisDepartment.DepartmentName,
                DepartmentCode = thisDepartment.DepartmentCode,
                IsActive       = thisDepartment.IsActive ?? true
            }
                ).ToList();

            return(new LookupLists()
            {
                DefaultCompanyID = defaultCompanyID,
                DefaultDivisionID = defaultDivisionID,
                DefaultDepartmentID = defaultDepartmentID,
                Country = countries,
                Currency = currencies,
                CustomerType = customerTypes,
                DespatchLocation = despatchLocations,
                PackWtUnit = packWtUnits,
                Port = ports,
                Porterage = porterages,
                PurchaseChargeType = purchaseChargeTypes,
                PurchaseType = purchaseTypes,
                TransactionTaxLocation = transactionTaxLocations,
                PermissionDetail = permissionDetails,
                Company = companies,
                Division = divisions,
                Department = departments
            });
        }