Beispiel #1
0
        public static List <CalenderDto> SelectCalendarKinderGarden(int kinderGardenID)
        {
            int year = PublicLogic.CalcBeaginYear().Year;
            List <CalenderDto> calenderDtos = new List <CalenderDto>();

            using (TafToTafEntities2 db = new TafToTafEntities2())
            {
                var calenders = db.Calanders.Where(c => c.KindId < 4 && c.KinderGardenId == kinderGardenID && c.DateStart.Value.Year == year);
                foreach (var calander in calenders)
                {
                    calenderDtos.Add(CalanderC.ToCalanderDto(calander));
                }
            }
            return(calenderDtos);
        }
Beispiel #2
0
        public static List <CalenderDto> SelectAdminParentMeetings()
        {
            int year = PublicLogic.CalcBeaginYear().Year;
            List <CalenderDto> parentsMeetings = new List <CalenderDto>();

            using (TafToTafEntities2 db = new TafToTafEntities2())
            {
                var meetings = db.Calanders.Where(c => c.KindId == 5 && DateTime.Now.Month - c.DateStart.Value.Month <= 2 && c.DateStart.Value.Year == year).ToList();
                foreach (var calander in meetings)
                {
                    parentsMeetings.Add(BLL.Converters.CalanderC.ToCalanderDto(calander));
                }
            }
            return(parentsMeetings);
        }
        public static List <ChildDto> GetChildrenInKinderGarden(string kinderGardenName)
        {
            List <ChildDto> ChildrenDTO = new List <ChildDto>();

            using (TafToTafEntities2 db = new TafToTafEntities2())
            {
                int kinderGardenId = db.KinderGardens.First(kg => kg.Name == kinderGardenName).Id;
                foreach (var childKinderGarden in db.ChildKinderGardens)
                {
                    if (childKinderGarden.KindrGardenID == kinderGardenId &&
                        childKinderGarden.BeginYear.GetValueOrDefault() == PublicLogic.CalcBeaginYear())
                    {
                        Child childDAL = db.Children.First(ch => ch.Id == childKinderGarden.ChildID);
                        ChildrenDTO.Add(ChildC.ToChildDTO(childDAL));
                    }
                }
                return(ChildrenDTO);
            }
        }
Beispiel #4
0
 public static void InsertChild(DTO.ChildPost child, string kGardenName)
 {
     using (DAL.TafToTafEntities2 db = new DAL.TafToTafEntities2())
     {
         int  kGardenID = db.KinderGardens.First(kg => kg.Name == kGardenName).Id;
         User user      = new User()
         {
             LastName  = child.LastName,
             FirstName = child.ParentName,
             KindUser  = 3,
             UserName  = "******" + "3",
             Email     = child.ParentEmail,
             Password  = child.Tz,
         };
         db.Users.Add(user);
         db.SaveChanges();
         ChildDto childDto = new ChildDto()
         {
             FirstName       = child.FirstName,
             LastName        = child.LastName,
             BornDate        = child.BornDate,
             NumHoursConfirm = child.NumHoursConfirm,
             Tz       = child.Tz,
             ParentID = db.Users.First(u => u.Password == child.Tz).Id
         };
         db.Children.Add(ChildC.ToChildDAL(childDto));
         db.ChildKinderGardens.Add(new ChildKinderGarden()
         {
             ChildID       = child.Id,
             KindrGardenID = kGardenID,
             BeginYear     = PublicLogic.CalcBeaginYear(),
             EndYear       = PublicLogic.CalcEndYear(),
         });
         db.SaveChanges();
         PublicLogic.SendEmail("TLT3", child.Tz, child.ParentEmail);
     }
 }