Exemplo n.º 1
0
 public List <Contact> FindAll()
 {
     using (ElearningEntities e = new ElearningEntities())
     {
         List <Contact> c = new List <Contact>();
         try
         {
             IEnumerable <Contact> contact = e.Contacts.OrderBy(i => i.Email);
             c = contact.ToList();
         }
         catch {
             c = null;
         }
         return(c);
     }
 }
Exemplo n.º 2
0
        public Contact FindByID(string name)
        {
            Contact con = null;
            using (ElearningEntities e = new ElearningEntities())
            {
                try
                {
                   con = e.Contacts.First(i => i.Email == name);
                }
                catch {

                    return con;
                }
                return con;
            }  
        }
Exemplo n.º 3
0
        public Contact FindByID(string name)
        {
            Contact con = null;

            using (ElearningEntities e = new ElearningEntities())
            {
                try
                {
                    con = e.Contacts.First(i => i.Email == name);
                }
                catch {
                    return(con);
                }
                return(con);
            }
        }
Exemplo n.º 4
0
 public List<Department> FindAll()
 {
     List<Department> selectedDep = null;
     try
     {
         using (ElearningEntities e = new ElearningEntities())
         {
             IEnumerable<Department> dep = e.Departments;
             selectedDep = dep.ToList();
         }
      }
      catch
      {
          return selectedDep;
      }
     return selectedDep;
 }
Exemplo n.º 5
0
 public List<Question> FindAll()
 {
     List<Question> selectedQuestioner = null;
     try
     {
         using (ElearningEntities e = new ElearningEntities())
         {
             IEnumerable<Question> q = e.Questions;
             selectedQuestioner = q.ToList();
         }
     }
     catch
     {
         return selectedQuestioner;
     }
     return selectedQuestioner;
 }
Exemplo n.º 6
0
        public List<Contact> FindAll()
        {
            using (ElearningEntities e = new ElearningEntities())
                {
                    List<Contact> c = new List<Contact>();
                    try
                    {
                        IEnumerable<Contact> contact = e.Contacts.OrderBy(i => i.Email);
                        c = contact.ToList();  
                    }
                    catch {

                        c = null;
                    }
                return c;
                }
        }
Exemplo n.º 7
0
 public Employee FindById(string firstname, string lastname)
 {
     Employee selectedEmployee = null;
     try
     {
         using (ElearningEntities e = new ElearningEntities())
         {
             Employee emp = e.Employees.First(i => i.Firstname == firstname);
             selectedEmployee = emp;
         }
     }
     catch
     {
         return selectedEmployee;
     }
     return selectedEmployee;
 }
Exemplo n.º 8
0
 public Score FindById(int id)
 {
     Score selectedScore = null;
     try
     {
         using (ElearningEntities e = new ElearningEntities())
         {
             Score s = e.Scores.First(i => i.ScoreID == id);
             selectedScore = s;
         }
     }
     catch
     {
         return selectedScore;
     }
     return selectedScore;
 }
Exemplo n.º 9
0
        //public Quiz FindbyId(int id)
        //{
           // Quiz selectedQuiz = null;
            //try
            //{
                //using (ElearningEntities e = new ElearningEntities())
                //{
                    //Quiz q = e.Quizs.First(i => i.QuizID == id);
                    //selectedQuiz = q;
                //}
            //}
            //catch
            //{
                //return selectedQuiz;
            //}
            //return selectedQuiz;
        //}

        public List<Answer> FindAll()
        {
            List<Answer> selectedAnswer = null;
            try
            {
                using (ElearningEntities e = new ElearningEntities())
                {
                    IEnumerable<Answer> a = e.Answers;
                    selectedAnswer = a.ToList();
                }
            }
            catch
            {
                return selectedAnswer;
            }
            return selectedAnswer;
        }
Exemplo n.º 10
0
 public Position FindById(int id)
 {
     Position selectedProgress = null;
     try
     {
         using (ElearningEntities e = new ElearningEntities())
         {
             Position p = e.Positions.First(i => i.PositionID == id);
             selectedProgress = p;
         }
     }
     catch
     {
         return selectedProgress;
     }
     return selectedProgress;
 }
