public List<DataEntry> getListAllDataEntries()
        {
            IList<Data_Entries> dtes = this.GetAllDataEntries();
            List<DataEntry> AllDataEntries = new List<DataEntry>();
            foreach (Data_Entries m in dtes)
            {
                DataEntry n = new DataEntry();
                DateTime date = Convert.ToDateTime(m.date_Time);
                n.dateTime = date;
                n.activity = m.activity;
                n.datas.Add(m.DataKey, m.DataValue);

                //n.datas =

                AllDataEntries.Add(n);
            }
            return AllDataEntries;
        }
Пример #2
0
        public void saveDataEntry(DataEntry dataE)
        {
            using (DataBaseContext context = new DataBaseContext(DataBaseContext.DBConnectionString))
            {
                Data_Entries de = new Data_Entries();
                for(int i = 0; i < DataEntry.dictionaryList.Count; i++) {
                //de.Data_entriesID = dataE.DataEntryID;
                de.date_Time = dataE.dateTime;
                de.activity = dataE.activity;
                de.DataKey = DataEntry.dictionaryList.ElementAt<Dnary>(i).DataKey;
                de.DataValue = DataEntry.dictionaryList.ElementAt<Dnary>(i).DataValue;
                //Debug.WriteLine("before insert on sumbit saveDataEntr");
                context.dataEntry.InsertOnSubmit(de);

                }

                //Debug.WriteLine("after insert on sumbit saveDataEntr");
                context.SubmitChanges();
                //dataE.DataEntryID++;
            }
        }
Пример #3
0
 public static int addEntryToList(DataEntry dataEntry)
 {
     dataEntries.Add(dataEntry);
     return dataEntries.Count();
 }
Пример #4
0
        //new ??
        public DataEntry filterOne(List<String> filter)
        {
            DataEntry dE = new DataEntry();

            dE.dateTime = this.dateTime;
            dE.activity = this.activity;
            for (int i = 0; i < filter.Count; i++)
            {
                String key = filter.ElementAt<string>(i);
                dE.datas.Add(key, this.datas[key]);
                Dnary dn = new Dnary();
                dn.DataKey = key;
                dn.DataValue = this.datas[key];

                filtredDictionaryList.Add(dn);
            }
            foreach (Dnary dn in filtredDictionaryList)
            {
                Debug.WriteLine("dn key value  DataEntry.filter  :" + dn.DataKey + "," + dn.DataValue+","+dn.datetimeDataEntry+","+dn.activity);

            }

            return new DataEntry() ;
        }
        private void checkTimeToLog()
        {
            if (started)
            {
                DateTime dt = DateTime.Now;
                if (lastTime != null)
                {
                    if ((dt - lastTime).Seconds > 0)
                    {
                        DataEntry dE = new DataEntry();

                        if (this.activities.Count > 0)
                        {
                            dE.activity = this.activities.ElementAt<string>(this.activities.Count - 1);
                        }
                        dE.datas.Add("accelX", accelX);
                        Dnary dnaccelX = new Dnary();
                        dnaccelX.DataKey = "accelX";
                        dnaccelX.DataValue = accelX;
                        dnaccelX.datetimeDataEntry = dE.dateTime;
                        dnaccelX.activity = dE.activity;
                        DataEntry.addDictionaryToList(dnaccelX);
                        dE.datas.Add("accelY", accelY);
                        Dnary dnaccelY = new Dnary();
                        dnaccelY.DataKey = "accelY";
                        dnaccelY.DataValue = accelY;
                        dnaccelY.datetimeDataEntry = dE.dateTime;
                        dnaccelY.activity = dE.activity;
                        DataEntry.addDictionaryToList(dnaccelY);
                        dE.datas.Add("accelZ", accelZ);
                        Dnary dnaccelZ = new Dnary();
                        dnaccelZ.DataKey = "accelZ";
                        dnaccelZ.DataValue = accelZ;
                        dnaccelZ.datetimeDataEntry = dE.dateTime;
                        dnaccelZ.activity = dE.activity;
                        DataEntry.addDictionaryToList(dnaccelZ);
                        dE.datas.Add("compass", comp);
                        Dnary dncompass = new Dnary();
                        dncompass.DataKey = "compass";
                        dncompass.DataValue = comp;
                        dncompass.datetimeDataEntry = dE.dateTime;
                        dncompass.activity = dE.activity;
                        DataEntry.addDictionaryToList(dncompass);
                        dE.datas.Add("gyroX", gyroX);
                        Dnary dngyroX = new Dnary();
                        dngyroX.DataKey = "gyroX";
                        dngyroX.DataValue = gyroX;
                        dngyroX.datetimeDataEntry = dE.dateTime;
                        dngyroX.activity = dE.activity;
                        DataEntry.addDictionaryToList(dngyroX);
                        dE.datas.Add("gyroY", gyroY);
                        Dnary dngyroY = new Dnary();
                        dngyroY.DataKey = "gyroY";
                        dngyroY.DataValue = gyroY;
                        dngyroY.datetimeDataEntry = dE.dateTime;
                        dngyroY.activity = dE.activity;
                        DataEntry.addDictionaryToList(dngyroY);
                        dE.datas.Add("gyroZ", gyroZ);
                        Dnary dngyroZ = new Dnary();
                        dngyroZ.DataKey = "gyroZ";
                        dngyroZ.DataValue = gyroZ;
                        dngyroZ.datetimeDataEntry = dE.dateTime;
                        dngyroZ.activity = dE.activity;
                        DataEntry.addDictionaryToList(dngyroZ);
                        dE.datas.Add("incliYaw", incliYaw);
                        Dnary dnincliYaw = new Dnary();
                        dnincliYaw.DataKey = "incliYaw";
                        dnincliYaw.DataValue = incliYaw;
                        dnincliYaw.datetimeDataEntry = dE.dateTime;
                        dnincliYaw.activity = dE.activity;
                        DataEntry.addDictionaryToList(dnincliYaw);
                        dE.datas.Add("incliPitch", incliPitch);
                        Dnary dnincliPitch = new Dnary();
                        dnincliPitch.DataKey = "incliPitch";
                        dnincliPitch.DataValue = incliPitch;
                        dnincliPitch.datetimeDataEntry = dE.dateTime;
                        dnincliPitch.activity = dE.activity;
                        DataEntry.addDictionaryToList(dnincliPitch);
                        dE.datas.Add("incliRoll", incliRoll);
                        Dnary dnincliRoll = new Dnary();
                        dnincliRoll.DataKey = "incliRoll";
                        dnincliRoll.DataValue = incliRoll;
                        dnincliRoll.datetimeDataEntry = dE.dateTime;
                        dnincliRoll.activity = dE.activity;
                        DataEntry.addDictionaryToList(dnincliRoll);
                        dE.datas.Add("light", light);
                        Dnary dnlight = new Dnary();
                        dnlight.DataKey = "light";
                        dnlight.DataValue = light;
                        dnlight.datetimeDataEntry = dE.dateTime;
                        dnlight.activity = dE.activity;
                        DataEntry.addEntryToList(dE);
                        DataEntry.addDictionaryToList(dnlight);
                        lastTime = dt;
                        this.textBlock_logquantity.Text = DataEntry.dataEntries.Count().ToString("0.0");
                    }
                }
                else
                {
                    lastTime = dt;
                }
            }
        }