Пример #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;
 }
Пример #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;
 }
Пример #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;
 }
Пример #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;
 }
Пример #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;
 }
Пример #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;
 }
Пример #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;
 }
Пример #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);
        }
Пример #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);
        }
Пример #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);
        }
Пример #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);
        }
Пример #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;
        }
Пример #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);
        }
Пример #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);
        }
Пример #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);
        }
Пример #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);
        }
Пример #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);
        }
Пример #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;
        }
Пример #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);
        }
Пример #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);
        }
Пример #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);
        }
Пример #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);
        }
Пример #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);
        }
Пример #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);
        }
Пример #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);
        }
Пример #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;
        }
Пример #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);
        }
Пример #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;
        }
Пример #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;
 }
Пример #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;

        }
Пример #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;
        }
Пример #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;
 }
Пример #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;
 }
Пример #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;
 }