Exemplo n.º 11
0
 public List<Policy> FindAll()
 {
     List<Policy> selectedPolicy = null;
     try
     {
         using (ElearningEntities e = new ElearningEntities())
         {
             IEnumerable<Policy> p = e.Policies;
             selectedPolicy = p.ToList();
         }
     }
     catch
     {
         return selectedPolicy;
     }
     return selectedPolicy;
 }
Exemplo n.º 12
0
        public Location FindbyId(int id)
        {
            Location l = null;

            try{
                using (ElearningEntities e = new ElearningEntities())
                {
                    l = e.Locations.First(i => i.LocationID == id);
                }
            }
            catch
            {
                return(l);
            }

            return(l);
        }
Exemplo n.º 13
0
 public List<Position> FindAll()
 {
     List<Position> selectedProgress = null;
     try
     {
         using (ElearningEntities e = new ElearningEntities())
         {
             IEnumerable<Position> p = e.Positions;
             selectedProgress = p.ToList();
         }
     }
     catch
     {
         return selectedProgress;
     }
     return selectedProgress;
 }
Exemplo n.º 14
0
 public List<Employee> FindAll()
 {
     List<Employee> selectedEmployee = null;
     try
     {
         using (ElearningEntities e = new ElearningEntities())
         {
             IEnumerable<Employee> emp = e.Employees;
             selectedEmployee = emp.ToList();
         }
     }
     catch
     {
         return selectedEmployee;
     }
     return selectedEmployee;
 }
Exemplo n.º 15
0
 public Policy FindById(int reference)
 {
     Policy selectedPolicy = null;
     try
     {
         using (ElearningEntities e = new ElearningEntities())
         {
             Policy p = e.Policies.First(i => i.PolicyID == reference);
             selectedPolicy = p;
         }
     }
     catch
     {
         return selectedPolicy;
     }
     return selectedPolicy;
 }
Exemplo n.º 16
0
 public List<Score> FindAll()
 {
     List<Score> selectedScore = null;
     try
     {
         using (ElearningEntities e = new ElearningEntities())
         {
             IEnumerable<Score> s = e.Scores;
             selectedScore = s.ToList();
         }
     }
     catch
     {
         return selectedScore;
     }
     return selectedScore;
 }
Exemplo n.º 17
0
        public Score FindById(int id)
        {
            Score selectedScore = null;

            try
            {
                using (ElearningEntities e = new ElearningEntities())
                {
                    Score s = e.Scores.First(i => i.ScoreID == id);
                    selectedScore = s;
                }
            }
            catch
            {
                return(selectedScore);
            }
            return(selectedScore);
        }
Exemplo n.º 18
0
        public List <Score> FindAll()
        {
            List <Score> selectedScore = null;

            try
            {
                using (ElearningEntities e = new ElearningEntities())
                {
                    IEnumerable <Score> s = e.Scores;
                    selectedScore = s.ToList();
                }
            }
            catch
            {
                return(selectedScore);
            }
            return(selectedScore);
        }
Exemplo n.º 19
0
        public List<Department> FindById(string name)
        {
            List<Department> selectedDep = null;
            try
            {
                using (ElearningEntities e = new ElearningEntities())
                {
                    IEnumerable<Department> dep = e.Departments.Where(i => i.DepartmentName == name);
                    selectedDep = dep.ToList();
                }

            }
            catch
            {
                return selectedDep;
            }
            return selectedDep;
        }
Exemplo n.º 20
0
        public List <Department> FindAll()
        {
            List <Department> selectedDep = null;

            try
            {
                using (ElearningEntities e = new ElearningEntities())
                {
                    IEnumerable <Department> dep = e.Departments;
                    selectedDep = dep.ToList();
                }
            }
            catch
            {
                return(selectedDep);
            }
            return(selectedDep);
        }
Exemplo n.º 21
0
        //public Quiz FindbyId(int id)
        //{
        // Quiz selectedQuiz = null;
        //try
        //{
        //using (ElearningEntities e = new ElearningEntities())
        //{
        //Quiz q = e.Quizs.First(i => i.QuizID == id);
        //selectedQuiz = q;
        //}
        //}
        //catch
        //{
        //return selectedQuiz;
        //}
        //return selectedQuiz;
        //}

        public List <Answer> FindAll()
        {
            List <Answer> selectedAnswer = null;

            try
            {
                using (ElearningEntities e = new ElearningEntities())
                {
                    IEnumerable <Answer> a = e.Answers;
                    selectedAnswer = a.ToList();
                }
            }
            catch
            {
                return(selectedAnswer);
            }
            return(selectedAnswer);
        }
