Example #1
0
        public static Business.RawData DAOToBusiness(DAO.RawData dao)
        {
            try
            {
                var jo = JObject.Parse(dao.Data);

                DateTime dt = DateTime.ParseExact(jo["metricDate"].ToString(), "yyyy-MM-dd HH:mm:ss", null);
                Double   d  = Double.Parse(jo["metricValue"].ToString(), CultureInfo.CreateSpecificCulture("en-EN"));

                return(new Business.RawData(jo["macAddress"].ToString(), dt, jo["deviceType"].ToString(), jo["name"].ToString(), d));
            }
            catch { return(null); }
        }
        public static Business.RawData DAOToBusiness(DAO.RawData dao)
        {
            try
            {
                var      jo = JObject.Parse(dao.Data);
                DateTime dt = DateTime.ParseExact(jo["MetricDate"].ToString(), "dd/MM/yyyy HH:mm:ss", null);
                Double   d  = Double.Parse(jo["MetricValue"].ToString(), CultureInfo.CreateSpecificCulture("en-EN"));

                return(new Business.RawData(jo["MacAddress"].ToString(), dt, jo["SensorType"].ToString(), jo["Name"].ToString(), d));
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                return(null);
            }
        }