示例#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();

               }
        }
示例#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();
               }
        }
示例#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();

               }
        }
示例#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();

               }
        }
示例#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();
               }
        }