Exemplo n.º 22
0
        public List <Policy> FindAll()
        {
            List <Policy> selectedPolicy = null;

            try
            {
                using (ElearningEntities e = new ElearningEntities())
                {
                    IEnumerable <Policy> p = e.Policies;
                    selectedPolicy = p.ToList();
                }
            }
            catch
            {
                return(selectedPolicy);
            }
            return(selectedPolicy);
        }
Exemplo n.º 23
0
        public Employee FindById(string firstname, string lastname)
        {
            Employee selectedEmployee = null;

            try
            {
                using (ElearningEntities e = new ElearningEntities())
                {
                    Employee emp = e.Employees.First(i => i.Firstname == firstname);
                    selectedEmployee = emp;
                }
            }
            catch
            {
                return(selectedEmployee);
            }
            return(selectedEmployee);
        }
Exemplo n.º 24
0
        public Policy FindById(int reference)
        {
            Policy selectedPolicy = null;

            try
            {
                using (ElearningEntities e = new ElearningEntities())
                {
                    Policy p = e.Policies.First(i => i.PolicyID == reference);
                    selectedPolicy = p;
                }
            }
            catch
            {
                return(selectedPolicy);
            }
            return(selectedPolicy);
        }
Exemplo n.º 25
0
        public List <Question> FindAll()
        {
            List <Question> selectedQuestioner = null;

            try
            {
                using (ElearningEntities e = new ElearningEntities())
                {
                    IEnumerable <Question> q = e.Questions;
                    selectedQuestioner = q.ToList();
                }
            }
            catch
            {
                return(selectedQuestioner);
            }
            return(selectedQuestioner);
        }
Exemplo n.º 26
0
        public List <Department> FindById(string name)
        {
            List <Department> selectedDep = null;

            try
            {
                using (ElearningEntities e = new ElearningEntities())
                {
                    IEnumerable <Department> dep = e.Departments.Where(i => i.DepartmentName == name);
                    selectedDep = dep.ToList();
                }
            }
            catch
            {
                return(selectedDep);
            }
            return(selectedDep);
        }
Exemplo n.º 27
0
        public List <Employee> FindAll()
        {
            List <Employee> selectedEmployee = null;

            try
            {
                using (ElearningEntities e = new ElearningEntities())
                {
                    IEnumerable <Employee> emp = e.Employees;
                    selectedEmployee = emp.ToList();
                }
            }
            catch
            {
                return(selectedEmployee);
            }
            return(selectedEmployee);
        }
Exemplo n.º 28
0
        public Position FindById(int id)
        {
            Position selectedProgress = null;

            try
            {
                using (ElearningEntities e = new ElearningEntities())
                {
                    Position p = e.Positions.First(i => i.PositionID == id);
                    selectedProgress = p;
                }
            }
            catch
            {
                return(selectedProgress);
            }
            return(selectedProgress);
        }
Exemplo n.º 29
0
        public List <Position> FindAll()
        {
            List <Position> selectedProgress = null;

            try
            {
                using (ElearningEntities e = new ElearningEntities())
                {
                    IEnumerable <Position> p = e.Positions;
                    selectedProgress = p.ToList();
                }
            }
            catch
            {
                return(selectedProgress);
            }
            return(selectedProgress);
        }
Exemplo n.º 30
0
 public bool Persist(Position entity)
 {
     bool isPeristed = false;
     try
     {
         using (ElearningEntities e = new ElearningEntities())
         {
             e.Positions.Add(entity);
             e.SaveChanges();
             isPeristed = true;
         }
     }
     catch
     {
         return isPeristed;
     }
     return isPeristed;
 }
Exemplo n.º 31
0
        public List <Location> FindAll()
        {
            List <Location> allSpaces = null;

            try
            {
                using (ElearningEntities e = new ElearningEntities())
                {
                    IEnumerable <Location> loc = e.Locations;
                    allSpaces = loc.ToList();
                }
            }
            catch
            {
                return(allSpaces);
            }
            return(allSpaces);
        }
