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