Esempio n. 1
0
        private async Task <List <listDataLampuByWattReportInfo> > ReadAllAsync2(DbDataReader reader)
        {
            var posts = new List <listDataLampuByWattReportInfo>();

            using (reader)
            {
                while (await reader.ReadAsync())
                {
                    var post = new listDataLampuByWattReportInfo(Db)
                    {
                        id         = reader.GetInt32(0).ToString(),
                        name       = reader.GetString(1),
                        total_watt = reader.GetString(2),
                    };
                    posts.Add(post);
                }
            }
            return(posts);
        }
Esempio n. 2
0
        private async Task <List <listDataLampuByWattReportInfo> > ReadAllAsync5(DbDataReader reader)
        {
            var posts = new List <listDataLampuByWattReportInfo>();

            using (reader)
            {
                while (await reader.ReadAsync())
                {
                    //int hours = (reader.GetInt32(6) - reader.GetInt32(6) % 60) / 60;
                    //string strWatt = hours + " Jam " + (reader.GetInt32(6) - hours * 60) + " Menit";
                    string strWatt = Math.Round(reader.GetDecimal(2) * reader.GetInt32(6) / 60, 0).ToString("N0") + " W";

                    var post = new listDataLampuByWattReportInfo(Db)
                    {
                        id         = reader.GetInt32(0).ToString(),
                        name       = reader.GetString(1),
                        total_watt = strWatt,
                    };
                    posts.Add(post);
                }
            }
            return(posts);
        }