Exemple #1
0
 public static bool AddChildren(Children ch)
 {
     using (kindergardenEntities db = new kindergardenEntities())
     {
         db.Children.Add(ch);
         int         iduser = db.Users.Max(i => i.UserId);
         Users       u      = db.Users.Find(iduser);
         Connections f      = new Connections();
         f.ChildId = ch.ChildId.ToString();
         f.UserId  = u.Password;
         db.Connections.Add(f);
         DailyAlerts d = new DailyAlerts();
         d.ChildId    = ch.ChildId;
         d.AvgTime    = TimeSpan.Parse("0");
         d.IsComing_  = false;
         d.IsMissing_ = false;
         db.DailyAlerts.Add(d);
         db.SaveChanges();
         return(true);
     }
 }
 public static bool AddChildren(Children ch)
 {
     using (kindergardenEntities db = new kindergardenEntities())
     {
         //create here the child with the right information
         //-----------------------------------------------
         db.Children.Add(ch);
         int         iduser = db.Users.Max(i => i.UserId);
         Users       u      = db.Users.Find(iduser);
         Connections f      = new Connections();
         f.ChildId = Convert.ToString(ch.ChildId);
         f.UserId  = Convert.ToString(u.UserId);
         db.Connections.Add(f);
         DailyAlerts d = new DailyAlerts();
         d.ChildId    = ch.ChildId;
         d.AvgTime    = TimeSpan.Parse("0");
         d.IsComing_  = false;
         d.IsMissing_ = false;
         db.DailyAlerts.Add(d);
         db.SaveChanges();
         return(true);
     }
 }