Example #1
0
        static bool updateTeachIDDisconnect(Teacher toChange, Teacher changeTo)
        {
            //Change standard description based on what is passed in
            //Disconnected mode
            Teacher toUpdate;
            Teacher change;

            using (var contxt = new SchoolDBEntities())
            {
                toUpdate = contxt.Teachers.Where(st => st.TeacherName == toChange.TeacherName).FirstOrDefault <Teacher>();
                change   = contxt.Teachers.Where(st => st.TeacherName == changeTo.TeacherName).FirstOrDefault <Teacher>();
            }

            if (toUpdate != null && change != null)
            {
                toUpdate.StandardId = change.StandardId;
            }
            else
            {
                return(false);
            }

            using (var contxt1 = new SchoolDBEntities())
            {
                contxt1.Entry(toUpdate).State = System.Data.Entity.EntityState.Modified;
                contxt1.SaveChanges();
            }
            return(true);
        }
Example #2
0
        static bool deleteStudentAddr(String studentName)
        {
            //Removes a particular students address
            Student toDel;
            var contxt = new SchoolDBEntities();

            toDel = contxt.Students.Where(st => st.StudentName == studentName).FirstOrDefault<Student>();
            contxt.Entry(toDel.StudentAddress).State = System.Data.Entity.EntityState.Deleted;
            contxt.SaveChanges();
            return true;
        }
Example #3
0
        static bool deleteStudentAddr(String studentName)
        {
            //Removes a particular students address
            Student toDel;
            var     contxt = new SchoolDBEntities();

            toDel = contxt.Students.Where(st => st.StudentName == studentName).FirstOrDefault <Student>();
            contxt.Entry(toDel.StudentAddress).State = System.Data.Entity.EntityState.Deleted;
            contxt.SaveChanges();
            return(true);
        }
Example #4
0
        static bool updateStandard(String standardName, String newDescription)
        {
            //Change standard description based on what is passed in
            var      contxt = new SchoolDBEntities();
            Standard toUpdate;

            toUpdate = contxt.Standards.Where(st => st.StandardName == standardName).FirstOrDefault <Standard>();

            if (toUpdate != null)
            {
                toUpdate.Description = newDescription;
            }
            else
            {
                return(false);
            }
            contxt.Entry(toUpdate).State = System.Data.Entity.EntityState.Modified;
            contxt.SaveChanges();

            return(true);
        }
Example #5
0
        static bool updateStudent(String studentName, String newAddr)
        {
            //Updates a student based on whats passed in to the function
            var     contxt = new SchoolDBEntities();
            Student toUpdate;

            toUpdate = contxt.Students.Where(st => st.StudentName == studentName).FirstOrDefault <Student>();

            if (toUpdate != null)
            {
                toUpdate.StudentAddress.Address1 = newAddr;
            }
            else
            {
                return(false);
            }
            contxt.Entry(toUpdate).State = System.Data.Entity.EntityState.Modified;
            contxt.SaveChanges();

            return(true);
        }
Example #6
0
        static bool updateStudentDisconnect(String studentName, String newAddr)
        {
            Student toUpdate;

            //Update student address in disconnected mode
            using (var contxt = new SchoolDBEntities())
            {
                toUpdate = contxt.Students.Where(st => st.StudentName == studentName).FirstOrDefault <Student>();
            }
            if (toUpdate != null)
            {
                toUpdate.StudentAddress.Address1 = newAddr;
            }
            else
            {
                return(false);
            }
            using (var contxt1 = new SchoolDBEntities())
            {
                contxt1.Entry(toUpdate).State = System.Data.Entity.EntityState.Modified;
                contxt1.SaveChanges();
            }
            return(true);
        }
Example #7
0
        static bool updateTeachIDDisconnect(Teacher toChange, Teacher changeTo)
        {
            //Change standard description based on what is passed in
            //Disconnected mode
            Teacher toUpdate;
            Teacher change;
            using (var contxt = new SchoolDBEntities())
            {
                toUpdate = contxt.Teachers.Where(st => st.TeacherName == toChange.TeacherName).FirstOrDefault<Teacher>();
                change = contxt.Teachers.Where(st => st.TeacherName == changeTo.TeacherName).FirstOrDefault<Teacher>();
            }

            if (toUpdate != null && change != null)
            {
                toUpdate.StandardId = change.StandardId;
            }
            else
            {
                return false;
            }

            using (var contxt1 = new SchoolDBEntities())
            {
                contxt1.Entry(toUpdate).State = System.Data.Entity.EntityState.Modified;
                contxt1.SaveChanges();
            }
            return true;
        }
Example #8
0
        static bool updateTeachID(Teacher toChange, Teacher changeTo)
        {
            //Change standard description based on what is passed in
            var contxt = new SchoolDBEntities();
            Teacher toUpdate;
            Teacher change;

            toUpdate = contxt.Teachers.Where(st => st.TeacherName== toChange.TeacherName).FirstOrDefault<Teacher>();
            change = contxt.Teachers.Where(st => st.TeacherName == changeTo.TeacherName).FirstOrDefault<Teacher>();

            if (toUpdate != null)
            {
                toUpdate.StandardId = change.StandardId;
            }
            else
            {
                return false;
            }
            contxt.Entry(toUpdate).State = System.Data.Entity.EntityState.Modified;
            contxt.SaveChanges();

            return true;
        }
Example #9
0
 static bool updateStudentDisconnect(String studentName, String newAddr)
 {
     Student toUpdate;
     //Update student address in disconnected mode
     using (var contxt = new SchoolDBEntities())
     {
         toUpdate = contxt.Students.Where(st => st.StudentName == studentName).FirstOrDefault<Student>();
     }
     if (toUpdate != null)
     {
         toUpdate.StudentAddress.Address1 = newAddr;
     }
     else
     {
         return false;
     }
     using (var contxt1 = new SchoolDBEntities())
     {
         contxt1.Entry(toUpdate).State = System.Data.Entity.EntityState.Modified;
         contxt1.SaveChanges();
     }
     return true;
 }
Example #10
0
        static bool updateStudent(String studentName, String newAddr)
        {
            //Updates a student based on whats passed in to the function
            var contxt = new SchoolDBEntities();
            Student toUpdate;

            toUpdate = contxt.Students.Where(st => st.StudentName == studentName).FirstOrDefault<Student>();

            if(toUpdate != null)
            {
                toUpdate.StudentAddress.Address1 = newAddr;
            }
            else
            {
                return false;
            }
            contxt.Entry(toUpdate).State = System.Data.Entity.EntityState.Modified;
            contxt.SaveChanges();

            return true;
        }
Example #11
0
        static bool updateStandard(String standardName, String newDescription)
        {
            //Change standard description based on what is passed in
            var contxt = new SchoolDBEntities();
            Standard toUpdate;

            toUpdate = contxt.Standards.Where(st => st.StandardName == standardName).FirstOrDefault<Standard>();

            if (toUpdate != null)
            {
                toUpdate.Description = newDescription;
            }
            else
            {
                return false;
            }
            contxt.Entry(toUpdate).State = System.Data.Entity.EntityState.Modified;
            contxt.SaveChanges();

            return true;
        }