public static void AddTeacher(techer techer) { using (sqlEntities sqlEntities = new sqlEntities()) { sqlEntities.techer.Add(techer); sqlEntities.SaveChanges(); } }
public static void Add(Presence presence) { using (sqlEntities sqlEntities = new sqlEntities()) { //presence.day = (int)presence.dateDay.Value.DayOfWeek; sqlEntities.Presence.Add(presence); sqlEntities.SaveChanges(); } }
public static void add(common.Schedule schedule) { using (sqlEntities sqlEntities = new sqlEntities()) { var a = Mapper.Casting(schedule); sqlEntities.schedules.Add(a); sqlEntities.SaveChanges(); } }
public static void Add(common.subjectToClass subject) { subjectToClass subjectToClass = Mapper.Casting(subject); using (sqlEntities sqlEntities = new sqlEntities()) { sqlEntities.subjectToClass.Add(subjectToClass); sqlEntities.SaveChanges(); } }
public static void Add(Class1 t) { @class clss = Mapper.Casting(t); using (sqlEntities sqlEntities = new sqlEntities()) { [email protected](clss); sqlEntities.SaveChanges(); } }
public static void Update(common.Teacher t) { using (sqlEntities sqlEntities = new sqlEntities()) { var s = sqlEntities.techer.Where(z => z.codeTecher == t.CodeTeacher).First(); s.name = t.Name; s.permanent = t.Permanent; s.hour_teken_month = s.hour_teken_month; sqlEntities.SaveChanges(); } }
public static void Update(common.subjectToClass subjectToClass) { using (sqlEntities sqlEntities = new sqlEntities()) { var s = sqlEntities.subjectToClass.Where(z => z.codeSubject == subjectToClass.CodeSubject).First(); // sqlEntities.subjectToClass. s.name = subjectToClass.Name; s.group1 = subjectToClass.Group1; s.group2 = subjectToClass.Group2; sqlEntities.SaveChanges(); } }
public static void Update(common.Class1 class1) { using (sqlEntities sqlEntities = new sqlEntities()) { var s = [email protected](z => z.codeClass == class1.CodeClass).First(); try { s.name = class1.Name; sqlEntities.SaveChanges(); } catch { } } }
public static void Remove(int id) { using (sqlEntities sqlEntities = new sqlEntities()) { var s = [email protected](z => z.codeClass == id).First(); try { var schedules = sqlEntities.schedules.Where(z => z.@class == id).ToList(); schedules.ForEach(s1 => s1.class1 = null); [email protected](s); sqlEntities.SaveChanges(); } catch { } } }
public static void remove(int code, int hour, DateTime date, int day) { using (sqlEntities sqlEntities = new sqlEntities()) { var s = sqlEntities.Presence.Where(z => z.codeTecher == code && z.dateDay == date && z.mis_Hour == hour).First(); try { sqlEntities.Presence.Remove(s); sqlEntities.SaveChanges(); } catch (NullReferenceException) { } } }
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(); } }
public static void Remove(int id) { using (sqlEntities sqlEntities = new sqlEntities()) { var s = sqlEntities.subjectToClass.Where(z => z.codeSubject == id).First(); try { var schedules = sqlEntities.schedules.Where(z => z.subjectIn == id).ToList(); schedules.ForEach(s1 => s1.subjectToClass = null); sqlEntities.subjectToClass.Remove(s); sqlEntities.SaveChanges(); } catch (NullReferenceException) { } } }
public static void remove(int id) { using (sqlEntities sqlEntities = new sqlEntities()) { var s = sqlEntities.techer.Where(z => z.codeTecher == id).FirstOrDefault(); if (s != null) { try { sqlEntities.techer.Remove(s); sqlEntities.SaveChanges(); } catch (NullReferenceException) { } } } }
public static void Rename(int id) { using (sqlEntities sqlEntities = new sqlEntities()) { var s = sqlEntities.techer.Where(z => z.codeTecher == id).First(); //var users = s.schedule.ToList(); //var presence = s.Presence.ToList(); //if (users != null) //{ // foreach (var user in users) // { // s.schedule.Remove(user); // } //} //if (presence != null) //{ // foreach (var p in presence) // { // s.Presence.Remove(p); // } //} if (s != null) { try { var schedules = sqlEntities.schedules.Where(z => z.techer == id).ToList(); var p = sqlEntities.Presence.Where(z => z.codeTecher == id).ToList(); schedules.ForEach(s1 => s1.techer1 = null); p.ForEach(p1 => p1.techer = null); sqlEntities.techer.Remove(s); sqlEntities.SaveChanges(); } catch (NullReferenceException) { } } } }