Exemplo n.º 1
0
        public List <EmotionDataModel> getDataFromDatabaseDistanceBased()
        {
            EmotionDataModel        obj;
            List <EmotionDataModel> emotionList = new List <EmotionDataModel>();
            emotiondbEntities1      db          = new emotiondbEntities1();
            List <Emotion_training_distances_wrinkle_free> distances = db.Emotion_training_distances_wrinkle_free.ToList();

            foreach (Emotion_training_distances_wrinkle_free model in distances)
            {
                obj            = new EmotionDataModel();
                obj.LEB1_CPLE1 = model.LEB1_CPLE1;
                obj.LEB2_CPLE2 = model.LEB2_CPLE2;
                obj.REB1_CPRE1 = model.REB1_CPRE1;
                obj.REB2_CPRE2 = model.REB2_CPRE2;
                obj.OPEN_LE1   = model.OPEN_LE1;
                obj.OPEN_LE2   = model.OPEN_LE2;
                obj.OPEN_RE1   = model.OPEN_RE1;
                obj.OPEN_RE2   = model.OPEN_RE2;
                obj.OPEN_MO1   = model.OPEN_MO1;
                obj.OPEN_MO2   = model.OPEN_MO2;
                obj.OPEN_MO3   = model.OPEN_MO3;
                obj.EXP_MO     = model.EXP_MO;
                obj.Label      = model.Label;
                emotionList.Add(obj);
            }
            return(emotionList);
        }
        /// <summary>
        /// Get data from table wrinkle and distances
        /// </summary>
        /// <returns>Return features saved in database</returns>
        public List <EmotionDataModel> getDataFromDatabaseDistanceAndWrinkleBased()
        {
            EmotionDataModel                  obj;
            List <EmotionDataModel>           emotionList = new List <EmotionDataModel>();
            emotiondbEntities1                db          = new emotiondbEntities1();
            List <Emotion_Training_distances> distances   = db.Emotion_Training_distances.ToList();

            foreach (Emotion_Training_distances model in distances)
            {
                obj                     = new EmotionDataModel();
                obj.LEB1_CPLE1          = model.LEB1_CPLE1;
                obj.LEB2_CPLE2          = model.LEB2_CPLE2;
                obj.REB1_CPRE1          = model.REB1_CPRE1;
                obj.REB2_CPRE2          = model.REB2_CPRE2;
                obj.OPEN_LE1            = model.OPEN_LE1;
                obj.OPEN_LE2            = model.OPEN_LE2;
                obj.OPEN_RE1            = model.OPEN_RE1;
                obj.OPEN_RE2            = model.OPEN_RE2;
                obj.OPEN_MO1            = model.OPEN_MO1;
                obj.OPEN_MO2            = model.OPEN_MO2;
                obj.OPEN_MO3            = model.OPEN_MO3;
                obj.EXP_MO              = model.EXP_MO;
                obj.NS_LPLIP            = model.NS_LPLIP;
                obj.NS_RPLIP            = model.NS_RPLIP;
                obj.betweenEyesWrinkles = model.betweenEyesWrinkles;
                obj.noseWrinkles        = model.noseWrinkles;
                obj.Label               = model.Label;
                emotionList.Add(obj);
            }
            return(emotionList);
        }
Exemplo n.º 3
0
        public List <EmotionDataModel> getDataFromDatabaseDistanceAndWrinkleBased()
        {
            EmotionDataModel                  obj;
            List <EmotionDataModel>           emotionList = new List <EmotionDataModel>();
            emotiondbEntities1                db          = new emotiondbEntities1();
            List <Emotion_Training_distances> distances   = db.Emotion_Training_distances.ToList();

            foreach (Emotion_Training_distances model in distances)
            {
                obj                     = new EmotionDataModel();
                obj.LEB1_CPLE1          = model.LEB1_CPLE1;
                obj.LEB2_CPLE2          = model.LEB2_CPLE2;
                obj.REB1_CPRE1          = model.REB1_CPRE1;
                obj.REB2_CPRE2          = model.REB2_CPRE2;
                obj.OPEN_LE1            = model.OPEN_LE1;
                obj.OPEN_LE2            = model.OPEN_LE2;
                obj.OPEN_RE1            = model.OPEN_RE1;
                obj.OPEN_RE2            = model.OPEN_RE2;
                obj.OPEN_MO1            = model.OPEN_MO1;
                obj.OPEN_MO2            = model.OPEN_MO2;
                obj.OPEN_MO3            = model.OPEN_MO3;
                obj.EXP_MO              = model.EXP_MO;
                obj.NS_LPLIP            = model.NS_LPLIP;
                obj.NS_RPLIP            = model.NS_RPLIP;
                obj.betweenEyesWrinkles = model.betweenEyesWrinkles;
                obj.noseWrinkles        = model.noseWrinkles;
                obj.Label               = model.Label;
                emotionList.Add(obj);
            }

            //System.Data.SqlClient.SqlConnection sqlConnection1 =
            //new System.Data.SqlClient.SqlConnection(Constant.emotionDataConnectionString);

            //System.Data.SqlClient.SqlCommand cmd = new System.Data.SqlClient.SqlCommand();
            //cmd.CommandType = System.Data.CommandType.Text;
            //cmd.CommandText = "SELECT * FROM [Emotion_Training_distances]";
            //cmd.Connection = sqlConnection1;
            //sqlConnection1.Open();
            //using (SqlDataReader reader = cmd.ExecuteReader())
            //{
            //    while (reader.Read())
            //    {
            //        EmotionDataModel dataModel = new EmotionDataModel();
            //        for (int i = 0; i < listOfDistances.Count(); i++)
            //        {
            //            var value = reader[listOfDistances[i]];
            //            PropertyInfo propertyInfo = dataModel.GetType().GetProperty(listOfDistances[i]);
            //            propertyInfo.SetValue(dataModel, value, null);

            //        }

            //        emotionList.Add(dataModel);
            //    }
            //}

            //sqlConnection1.Close();
            return(emotionList);
        }