Exemplo n.º 32
0
 public bool Merge(Score entity)
 {
     bool isMerge = false;
     try
     {
         using (ElearningEntities e = new ElearningEntities())
         {
             Score s = e.Scores.First(i => i.ScoreID == entity.ScoreID);
             s.Attempt = entity.Attempt;
             e.SaveChanges();
             isMerge = true;
         }
     }
     catch
     {
         return isMerge;
     }
     return isMerge;
 }
Exemplo n.º 33
0
 public bool Merge(Department entity)
 {
      bool isMerge = false;
      try
      {
          using (ElearningEntities e = new ElearningEntities())
          {
              Department d = e.Departments.First(i => i.DepartmentName == entity.DepartmentName);
              d.Description = entity.Description;
              e.SaveChanges();
              isMerge = true;
          }
      }
      catch
      {
          return isMerge;
      }
      return isMerge;
 }
Exemplo n.º 34
0
        public bool Persist(Policy entity)
        {
            bool isPeristed = false;

            try
            {
                using (ElearningEntities e = new ElearningEntities())
                {
                    e.Policies.Add(entity);
                    e.SaveChanges();
                    isPeristed = true;
                }
            }
            catch
            {
                return(isPeristed);
            }
            return(isPeristed);
        }
Exemplo n.º 35
0
 public bool Merge(Question entity)
 {
     bool isMerge = false;
     try
     {
         using (ElearningEntities e = new ElearningEntities())
         {
             Question q = e.Questions.First(i => i.QuestionID == entity.QuestionID);
             q.Description = entity.Description;
             e.SaveChanges();
             isMerge = true;
         }
     }
     catch
     {
         return isMerge;
     }
     return isMerge;
 }
Exemplo n.º 36
0
 public bool Merge(Employee entity)
 {
     bool isMerge = false;
     try
     {
         using (ElearningEntities e = new ElearningEntities())
         {
             Employee emp = e.Employees.First(i => i.EmployeeID == entity.EmployeeID);
             emp.JobTitle = entity.JobTitle;
             e.SaveChanges();
             isMerge = true;
         }
     }
     catch
     {
         return isMerge;
     }
     return isMerge;
 }
Exemplo n.º 37
0
 public bool Merge(Position entity)
 {
     bool isMerge = false;
     try
     {
         using (ElearningEntities e = new ElearningEntities())
         {
             Position p = e.Positions.First(i => i.PositionID == entity.PositionID);
             p.PositionName = entity.PositionName;
             e.SaveChanges();
             isMerge = true;
         }
     }
     catch
     {
         return isMerge;
     }
     return isMerge;
 }
Exemplo n.º 38
0
 public bool Remove(Question entity)
 {
     bool isRemoved = false;
     try
     {
         using (ElearningEntities e = new ElearningEntities())
         {
             Question q= e.Questions.First(i => i.QuestionID == entity.QuestionID);
             e.Questions.Remove(q);
             e.SaveChanges();
             isRemoved = true;
         }
     }
     catch
     {
         return isRemoved;
     }
     return isRemoved;
 }
Exemplo n.º 39
0
        public bool Remove(Answer entity)
        {
            bool isRemoved = false;

            try
            {
                using (ElearningEntities e = new ElearningEntities())
                {
                    Answer a = e.Answers.First(i => i.AnswerID == entity.AnswerID);
                    e.Answers.Remove(a);
                    e.SaveChanges();
                    isRemoved = true;
                }
            }
            catch
            {
                return(isRemoved);
            }
            return(isRemoved);
        }
Exemplo n.º 40
0
        public bool Remove(Score entity)
        {
            bool isRemoved = false;

            try
            {
                using (ElearningEntities e = new ElearningEntities())
                {
                    Score s = e.Scores.First(i => i.ScoreID == entity.ScoreID);
                    e.Scores.Remove(s);
                    e.SaveChanges();
                    isRemoved = true;
                }
            }
            catch
            {
                return(isRemoved);
            }
            return(isRemoved);
        }
Exemplo n.º 41
0
        public bool Merge(Question entity)
        {
            bool isMerge = false;

            try
            {
                using (ElearningEntities e = new ElearningEntities())
                {
                    Question q = e.Questions.First(i => i.QuestionID == entity.QuestionID);
                    q.Description = entity.Description;
                    e.SaveChanges();
                    isMerge = true;
                }
            }
            catch
            {
                return(isMerge);
            }
            return(isMerge);
        }
