Ejemplo n.º 1
0
 public static void AddTeacher(techer techer)
 {
     using (sqlEntities sqlEntities = new sqlEntities())
     {
         sqlEntities.techer.Add(techer);
         sqlEntities.SaveChanges();
     }
 }
Ejemplo n.º 2
0
        public static techer Casting(Teacher t)
        {
            techer techer = new techer
            {
                codeTecher       = t.CodeTeacher,
                hour_teken_month = t.Hour_teken_month,
                name             = t.Name,
                permanent        = t.Permanent,
            };

            return(techer);
        }
Ejemplo n.º 3
0
        public static Teacher Casting(techer t)
        {
            Teacher techer = new Teacher
            {
                CodeTeacher = t.codeTecher,

                Hour_teken_month = t.hour_teken_month,
                Name             = t.name,
                Permanent        = t.permanent
            };

            return(techer);
        }
Ejemplo n.º 4
0
        public static void Add(Teacher t)
        {
            techer techer = Mapper.Casting(t);

            using (sqlEntities sqlEntities = new sqlEntities())
            {
                try
                {
                    sqlEntities.techer.Add(techer);
                }
                catch (Exception e) { }
                //{("אין אפשרות להוסיף" + " אנא בדקי את הערכים שהכנסת"); }
                sqlEntities.SaveChanges();
            }
        }
Ejemplo n.º 5
0
        public static List <int> getInfoForResponce(techer t)
        {
            DateTime?  dateTime;
            int        numHouerForTeacherPresence = 0;
            int        numHouerForTeacherSick     = 0;
            int        numToDaySick             = 0;
            int        numHouerForTeacherAbsent = 0;
            int        numDayToDriver           = 0;
            List <int> listReturn = new List <int>();

            using (sqlEntities sqlEntities = new sqlEntities())
            { try
              {
                  var x = sqlEntities.Presence.ToList().Where(z => z.techer.codeTecher == t.codeTecher).ToList();

                  //לא נותן ברשימות נוכחות ריקות מה עושים?
                  x.OrderBy(o => o.dateDay);
                  try
                  {
                      dateTime = x.FirstOrDefault().dateDay;
                  }
                  catch (Exception)
                  {
                      dateTime = new DateTime();
                  }



                  int d = 0;
                  foreach (var item in x)
                  {
                      switch (item.statusToDay)
                      {
                      case (1):
                      {              //שעות עבודה +נסיעות
                          numHouerForTeacherPresence++;
                          if (dateTime != null && (dateTime < item.dateDay || d == 0))
                          {
                              d = 1;

                              dateTime = item.dateDay;

                              numDayToDriver++;
                          }
                          break;
                      }

                      case (2):          //שעות מחלה
                      {
                          numToDaySick++;
                          numHouerForTeacherSick++; break;
                      }

                      case (3): { numHouerForTeacherPresence++; break; }

                      case (4):          //חסרה
                      {
                          numHouerForTeacherAbsent++; break;
                      }
                      }
                  }
              }
              catch { }
              listReturn.Add(numHouerForTeacherPresence);
              listReturn.Add(numHouerForTeacherSick);
              // listReturn.Add(numHouerForTeacher3);
              // listReturn.Add(numHouerForTeacher4);
              listReturn.Add(numDayToDriver);
              return(listReturn); }
        }