/// <summary>
        /// 共用公司、貨主、車主、車輛下拉選單
        /// </summary>
        /// <param name="CompanyId"></param>
        private void CommonGoodsOwnerDriverVehicleDropdownList(int?CompanyId)
        {
            List <SelectListItem> companySelectListItem = new List <SelectListItem>();

            if (!CompanyId.HasValue)
            {
                companySelectListItem.Add(new SelectListItem {
                    Text = "不限", Value = " "
                });
            }

            companySelectListItem.AddRange(_companyService.GetCompanyList(CompanyId));
            ViewBag.CompanyList = companySelectListItem;

            List <SelectListItem> goodOwnerSelectListItem = new List <SelectListItem>();
            List <int>            goodOwnerLevels         = new List <int>();

            goodOwnerLevels.Add((int)MemberLevelEnum.GoodsOwner);
            goodOwnerLevels.Add((int)MemberLevelEnum.DriverLevel1);
            goodOwnerLevels.Add((int)MemberLevelEnum.DriverLevel2);
            goodOwnerLevels.Add((int)MemberLevelEnum.DriverLevel3);
            goodOwnerLevels.Add((int)MemberLevelEnum.DriverLevel4);
            goodOwnerSelectListItem.Add(new SelectListItem {
                Text = "不限", Value = " "
            });
            goodOwnerSelectListItem.AddRange(_aspNetUsersService.GetUserSelectListItem(goodOwnerLevels, null, null));
            ViewBag.GoodOwnerList = goodOwnerSelectListItem;

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

            driverLevels.Add((int)MemberLevelEnum.DriverLevel1);
            driverLevels.Add((int)MemberLevelEnum.DriverLevel2);
            driverLevels.Add((int)MemberLevelEnum.DriverLevel3);
            driverLevels.Add((int)MemberLevelEnum.DriverLevel4);

            driverSelectListItem.Add(new SelectListItem {
                Text = "不限", Value = " "
            });
            driverSelectListItem.AddRange(_aspNetUsersService.GetUserSelectListItem(driverLevels, CompanyId, null));
            ViewBag.DriverList = driverSelectListItem;

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

            vehicleLicenseNumberSelectListItem.Add(new SelectListItem {
                Text = "不限", Value = " "
            });
            vehicleLicenseNumberSelectListItem.AddRange(_vehicleService.GetVehicleBy(CompanyId));
            ViewBag.VehicleLicenseNumberList = vehicleLicenseNumberSelectListItem;
        }
Beispiel #2
0
        /// <summary>
        /// 初始下拉選單
        /// </summary>
        public void IntialDropDownList()
        {
            List <SelectListItem> PostalCodeSelectListItem = new List <SelectListItem>();

            PostalCodeSelectListItem.Add(new SelectListItem {
                Text = "不選擇", Value = " "
            });
            PostalCodeSelectListItem.AddRange(_codeDetailService.GetItemByTypeCode("PostalCode"));
            ViewBag.SelectPostalCodeList = PostalCodeSelectListItem;

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

            driverLevels.Add((int)MemberLevelEnum.DriverLevel1);
            driverLevels.Add((int)MemberLevelEnum.DriverLevel2);
            driverLevels.Add((int)MemberLevelEnum.DriverLevel3);
            driverLevels.Add((int)MemberLevelEnum.DriverLevel4);

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

            driverSelectListItem.Add(new SelectListItem {
                Text = "不選擇", Value = " "
            });
            driverSelectListItem.AddRange(_aspNetUsersService.GetUserSelectListItem(driverLevels, user.CompanyId, null));
            ViewBag.DriverList = driverSelectListItem;

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

            vehicleSelectListItem.Add(new SelectListItem {
                Text = "不選擇", Value = " "
            });
            ViewBag.VehicleList = vehicleSelectListItem;
        }
Beispiel #3
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);
        }
        /// <summary>
        /// 共用下拉選單List
        /// </summary>
        private void CommonDropDownList(int CompanyId, string DriverId)
        {
            List <SelectListItem> areaSelectListItem = new List <SelectListItem>();

            areaSelectListItem.Add(new SelectListItem {
                Text = "請選擇", Value = " "
            });
            areaSelectListItem.AddRange(_codeDetailService.GetItemByTypeCode("PostalCode"));
            ViewBag.SelectAreaList = areaSelectListItem;

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

            driverSelectListItem.Add(new SelectListItem {
                Text = "請選擇", Value = " "
            });

            //限制只能為公司報價的
            var        user         = _aspNetUsersService.GetUserModelByName(User.Identity.Name);
            List <int> driverLevels = new List <int>();

            driverLevels.Add((int)MemberLevelEnum.DriverLevel1);
            driverLevels.Add((int)MemberLevelEnum.DriverLevel2);
            driverLevels.Add((int)MemberLevelEnum.DriverLevel3);
            driverLevels.Add((int)MemberLevelEnum.DriverLevel4);
            var driverList = _aspNetUsersService.GetUserSelectListItem(driverLevels, user.CompanyId, DriverId);

            driverSelectListItem.AddRange(driverList);
            ViewBag.SelectDriverList = driverSelectListItem;

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

            vehicleLicenseNumberSelectListItem.Add(new SelectListItem {
                Text = "請選擇", Value = " "
            });
            vehicleLicenseNumberSelectListItem.AddRange(_vehicleService.GetOwnVehicleSelectListItem(DriverId));
            ViewBag.VehicleLicenseNumberList = vehicleLicenseNumberSelectListItem;
        }