Exemplo n.º 1
0
        public List <GenerateMedicine> Get(CodeTimeToUser t)
        {
            List <GenerateMedicine> temp = new List <GenerateMedicine>();

            return(temp);
            //return _medicinesDAL.Get();
        }
Exemplo n.º 2
0
        public List <MedicinesToChild> GetByUserInSomeTime(CodeTimeToUser details)
        {
            //List<MedicinesToChild> res = _DB.MedicinesToChilds.Where(m => m.userId == details.UserID && m.TimeToMedicinesForChilds.All(t=>t.TimeOfDay.timeCode==details.TimeOfDay)).ToList();
            //List<MedicinesToChild> res = _DB.MedicinesToChilds.Where(m => m.userId == details.UserID&&m.TimeToMedicinesForChilds.All(t=>t.status==false)).ToList();
            List <MedicinesToChild> res = _DB.MedicinesToChilds.Where(m => (m.userId == details.UserID) && m.date == DateTime.Today).ToList();

            List <MedicinesToChild> res2 = new List <MedicinesToChild>();

            foreach (var item in res)
            {
                foreach (var time in item.TimeToMedicinesForChilds)

                //    foreach (var time in _DB.TimeToMedicinesForChilds.Where(t=>t.idMedicineToChild==item.Id))
                {
                    if (time.TimeOfDay.timeCode == details.TimeOfDay)
                    {
                        res2.Add(item);
                    }
                }
            }

            //foreach (var item in res)
            //{
            //    _DB.TimeToMedicinesForChilds.Where(m=>m.idMedicineToChild==item.Id).ToList()
            //}
            //!!!!!!!!!!!!!!!!
            // res.FindAll(m=>m.TimeToMedicinesForChilds)
            // res = res == null ? null : res;


            // _DB.Users.FirstOrDefault(i => i.childId == "").MedicinesToChilds.SelectMany(t => t.TimeToMedicinesForChilds);
            return(res2);
        }
Exemplo n.º 3
0
        //Alert_BL _alert_BL = new Alert_BL();

        //שליפת רשימת התרופות לפי קוד ילד וקוד זמן ביום
        public List <GenerateMedicine> Get(CodeTimeToUser _details)
        {
            List <GenerateMedicine> _generateMedicinesList = new List <GenerateMedicine>();
            //List< MedicinesToChild > _medicinesToChild = _medicinesToChild_DAL.GetByUser(_details.UserID);
            List <MedicinesToChild> _medicinesToChild = _medicinesToChild_DAL.GetByUserInSomeTime(_details);

            foreach (var _medicines in _medicinesToChild)
            {
                _generateMedicinesList.Add(new GenerateMedicine
                {
                    MedicineName = _medicines.Medicine.midicineName,
                    DosageName   = _medicines.KingOfDosage.kindOfDosageName,
                    Dosage       = _medicines.Dosage,
                    Id           = _medicines.Id,
                    Points       = _medicines.User.points == null ? 0 : (int)(_medicines.User.points),
                    Time         = _medicines.TimeToMedicinesForChilds.FirstOrDefault(m => m.TimeOfDay.timeCode == _details.TimeOfDay).TimeOfDay.theTime,
                    Status       = _medicines.TimeToMedicinesForChilds.FirstOrDefault(m => m.TimeOfDay.timeCode == _details.TimeOfDay).status == null ? false : (bool)_medicines.TimeToMedicinesForChilds.FirstOrDefault(m => m.TimeOfDay.timeCode == _details.TimeOfDay).status
                });
            }
            return(_generateMedicinesList);



            //for (int i = 0; i < medicinesToChild.Count; i++)
            //{
            //   List<TimeToMedicinesForChild> timeToMedicinesForChild= _timeToMedicinesForChild_DAL.GetByMedicineToChild(medicinesToChild[i].Id);
            //    for (int j = 0; j < timeToMedicinesForChild.Count; j++)
            //    {
            //        TimeOfDay timeOfDay = _timeOfDay_DAL.GetByTimeId(timeToMedicinesForChild[j].idTimeOfDay);
            //        if (timeOfDay.timeCode == _details.TimeOfDay)
            //        {
            //            KingOfDosage kingOfDosage = _kingOfDosageDAL.getByIdKindOfChild(medicinesToChild[i].kindOfDosage);
            //            GenerateMedicine generateMedicine = new GenerateMedicine();
            //            generateMedicine.MedicineName = medicinesToChild[i].Medicine.midicineName;
            //            generateMedicine.Dosage = medicinesToChild[i].Dosage;
            //            generateMedicine.DosageName = kingOfDosage.kindOfDosageName;
            //            generateMedicinesList.Add(generateMedicine);
            //        }
            //    }
            //}
        }
