Ejemplo n.º 1
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;
 }
Ejemplo n.º 2
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;
 }
Ejemplo n.º 3
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;
 }
Ejemplo n.º 4
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;
 }
Ejemplo n.º 5
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;
 }
Ejemplo n.º 6
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;
 }
Ejemplo n.º 7
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;
 }
Ejemplo n.º 8
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);
        }
Ejemplo n.º 9
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);
        }
Ejemplo n.º 10
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);
        }
Ejemplo n.º 11
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);
        }
Ejemplo n.º 12
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;
        }
Ejemplo n.º 13
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);
        }
Ejemplo n.º 14
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);
        }
Ejemplo n.º 15
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);
        }
Ejemplo n.º 16
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);
        }
Ejemplo n.º 17
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);
        }
Ejemplo n.º 18
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;
        }
Ejemplo n.º 19
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);
        }
Ejemplo n.º 20
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);
        }
Ejemplo n.º 21
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);
        }
Ejemplo n.º 22
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);
        }
Ejemplo n.º 23
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);
        }
Ejemplo n.º 24
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);
        }
Ejemplo n.º 25
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);
        }
Ejemplo n.º 26
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;
        }
Ejemplo n.º 27
0
        public bool Remove(Contact entity)
        {
            bool isMerged = true;


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

            return(isMerged);
        }
Ejemplo n.º 28
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;
        }
Ejemplo n.º 29
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;
 }
Ejemplo n.º 30
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;

        }
Ejemplo n.º 31
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;
        }
Ejemplo n.º 32
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;
 }
Ejemplo n.º 33
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;
 }
Ejemplo n.º 34
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;
 }