private void LoadTasks()
        {
            try
            {
                using (SqlConnection connection = new SqlConnection(ConnectionString))
                {
                    IEnumerable <DAO.CalculType> ECalculTypes = connection.Query <DAO.CalculType>("select * from CalculType");

                    foreach (DAO.CalculType calculTypes in ECalculTypes)
                    {
                        if (!Cache.ContainsKey(calculTypes.SensorType))
                        {
                            Business.CacheDataDeviceSensor temp = new Business.CacheDataDeviceSensor(calculTypes, this);
                            Cache.Add(
                                calculTypes.SensorType,
                                temp
                                );
                        }
                        else
                        {
                            Cache[calculTypes.SensorType].AddCalculType(calculTypes);
                        }
                    }
                    connection.Close();
                }
            }
            catch
            {
                Status = "🔴 - EndPoint Down - Fail to connect to the DataBase";
            }
        }
        public static List <DAO.CalculatedMetric> BusinessToListDAO(Business.CacheDataDeviceSensor business, string period)
        {
            List <DAO.CalculatedMetric> temp = new List <DAO.CalculatedMetric>();

            foreach (KeyValuePair <string, Dictionary <string, double> > kv in business.ResultCalculType)
            {
                foreach (KeyValuePair <string, double> kv2 in kv.Value)
                {
                    if (kv2.Key == period)
                    {
                        DateTime d = DateTime.Now;
                        int      c = business.Type[kv2.Key].Id;
                        temp.Add(new DAO.CalculatedMetric(d, kv2.Value, c, kv.Key));
                    }
                }
            }
            return(temp);
        }