public static long Insert(Language language) { try { long count = 0; count = AccessDatabase.CountFunction(FunctionRepository.CountLanguageName, "@LanguageName", language.LanguageName); if (count > 0) { throw new Exception(Messages.AlreadyExistLanguageName); } long languageID = 0; languageID = AccessDatabase.Insert(QueryRepository.Language_Insert, "@LanguageName", language.LanguageName); if (languageID <= 0) { throw new Exception(Messages.DatabaseError); } return(languageID); } catch (Exception ex) { throw ex; } }
public static long Insert(Genre genre) { try { long count = 0; count = AccessDatabase.CountFunction(FunctionRepository.CountGenreName, "@GenreName", genre.GenreName); if (count > 0) { throw new Exception(Messages.AlreadyExistGenreName); } long genreID = 0; genreID = AccessDatabase.Insert(QueryRepository.Genre_Insert, "@GenreName", genre.GenreName, "@IsMain", Genre.DetectIsMain(genre.GenreName)); if (genreID <= 0) { throw new Exception(Messages.DatabaseError); } return(genreID); } catch (Exception ex) { throw ex; } }
public static long Insert(Person person, bool isActor, bool isDirector) { try { long personID = 0; personID = AccessDatabase.Insert(QueryRepository.Person_Insert, "@PersonFName", person.PersonFName, "@PersonLName", person.PersonLName, "@IMDBLink", person.IMDBLink, "@PhotoLink", person.PhotoLink); if (personID <= 0) { throw new Exception(Messages.DatabaseError); } if (isActor == true) { AccessDatabase.Insert(QueryRepository.Actor_Insert, "@PersonID", personID); } if (isDirector == true) { AccessDatabase.Insert(QueryRepository.Director_Insert, "@PersonID", personID); } return(personID); } catch (Exception ex) { throw ex; } }
public static long Insert(Users user) { try { long count = 0; count = AccessDatabase.CountFunction(FunctionRepository.CountUsername, "@Username", user.Username); if (count > 0) { throw new Exception(Messages.UnavailableUsername); } long userID = 0; userID = AccessDatabase.Insert(QueryRepository.Users_Insert, "@Username", user.Username, "@PasswordHash", user.PasswordHash, "@FName", user.FName, "@LName", user.LName, "@Email", user.Email); if (userID <= 0) { throw new Exception(Messages.DatabaseError); } return(userID); } catch (Exception ex) { throw ex; } }
public static long Insert(SystemParameter param) { try { long paramID = 0; paramID = AccessDatabase.Insert(QueryRepository.Param_Insert, "@ParamID", param.ParamID, "@ParamName", param.ParamName, "@ParamValue", param.ParamValue); if (paramID <= 0) { throw new Exception(Messages.DatabaseError); } return(paramID); } catch (Exception ex) { throw ex; } }