Example #1
0
        public void AlterTeachers(Teacher teacher)
        {
            try
               {

               AbrirConexao();
               cmd.CommandType = System.Data.CommandType.StoredProcedure;
               cmd.CommandText = "UpdateTeacher";
               cmd.Parameters.Clear();
               cmd.Parameters.AddWithValue("@TeacherID", teacher.TeacherID);
               cmd.Parameters.AddWithValue("@TeacherLastName", teacher.TeacherLastName);
               cmd.Parameters.AddWithValue("@TeacherFirstName", teacher.TeacherFirstName);
               cmd.Parameters.AddWithValue("@TeacherDateJoin", teacher.TeacherDateJoin);
               cmd.Parameters.AddWithValue("@TeacherDepartment", teacher.TeacherDepartment);
               cmd.ExecuteNonQuery();

               }
               catch (Exception ex)
               {

               throw ex;
               }

               finally {

               FecharConexao();

               }
        }
Example #2
0
        public void DeleteTeachers(Teacher teacher)
        {
            try
               {
               OpenConnection();
               cmd.CommandType = System.Data.CommandType.StoredProcedure;
               cmd.CommandText = "DeleteTeacher";
               cmd.Parameters.Clear();
               cmd.Parameters.AddWithValue("@TeacherID", teacher.TeacherID);
               cmd.Parameters.AddWithValue("@LoginID", -1);
               cmd.ExecuteNonQuery();
               GravaLog("Deletando professores");

               }
               catch (Exception ex)
               {

               throw ex;
               GravaLog(ex.Message.ToString());
               }

               finally {
               ClosedConnection();
               }
        }
Example #3
0
        public void InsetTeachers(Teacher teacher, UsersLogin usersLogin)
        {
            try{

               OpenConnection();
               cmd.CommandType = System.Data.CommandType.StoredProcedure;
               cmd.CommandText = "InsertTeacher";
               cmd.Parameters.Clear();
               cmd.Parameters.AddWithValue("@TeacherLastName", teacher.TeacherLastName);
               cmd.Parameters.AddWithValue("@TeacherFirstName", teacher.TeacherFirstName);
               cmd.Parameters.AddWithValue("@TeacherDepartment", teacher.TeacherDepartment);
               cmd.Parameters.AddWithValue("@UserEmail", usersLogin.UserEmail);
               cmd.Parameters.AddWithValue("@UserPassword", usersLogin.UserPassword);
               cmd.ExecuteNonQuery();
               }
               catch (Exception){

               throw;
               }

               finally {

               ClosedConnection();

               }
        }
Example #4
0
        public void AlterTeachers(Teacher teacher)
        {
            try
               {

               OpenConnection();
               cmd.CommandType = System.Data.CommandType.StoredProcedure;
               cmd.CommandText = "UpdateTeacher";
               cmd.Parameters.Clear();
               cmd.Parameters.AddWithValue("@TeacherID", teacher.TeacherID);
               cmd.Parameters.AddWithValue("@TeacherLastName", teacher.TeacherLastName);
               cmd.Parameters.AddWithValue("@TeacherFirstName", teacher.TeacherFirstName);
               cmd.Parameters.AddWithValue("@TeacherDateJoin", teacher.TeacherDateJoin);
               cmd.Parameters.AddWithValue("@TeacherDepartment", teacher.TeacherDepartment);
               cmd.ExecuteNonQuery();
               GravaLog("Alterando a lista de professores");

               }
               catch (Exception ex)
               {

               throw ex;
               GravaLog(ex.Message.ToString());
               }

               finally {

               ClosedConnection();

               }
        }
Example #5
0
        public void DeleteTeachers(Teacher teacher)
        {
            try
               {
               AbrirConexao();
               cmd.CommandType = System.Data.CommandType.StoredProcedure;
               cmd.CommandText = "DeleteTeacher";
               cmd.Parameters.Clear();
               cmd.Parameters.AddWithValue("@TeacherID", teacher.TeacherID);
               cmd.Parameters.AddWithValue("@LoginID", -1);
               cmd.ExecuteNonQuery();

               }
               catch (Exception ex)
               {

               throw ex;
               }

               finally {
               FecharConexao();
               }
        }