Beispiel #1
0
        public TankerData GetTankerDataByID(string tankerID)
        {
            TankerData                tankerRetData          = new TankerData();
            List <Tanker>             tankerList             = new List <Tanker>();
            List <DailyTankerReading> dailyTankerReadingList = new List <DailyTankerReading>();
            Fuel fuel = new Fuel();

            BAL.BAL_Tanker bAL_Tanker = new BAL.BAL_Tanker();
            tankerList             = bAL_Tanker.GetTankerList();
            dailyTankerReadingList = bAL_Tanker.GetDailyTankerReading();

            foreach (Tanker tanker in tankerList)
            {
                if (Convert.ToString(tanker.Id) == tankerID)
                {
                    TankerData tankerData = new TankerData();
                    tankerData.Id          = tanker.Id;
                    tankerData.Name        = tanker.Name;
                    tankerData.Size        = tanker.Size;
                    tankerData.Description = tanker.Description;
                    tankerData.FuelTypeID  = tanker.FuelTypeId;
                    fuel = bAL_Tanker.GetFuelByFuelID(tankerData.FuelTypeID);
                    tankerData.FuelType = fuel.Type;
                    foreach (DailyTankerReading dailyTankerReading in dailyTankerReadingList)
                    {
                        if (dailyTankerReading.TankerId == tanker.Id)
                        {
                            tankerData.DayStartReading = dailyTankerReading.DailyStartReading;
                            tankerData.DayEndReading   = dailyTankerReading.DailyEndReading;
                            break;
                        }
                        else
                        {
                            continue;
                        }
                    }
                    tankerRetData = tankerData;
                    break;
                }
                else
                {
                    continue;
                }
            }
            return(tankerRetData);
        }
Beispiel #2
0
        public List <TankerData> GetTankerData()
        {
            List <TankerData>         list                   = new List <TankerData>();
            List <Tanker>             tankerList             = new List <Tanker>();
            List <DailyTankerReading> dailyTankerReadingList = new List <DailyTankerReading>();
            Fuel fuel = new Fuel();

            BAL.BAL_Tanker bAL_Tanker = new BAL.BAL_Tanker();
            tankerList             = bAL_Tanker.GetTankerList();
            dailyTankerReadingList = bAL_Tanker.GetDailyTankerReading();
            foreach (Tanker tanker in tankerList)
            {
                TankerData tankerData = new TankerData();
                tankerData.Id          = tanker.Id;
                tankerData.Name        = tanker.Name;
                tankerData.Size        = tanker.Size;
                tankerData.Description = tanker.Description;
                tankerData.FuelTypeID  = tanker.FuelTypeId;
                tankerData.Date        = tanker.CreatedOn;

                fuel = bAL_Tanker.GetFuelByFuelID(tankerData.FuelTypeID);
                tankerData.FuelType = fuel.Type;

                foreach (DailyTankerReading dailyTankerReading in dailyTankerReadingList)
                {
                    if (dailyTankerReading.TankerId == tanker.Id)
                    {
                        tankerData.DayStartReading = dailyTankerReading.DailyStartReading;
                        tankerData.DayEndReading   = dailyTankerReading.DailyEndReading;
                        break;
                    }
                    else
                    {
                        continue;
                    }
                }
                list.Add(tankerData);
            }
            return(list);
        }
Beispiel #3
0
        private void BindTankerList()
        {
            string                    finalstring            = "";
            List <Tanker>             tankerList             = new List <Tanker>();
            List <DailyTankerReading> dailyTankerReadingList = new List <DailyTankerReading>();

            BAL.BAL_Tanker bAL_Tanker = new BAL.BAL_Tanker();
            tankerList             = bAL_Tanker.GetTankerList();
            dailyTankerReadingList = bAL_Tanker.GetDailyTankerReading();

            foreach (Tanker tanker in tankerList)
            {
                string htmlContent = "<tr>";
                htmlContent += "<td>" + Convert.ToString(tanker.Name) + "</td>";
                htmlContent += "<td>" + Convert.ToString(tanker.FuelTypeId) + "</td>";
                htmlContent += "<td>" + Convert.ToString(tanker.Size) + "</td>";
                foreach (DailyTankerReading dailyTankerReading in dailyTankerReadingList)
                {
                    if (dailyTankerReading.TankerId == tanker.Id)
                    {
                        htmlContent += "<td>" + Convert.ToString(dailyTankerReading.DailyStartReading) + "</td>";
                        htmlContent += "<td>" + Convert.ToString(dailyTankerReading.DailyEndReading) + "</td>";
                        htmlContent += "<td>" + Convert.ToString(dailyTankerReading.CreatedOn) + "</td>";
                        break;
                    }
                    else
                    {
                        continue;
                    }
                }
                htmlContent += "<td>" + Convert.ToString(tanker.Description) + "</td>";
                htmlContent += "<td>" + "<button id=\"itemDelete\" class=\"btn btn-success nopadding\" style=\"padding:2px\"><i class=\"fa fa-edit\"></i></button>";
                htmlContent += "<button id=\"itemDelete\" class=\"btn btn-danger nopadding\" style=\"padding:2px\"><i class=\"fa fa-remove\"></i></button>" + "</td>";
                htmlContent += "</tr>";
                finalstring += htmlContent;
            }

            //tankerListBody.Controls.Add(new Literal { Text = finalstring.ToString() });
        }