Esempio n. 1
0
        /// <summary>
        /// 共用貨主車主車輛下拉選單
        /// </summary>
        /// <param name="CompanyId"></param>
        public void CommonGoodsOwnerDriverVehicleDropdownList(int CompanyId)
        {
            List <int> goodOwnerLevels = new List <int>();

            goodOwnerLevels.Add((int)MemberLevelEnum.GoodsOwner);
            ViewBag.GoodOwnerList = _aspNetUsersService.GetUserSelectListItem(goodOwnerLevels, null, null);

            List <SelectListItem> driverSelectListItem = new List <SelectListItem>();

            //限制只能為自己的公司
            var user = _aspNetUsersService.GetUserModelByName(User.Identity.Name);

            driverSelectListItem.Add(new SelectListItem {
                Text = "不選擇", Value = " "
            });
            var userSelectListItems = _aspNetUsersService.GetUserSelectListItemByRole(user.CompanyId, null, RoleNameEnum.CarOwner.ToString());

            driverSelectListItem.AddRange(userSelectListItems);
            ViewBag.DriverList = driverSelectListItem;

            List <SelectListItem> vehicleLicenseNumberSelectListItem = new List <SelectListItem>();

            vehicleLicenseNumberSelectListItem.Add(new SelectListItem {
                Text = "不選擇", Value = " "
            });
            vehicleLicenseNumberSelectListItem.AddRange(_vehicleService.GetVehicleBy(CompanyId));
            ViewBag.VehicleLicenseNumberList = vehicleLicenseNumberSelectListItem;

            ViewBag.CustomerList = _customerService.GetCustomerSelectListItem(user.CompanyId);
        }