コード例 #1
0
        public static List <FleetViewModel> GetByFleetException(FleetOrderException fleetorderexception)
        {
            List <FleetViewModel> result = new List <FleetViewModel>();

            using (var db = new FleetManagementContext())
            {
                result = (from flt in db.MstFleets
                          join kar in db.MstKaroseris
                          on flt.KaroseriId equals kar.KaroseriId
                          join tyb in db.MstTypeBus
                          on flt.TypeId equals tyb.TypeId
                          join mrk in db.MstMerkBus
                          on tyb.MerkId equals mrk.MerkId
                          //where flt.Id == id
                          //where flt.FleetId == fleetid
                          //from flt in MstFleet()
                          select new FleetViewModel
                {
                    Id = flt.Id,
                    FleetId = flt.FleetId,
                    TypeId = flt.TypeId,
                    TypeName = tyb.Description,
                    MerkId = tyb.MerkId,
                    MerkName = mrk.MerkId,
                    LicenseNumber = flt.LicenseNumber,
                    KaroseriId = flt.KaroseriId,
                    KaroseriName = kar.Description,
                    SeatCapacity = flt.SeatCapacity,
                    IsActive = flt.IsActive
                }).ToList();
            }
            return(result);
        }
コード例 #2
0
        public ActionResult AddFleetOrderItem(/*FleetOrderException fleetorderexception*/ List <string> fleetexceptlistVal, List <string> driverexceptlistVal, List <string> assistantexceptlistVal, string startdateVal, string enddateVal)
        {
            FleetOrderException fleetorderexception = new FleetOrderException
            {
                fleetexceptlist     = fleetexceptlistVal,
                driverexceptlist    = driverexceptlistVal,
                assistantexceptlist = assistantexceptlistVal,
                startdate           = startdateVal,
                enddate             = enddateVal
            };


            ViewBag.FleetExceptList = FleetDataAccess.GetByFleetException(fleetorderexception).Select(flt => new SelectListItem
            {
                Value = flt.FleetId,
                Text  = flt.FleetId + " " + flt.LicenseNumber + " " + flt.BrandTypeName
            });

            ViewBag.DriverExceptList = new SelectList(CrewDataAccess.GetByDriverException(fleetorderexception), "CrewId", "CrewName");

            ViewBag.AssistantExceptList = new SelectList(CrewDataAccess.GetByAssistantException(fleetorderexception), "CrewId", "CrewName");

            ViewBag.StartDate = fleetorderexception.startdate;

            ViewBag.EndDate = fleetorderexception.enddate;

            return(View());
        }
コード例 #3
0
        public static List <CrewViewModel> GetByAssistantException(FleetOrderException fleetorderexception)
        {
            List <CrewViewModel> result = new List <CrewViewModel>();

            using (var db = new FleetManagementContext())
            {
                result = (from crw in db.MstCrews
                          where crw.Role == "A"
                          select new CrewViewModel
                {
                    Id = crw.Id,
                    CrewId = crw.CrewId,
                    CrewName = crw.CrewName,
                    DrivingLicenseNumber = crw.DrivingLicenseNumber,
                    Address = crw.Address,
                    PlaceOfBirth = crw.PlaceOfBirth,
                    DateOfBirth = crw.DateOfBirth,
                    Gender = crw.Gender,
                    Role = crw.Role,
                    IsActive = crw.IsActive
                }).Where(o => !fleetorderexception.assistantexceptlist.Contains(o.CrewId)).ToList();
            }
            return(result);
        }