예제 #1
0
        public List <FuelData> GetFuelData()
        {
            List <FuelData>      list              = new List <FuelData>();
            List <Fuel>          fuelList          = new List <Fuel>();
            List <DailyFuelCost> dailyFuelCostList = new List <DailyFuelCost>();

            BAL.BAL_Fuel bAL_Fuel = new BAL.BAL_Fuel();
            fuelList          = bAL_Fuel.GetFuelList();
            dailyFuelCostList = bAL_Fuel.GetDailyFuelCost();
            foreach (Fuel fuel in fuelList)
            {
                FuelData fuelData = new FuelData();
                fuelData.Id          = fuel.Id;
                fuelData.Name        = fuel.Name;
                fuelData.Type        = fuel.Type;
                fuelData.Description = fuel.Description;
                foreach (DailyFuelCost dailyFuelCost in dailyFuelCostList)
                {
                    if (dailyFuelCost.FuelTypeId == fuel.Id)
                    {
                        fuelData.CostPerLiter = dailyFuelCost.CostPerLiter;
                        break;
                    }
                    else
                    {
                        continue;
                    }
                }
                list.Add(fuelData);
            }
            return(list);
        }
예제 #2
0
        public FuelData GetFuelDataByID(string fuelID)
        {
            FuelData             fuelRetData       = new FuelData();
            List <Fuel>          fuelList          = new List <Fuel>();
            List <DailyFuelCost> dailyFuelCostList = new List <DailyFuelCost>();

            BAL.BAL_Fuel bAL_Fuel = new BAL.BAL_Fuel();
            fuelList          = bAL_Fuel.GetFuelList();
            dailyFuelCostList = bAL_Fuel.GetDailyFuelCost();
            foreach (Fuel fuel in fuelList)
            {
                if (Convert.ToString(fuel.Id) == fuelID)
                {
                    FuelData fuelData = new FuelData();
                    fuelData.Id          = fuel.Id;
                    fuelData.Name        = fuel.Name;
                    fuelData.Type        = fuel.Type;
                    fuelData.Description = fuel.Description;
                    foreach (DailyFuelCost dailyFuelCost in dailyFuelCostList)
                    {
                        if (dailyFuelCost.FuelTypeId == fuel.Id)
                        {
                            fuelData.CostPerLiter = dailyFuelCost.CostPerLiter;
                            break;
                        }
                        else
                        {
                            continue;
                        }
                    }
                    fuelRetData = fuelData;
                    break;
                }
                else
                {
                    continue;
                }
            }
            return(fuelRetData);
        }