Exemplo n.º 42
0
        public bool Merge(Score entity)
        {
            bool isMerge = false;

            try
            {
                using (ElearningEntities e = new ElearningEntities())
                {
                    Score s = e.Scores.First(i => i.ScoreID == entity.ScoreID);
                    s.Attempt = entity.Attempt;
                    e.SaveChanges();
                    isMerge = true;
                }
            }
            catch
            {
                return(isMerge);
            }
            return(isMerge);
        }
Exemplo n.º 43
0
        public bool Merge(Department entity)
        {
            bool isMerge = false;

            try
            {
                using (ElearningEntities e = new ElearningEntities())
                {
                    Department d = e.Departments.First(i => i.DepartmentName == entity.DepartmentName);
                    d.Description = entity.Description;
                    e.SaveChanges();
                    isMerge = true;
                }
            }
            catch
            {
                return(isMerge);
            }
            return(isMerge);
        }
Exemplo n.º 44
0
        public bool Remove(Department entity)
        {
            bool isRemoved = false;

            try
            {
                using (ElearningEntities e = new ElearningEntities())
                {
                    Department d = e.Departments.First(i => i.DepartmentID == entity.DepartmentID);
                    e.Departments.Remove(d);
                    e.SaveChanges();
                    isRemoved = true;
                }
            }
            catch
            {
                return(isRemoved);
            }
            return(isRemoved);
        }
Exemplo n.º 45
0
        public bool Remove(Question entity)
        {
            bool isRemoved = false;

            try
            {
                using (ElearningEntities e = new ElearningEntities())
                {
                    Question q = e.Questions.First(i => i.QuestionID == entity.QuestionID);
                    e.Questions.Remove(q);
                    e.SaveChanges();
                    isRemoved = true;
                }
            }
            catch
            {
                return(isRemoved);
            }
            return(isRemoved);
        }
Exemplo n.º 46
0
        public bool Merge(Answer entity)
        {

            bool isMerge = false;
            try
            {
                using (ElearningEntities e = new ElearningEntities())
                {
                    Answer a = e.Answers.First(i => i.AnswerID == entity.AnswerID);
                    a.Option1 = entity.Option1;
                    e.SaveChanges();
                    isMerge = true;
                }
            }
            catch
            {
                return isMerge;
            }
            return isMerge;
        }
Exemplo n.º 47
0
        public List<Location> FindAll()
        {
            List<Location> allSpaces = null;
            try
            {

                using (ElearningEntities e = new ElearningEntities())
                {

                    IEnumerable<Location> loc = e.Locations;
                    allSpaces = loc.ToList();
                }

            }
            catch
            {
                return allSpaces;
            }
            return allSpaces;
        }
Exemplo n.º 48
0
        public bool Merge(Employee entity)
        {
            bool isMerge = false;

            try
            {
                using (ElearningEntities e = new ElearningEntities())
                {
                    Employee emp = e.Employees.First(i => i.EmployeeID == entity.EmployeeID);
                    emp.JobTitle = entity.JobTitle;
                    e.SaveChanges();
                    isMerge = true;
                }
            }
            catch
            {
                return(isMerge);
            }
            return(isMerge);
        }
Exemplo n.º 49
0
        public bool Persist(Employee entity)
        {
            bool isPeristed = false;

            try
            {
                using (ElearningEntities e = new ElearningEntities())
                {
                    e.Employees.Add(entity);
                    e.SaveChanges();
                    isPeristed = true;
                }
            }
            catch
            {
                return(isPeristed);
                //Console.Write(e.ToString());
            }
            return(isPeristed);
        }
Exemplo n.º 50
0
        public bool Remove(Employee entity)
        {
            bool isRemoved = false;

            try
            {
                using (ElearningEntities e = new ElearningEntities())
                {
                    Employee d = e.Employees.First(i => i.EmployeeID == entity.EmployeeID);
                    e.Employees.Remove(d);
                    e.SaveChanges();
                    isRemoved = true;
                }
            }
            catch
            {
                return(isRemoved);
            }
            return(isRemoved);
        }
