Beispiel #1
0
        public MeterData GetMeterDataByID(string meterID)
        {
            MeterData                meterRetData          = new MeterData();
            List <Meter>             meterList             = new List <Meter>();
            List <DailyMeterReading> dailyMeterReadingList = new List <DailyMeterReading>();
            Fuel fuel = new Fuel();

            BAL.BAL_Meter bAL_Meter = new BAL.BAL_Meter();
            meterList             = bAL_Meter.GetMeterList();
            dailyMeterReadingList = bAL_Meter.GetDailyMeterReading();

            foreach (Meter meter in meterList)
            {
                if (Convert.ToString(meter.Id) == meterID)
                {
                    MeterData meterData = new MeterData();
                    meterData.Id          = meter.Id;
                    meterData.Name        = meter.Name;
                    meterData.Description = meter.Description;
                    meterData.FuelTypeID  = meter.FuelTypeId;
                    fuel = bAL_Meter.GetFuelByFuelID(meterData.FuelTypeID);
                    meterData.FuelType = fuel.Type;
                    foreach (DailyMeterReading dailyMeterReading in dailyMeterReadingList)
                    {
                        if (dailyMeterReading.MeterId == meter.Id)
                        {
                            meterData.DayStartReading = dailyMeterReading.DayStartReading;
                            meterData.DayEndReading   = dailyMeterReading.DayEndReading;
                            break;
                        }
                        else
                        {
                            continue;
                        }
                    }
                    meterRetData = meterData;
                    break;
                }
                else
                {
                    continue;
                }
            }
            return(meterRetData);
        }
Beispiel #2
0
        private void BindMeterList()
        {
            string                   finalstring           = "";
            List <Meter>             meterList             = new List <Meter>();
            List <DailyMeterReading> dailyMeterReadingList = new List <DailyMeterReading>();

            BAL.BAL_Meter bAL_Meter = new BAL.BAL_Meter();
            meterList             = bAL_Meter.GetMeterList();
            dailyMeterReadingList = bAL_Meter.GetDailyMeterReading();

            foreach (Meter meter in meterList)
            {
                string htmlContent = "<tr>";
                htmlContent += "<td>" + Convert.ToString(meter.Name) + "</td>";
                htmlContent += "<td>" + Convert.ToString(meter.FuelTypeId) + "</td>";
                foreach (DailyMeterReading dailyMeterReading in dailyMeterReadingList)
                {
                    if (dailyMeterReading.MeterId == meter.Id)
                    {
                        htmlContent += "<td>" + Convert.ToString(dailyMeterReading.DayStartReading) + "</td>";
                        htmlContent += "<td>" + Convert.ToString(dailyMeterReading.DayEndReading) + "</td>";
                        htmlContent += "<td>" + Convert.ToString(dailyMeterReading.CreatedOn) + "</td>";
                        break;
                    }
                    else
                    {
                        continue;
                    }
                }
                htmlContent += "<td>" + Convert.ToString(meter.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;
            }

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