Пример #1
0
 private static bool commitChanges(synupEntities _database)
 {
     try
     {
         _database.SaveChanges();
         return(true);
     }
     catch (Exception e)
     {
         Debug.WriteLine(e);
         return(false);
     }
 }
Пример #2
0
        //private static synupEntities database = new synupEntities();

        /* DELETED METHOD - No used.
         * /// <summary>
         * /// Saves the changes done over the database.
         * /// </summary>
         * /// <returns>Returns a boolean depending in whether the operation is completed succesfully or not.</returns>
         * private static bool commitChanges()
         * {
         *  try
         *  {
         *      new synupEntities().SaveChanges();
         *      return true;
         *  }
         *  catch (Exception e)
         *  {
         *      Debug.WriteLine(e);
         *      return false;
         *  }
         * }
         */

        /// <summary>
        /// Saves the changes done over the database.
        /// </summary>
        /// <returns>Returns a boolean depending in whether the operation is completed succesfully or not.</returns>
        private static bool commitChanges(synupEntities _database)
        {
            //The saveChanges will be called under a trycatch instruction. If the command is completed succesfully it will return a true.
            try
            {
                _database.SaveChanges();
                return(true);
            }
            catch (Exception e)
            {
                //We write the error in the Debug window of the system console.
                Debug.WriteLine(e);
                return(false);
            }
        }