Exemplo n.º 51
0
        public bool Merge(Answer entity)
        {
            bool isMerge = false;

            try
            {
                using (ElearningEntities e = new ElearningEntities())
                {
                    Answer a = e.Answers.First(i => i.AnswerID == entity.AnswerID);
                    a.Option1 = entity.Option1;
                    e.SaveChanges();
                    isMerge = true;
                }
            }
            catch
            {
                return(isMerge);
            }
            return(isMerge);
        }
Exemplo n.º 52
0
        public bool Persist(Employee entity)
        {
            bool isPeristed = false;
            try
            {
                using (ElearningEntities e = new ElearningEntities())
                {
                    e.Employees.Add(entity);
                    e.SaveChanges();
                    isPeristed = true;
                }
            }
            catch
            {
                return isPeristed;
                //Console.Write(e.ToString());

            }
            return isPeristed;
        }
Exemplo n.º 53
0
        public bool Remove(Policy entity)
        {
            bool isRemoved = false;

            try
            {
                using (ElearningEntities e = new ElearningEntities())
                {
                    Policy p = e.Policies.First(i => i.PolicyID == entity.PolicyID);
                    e.Policies.Remove(p);
                    e.SaveChanges();
                    isRemoved = true;
                }
            }
            catch
            {
                return(isRemoved);
            }
            return(isRemoved);
        }
Exemplo n.º 54
0
        public bool Merge(Policy entity)
        {
            bool isMerge = false;

            try
            {
                using (ElearningEntities e = new ElearningEntities())
                {
                    Policy p = e.Policies.First(i => i.PolicyID == entity.PolicyID);
                    p.PolicyName = entity.PolicyName;
                    e.SaveChanges();
                    isMerge = true;
                }
            }
            catch
            {
                return(isMerge);
            }
            return(isMerge);
        }
Exemplo n.º 55
0
        public  bool  Persist(Contact entity)
        {
            bool isPersisted = true;
            try
            {
                using (ElearningEntities e = new ElearningEntities())
                {

                    e.Contacts.Add(entity);
                    e.SaveChanges();
                }
               
            }
            catch (Exception e)
            {
                isPersisted = false;
                Console.WriteLine(e.ToString());
            }

            return isPersisted;
        }
Exemplo n.º 56
0
        public Location FindbyId(int id)
        {
            
            Location l = null;
            try{

                using (ElearningEntities e = new ElearningEntities())
                {

                l = e.Locations.First(i => i.LocationID == id);
                
                }
           
            }
            catch
            {

                return l;
            }
           
            return l;
        }
Exemplo n.º 57
0
        public bool Merge(Location entity)
        {
            bool isMerged = false;

            try
            {
                using (ElearningEntities e = new ElearningEntities())
                {
                    Location c = e.Locations.First(i => i.LocationID == entity.LocationID);
                    c.CubeName = entity.CubeName;
                    c.MoreDetails = entity.MoreDetails;
                    e.SaveChanges();
                    isMerged = true;

                }
            }
            catch
            {
                return isMerged;
            }
            return isMerged;
        }
Exemplo n.º 58
0
        public bool Merge(Contact entity)
        {
            bool isMerged = true;


            using (ElearningEntities e = new ElearningEntities())
            {
                Contact contact;
                try
                {
                    contact = e.Contacts.First(i => i.ContactID == entity.ContactID);
                    contact.Email = entity.Email;
           
                   e.SaveChanges();
                }
                catch
                {
                    isMerged = false;
                }
            }

            return isMerged;
        }
Exemplo n.º 59
0
 public bool Remove(Employee entity)
 {
     bool isRemoved = false;
     try
     {
         using (ElearningEntities e = new ElearningEntities())
         {
             Employee d = e.Employees.First(i => i.EmployeeID == entity.EmployeeID);
             e.Employees.Remove(d);
             e.SaveChanges();
             isRemoved = true;
         }
     }
     catch
     {
         return isRemoved;
     }
     return isRemoved;
 }
Exemplo n.º 60
0
 public bool Remove(Position entity)
 {
     bool isRemoved = false;
     try
     {
         using (ElearningEntities e = new ElearningEntities())
         {
             Position p = e.Positions.First(i => i.PositionID == entity.PositionID);
             e.Positions.Remove(p);
             e.SaveChanges();
             isRemoved = true;
         }
     }
     catch
     {
         return isRemoved;
     }
     return isRemoved;
 }