Exemplo n.º 4
0
        //public static void EditSnoozeToUser(TimeOfAlertForUser dAlert)
        //{
        //    int countDelete = 0;
        //    for (int i = 0; i < 24&&countDelete<4; i++)
        //    {
        //        for (int j = 0; j < 60 && countDelete < 4; j++)
        //        {
        //            DetailsAlert snoozeToRemove = _userDetailsOfAlert[i, j].FirstOrDefault(a => a.snooze.userId == dAlert.snooze.userId && a.CodeTime));

        //            if (snoozeToRemove != null)
        //            {
        //                countSnooze = snoozeToRemove.AlertCount;
        //                _userDetailsOfAlert[i, j].Remove(snoozeToRemove);
        //                countDelete  ++;
        //            }
        //        }

        //    }
        //    AddTimesToMatForNewUser(dAlert);
        //}

        public static int RemoveSnooze(CodeTimeToUser codeTimeToUser)
        {
            //למחוק מהמטריצה את הנודניק
            DateTime now  = DateTime.Now;
            int      hour = now.Hour;

            codeTimeToUser.UserID    = 30010;
            codeTimeToUser.TimeOfDay = 1;
            bool continueLoop = true;
            int  countSnooze  = 0;

            for (int j = now.Minute + 1; j < now.Minute + 15 && continueLoop; j++)
            {
                if (j <= 59)
                {
                    DetailsAlert snoozeToRemove = _userDetailsOfAlert[hour, j].FirstOrDefault(a => a.snooze.userId == codeTimeToUser.UserID && a.CodeTime == codeTimeToUser.TimeOfDay);
                    if (snoozeToRemove != null)
                    {
                        countSnooze = snoozeToRemove.AlertCount;
                        _userDetailsOfAlert[hour, j].Remove(snoozeToRemove);
                        continueLoop = false;
                    }
                    //snoozeToRemove = _userDetailsOfAlert[hour, j].RemoveAll(a => a.snooze.userId == codeTimeToUser.UserID && a.CodeTime == codeTimeToUser.TimeOfDay);
                }
                else
                {
                    DetailsAlert snoozeToRemove = _userDetailsOfAlert[hour + 1, j - 60].FirstOrDefault(a => a.snooze.userId == codeTimeToUser.UserID && a.CodeTime == codeTimeToUser.TimeOfDay);
                    if (snoozeToRemove != null)
                    {
                        countSnooze = snoozeToRemove.AlertCount;
                        _userDetailsOfAlert[hour + 1, j - 60].Remove(snoozeToRemove);
                        continueLoop = false;
                    }
                    //snoozeToRemove = _userDetailsOfAlert[hour+1, j - 60].RemoveAll(a => a.snooze.userId == codeTimeToUser.UserID && a.CodeTime == codeTimeToUser.TimeOfDay);
                }
            }
            return(countSnooze);
        }
Exemplo n.º 5
0
 public int AlertV(CodeTimeToUser codeTimeToUser)
 {
     //מחזיר את כמות הנודניקים שהיו לילד כדי להעביר לקיחת רשימת תרופות
     //todo check static
     return(Alert_BL.RemoveSnooze(codeTimeToUser));
 }
 //שליחת רשימת תרופות לפי קוד משתמש וזמן ביום
 public List <GenerateMedicine> Get(CodeTimeToUser _details)
 {
     return(_medicinesListBL.Get(_details));
 }