Ejemplo n.º 1
0
 public static bool UpdateUser(Users us, string v)
 {
     using (kindergardenEntities db = new kindergardenEntities())
     {
         int?   i = 0;
         string c = db.empGetUserIdSp(v).FirstOrDefault();
         i = db.empGetPasswordSp(c).FirstOrDefault();
         if (i != 0)
         {
             Users d = null;
             d = db.Users.Find(i);
             if (d != null)
             {
                 db.Users.Find(i).Password = us.Password;
                 db.Users.Find(i).UserName = us.UserName;
                 Connections so;
                 so = db.Connections.Find(c, v);
                 db.Connections.Remove(so);
                 Connections f = new Connections();
                 f.ChildId = v;
                 f.UserId  = us.Password;
                 db.Connections.Add(f);
                 db.SaveChanges();
             }
         }
         return(true);
     }
     return(true);
 }
Ejemplo n.º 2
0
 public static Children Getallpropertyc(string id)
 {
     using (kindergardenEntities db = new kindergardenEntities())
     {
         Children c = db.Children.Find(Convert.ToInt32(id));
         return(c);
     }
 }
Ejemplo n.º 3
0
 public static string GetUser(string id)
 {
     using (kindergardenEntities db = new kindergardenEntities())
     {
         string name = db.empGetUserSp(id).FirstOrDefault();
         return(name);
     }
 }
Ejemplo n.º 4
0
 public static string GetChild(string id)
 {
     using (kindergardenEntities db = new kindergardenEntities())
     {
         string pass = null;
         pass = db.empGetChildSp(id).FirstOrDefault();
         return(pass);
     }
 }
 public static Children Getallpropertyc(string id)
 {
     using (kindergardenEntities db = new kindergardenEntities())
     {
         int      id_check = Int32.Parse(id);
         Children c        = db.Children.Find(id_check);
         return(c);
     }
 }
Ejemplo n.º 6
0
 public static bool Register(Users u)
 {
     using (kindergardenEntities db = new kindergardenEntities())
     {
         db.Users.Add(u);
         db.SaveChanges();
         return(true);
     }
     return(false);
 }
Ejemplo n.º 7
0
 public static int AddUser(Users ch)
 {
     using (kindergardenEntities db = new kindergardenEntities())
     {
         ch.UserId = (db.Users.Max(i => i.UserId)) + 1;
         db.Users.Add(ch);
         db.SaveChanges();
         return(db.Users.Max(i => i.UserId));
     }
     return(0);
 }
Ejemplo n.º 8
0
 public static bool UpdateChildren(Children ch)
 {
     using (kindergardenEntities db = new kindergardenEntities())
     {
         Children f = db.Children.Find(ch.ChildId);
         db.Children.Remove(f);
         db.Children.Add(ch);
         db.SaveChanges();
         return(true);
     }
     return(true);
 }
Ejemplo n.º 9
0
 public static Users Getallpropertyd(string id)
 {
     using (kindergardenEntities db = new kindergardenEntities())
     {
         string c = db.empGetUserIdSp(id).FirstOrDefault();
         int?   i = null;
         i = db.empGetPasswordSp(c).FirstOrDefault();
         if (i != null)
         {
             Users d = db.Users.Find(i);
             return(d);
         }
         return(null);
     }
 }
Ejemplo n.º 10
0
 public static bool Checkifthereislike(string id)
 {
     using (kindergardenEntities db = new kindergardenEntities())
     {
         Children f = db.Children.Find(Convert.ToInt32(id));
         if (f == null)
         {
             return(false);
         }
         else
         {
             return(true);
         }
     }
 }
        public static bool Checkifthereislike(string id)
        {
            using (kindergardenEntities db = new kindergardenEntities())
            {
                int id_check = Int32.Parse(id);

                Children f = db.Children.Find(id_check);
                if (f == null)
                {
                    return(false);
                }
                else
                {
                    return(true);
                }
            }
        }
Ejemplo n.º 12
0
 public static List <Class1> GetAllChildren()
 {
     using (kindergardenEntities db = new kindergardenEntities())
     {
         List <int?>   Children = db.empGetChildIdSp().ToList();
         List <string> temp     = new List <string>();
         foreach (int?c in Children)
         {
             temp.Add(Convert.ToString(c));
         }
         List <Class1> podto = new List <Class1>();
         foreach (string t in temp)
         {
             podto.Add(new Class1(t));
         }
         return(podto);
     }
 }
Ejemplo n.º 13
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);
     }
 }