public static void AddUser(string name, DateTime birthday, string gender) { AnimeDataContext db = new AnimeDataContext(); User adusr = new User {Birthdate = birthday, Gender = gender, NickName = name}; db.Users.InsertOnSubmit(adusr); db.SubmitChanges(); }
public static void AddType(string name) { AnimeDataContext db = new AnimeDataContext(); SerialType adt = new SerialType {SerialName = name}; db.SerialTypes.InsertOnSubmit(adt); db.SubmitChanges(); }
// returns all manga public static MangaConstructModel[] ReturnAllFavManga() { AnimeDataContext db = new AnimeDataContext(); int?[] aniids = (from tp in db.FavMangas where tp.UserID == UserLogModel.lastid select tp.MangaID).ToArray(); MangaConstructModel[] tmp = MangaModel.ReturnAllMangaNamesByID(aniids); return tmp; }
public static void AddFavManga(int tid, int uid) { AnimeDataContext db = new AnimeDataContext(); FavManga adan = new FavManga { MangaID = tid, UserID = uid }; db.FavMangas.InsertOnSubmit(adan); db.SubmitChanges(); }
public static void AddPublisher(string name, string url) { AnimeDataContext db = new AnimeDataContext(); Publisher adt = new Publisher { PublisherName = name, PublisherPage = url}; db.Publishers.InsertOnSubmit(adt); db.SubmitChanges(); }
public static void AddStudios(string name, string url) { AnimeDataContext db = new AnimeDataContext(); Studio adt = new Studio {StudioName = name, StudioPage = url}; db.Studios.InsertOnSubmit(adt); db.SubmitChanges(); }
// adds new list public static void AddAnimeList(int tid, int uid, int stat, int score, int eps) { AnimeDataContext db = new AnimeDataContext(); AnimeList adan = new AnimeList { TitleID = tid, UserID = uid, StatusID = stat, Score = score, EpsWatched = eps}; db.AnimeLists.InsertOnSubmit(adan); db.SubmitChanges(); }
public static void AddStatus(string name) { AnimeDataContext db = new AnimeDataContext(); UserStatus adt = new UserStatus { StatusName = name}; db.UserStatus.InsertOnSubmit(adt); db.SubmitChanges(); }
public static void AddFavAnime(int tid, int uid) { AnimeDataContext db = new AnimeDataContext(); FavAnime adan = new FavAnime() { TitleID = tid, UserID = uid}; db.FavAnimes.InsertOnSubmit(adan); db.SubmitChanges(); }
// returns all names public static AnimeConstructModel[] ReturnAllFavAnime() { AnimeDataContext db = new AnimeDataContext(); int?[] aniids = (from tp in db.FavAnimes where tp.UserID == UserLogModel.lastid select tp.TitleID).ToArray(); AnimeConstructModel[] tmp = AnimeModel.ReturnAllAnimeNamesByID(aniids); return tmp; }
// adds new aired title public static void AddAired(string name) { AnimeDataContext db = new AnimeDataContext(); AiredYet adt = new AiredYet { AiredName = name }; db.AiredYets.InsertOnSubmit(adt); db.SubmitChanges(); }
public static void AddMangaList(int tid, int uid, int stat, int score, int thomes, int chaps) { AnimeDataContext db = new AnimeDataContext(); MangaList adan = new MangaList { MangaID = tid, UserID = uid, StatusID = stat, Score = score, ThomesRead = thomes, ChaptersRead = chaps}; db.MangaLists.InsertOnSubmit(adan); db.SubmitChanges(); }
// returns a mangalist public static MangaListConstructModel[] ReturnAllMangaList() { AnimeDataContext db = new AnimeDataContext(); int?[] aniids = (from tp in db.MangaLists where tp.UserID == UserLogModel.lastid select tp.MangaID).ToArray(); MangaConstructModel[] tmp2 = MangaModel.ReturnAllMangaNamesByID(aniids); // filling array that will be displayed with data MangaListConstructModel[] tmp = new MangaListConstructModel[tmp2.Count()]; for (int i = 0; i < tmp2.Count(); ++i) { int? score = (from tp in db.MangaLists where tp.MangaID == MangaModel.ReturnMangaID(tmp2[i].title_name) select tp.Score).FirstOrDefault(); int? thomes = (from tp in db.MangaLists where tp.MangaID == MangaModel.ReturnMangaID(tmp2[i].title_name) select tp.ThomesRead).FirstOrDefault(); int? chapters = (from tp in db.MangaLists where tp.MangaID == MangaModel.ReturnMangaID(tmp2[i].title_name) select tp.ChaptersRead).FirstOrDefault(); int? stid = (from tp in db.MangaLists where tp.MangaID == MangaModel.ReturnMangaID(tmp2[i].title_name) select tp.StatusID).FirstOrDefault(); tmp[i] = new MangaListConstructModel(tmp2[i], score, chapters, thomes, StatusModel.ReturnStatusName(stid)); } return tmp; }
// returns all names by genre and.. oh shit =O public static AnimeConstructModel[] ReturnAllAnimeNamesByGenre(int genID, ref Anime[] anit) { AnimeDataContext db = new AnimeDataContext(); AnimeConstructModel[] temp = (from tp in db.Animes join ma in db.Mangas on tp.MangaID equals ma.MangaID join st in db.Studios on tp.StudioID equals st.StudioID join sty in db.SerialTypes on tp.SerialTypeID equals sty.SerialTypeID join gen in db.Genres on tp.GenreID equals gen.GenreID join air in db.AiredYets on tp.AiredID equals air.AiredID where tp.GenreID == genID select new AnimeConstructModel(ma.MangaName, st.StudioName, tp.AniYear, tp.TitleName, sty.SerialName, gen.GenreName, tp.ShortDescription, tp.Episodes, air.AiredName)).ToArray(); anit = (from tp in db.Animes where tp.GenreID == genID select tp).ToArray(); return temp; }
// returns all names by genre public static AnimeConstructModel[] ReturnAllAnimeNamesByGenre(int?[] aid, int genID) { AnimeDataContext db = new AnimeDataContext(); AnimeConstructModel[] temp = new AnimeConstructModel[aid.Count()]; for (int i = 0; i < aid.Count(); ++i) { temp[i] = (from tp in db.Animes join ma in db.Mangas on tp.MangaID equals ma.MangaID join st in db.Studios on tp.StudioID equals st.StudioID join sty in db.SerialTypes on tp.SerialTypeID equals sty.SerialTypeID join gen in db.Genres on tp.GenreID equals gen.GenreID join air in db.AiredYets on tp.AiredID equals air.AiredID where tp.TitleID == aid[i] && tp.GenreID == genID select new AnimeConstructModel(ma.MangaName, st.StudioName, tp.AniYear, tp.TitleName, sty.SerialName, gen.GenreName, tp.ShortDescription, tp.Episodes, air.AiredName)).FirstOrDefault(); } return temp; }
// returns all staff public static StaffConstructModel[] ReturnAllFavStaff() { AnimeDataContext db = new AnimeDataContext(); int?[] aniids = (from tp in db.FavStaffs where tp.UserID == UserLogModel.lastid select tp.StaffID).ToArray(); StaffConstructModel[] tmp = StaffModel.ReturnAllStaffNamesByID(aniids); return tmp; }
public static void AddFavStaff(int tid, int uid) { AnimeDataContext db = new AnimeDataContext(); FavStaff adan = new FavStaff{ StaffID = tid, UserID = uid}; db.FavStaffs.InsertOnSubmit(adan); db.SubmitChanges(); }
public static int ReturnPublisherID(string name) { AnimeDataContext db = new AnimeDataContext(); int temp = (from tp in db.Publishers where tp.PublisherName == name select tp.PublisherID).FirstOrDefault(); return temp; }
public static string ReturnStatusName(int? sid) { AnimeDataContext db = new AnimeDataContext(); string temp = (from tp in db.UserStatus where tp.StatusID == sid select tp.StatusName).FirstOrDefault(); return temp; }
public static int ReturnStatusID(string name) { AnimeDataContext db = new AnimeDataContext(); int temp = (from tp in db.UserStatus where tp.StatusName == name select tp.StatusID).FirstOrDefault(); return temp; }
public static void RemoveStatus(int index) { AnimeDataContext db = new AnimeDataContext(); UserStatus[] temp = (from tp in db.UserStatus select tp).ToArray(); db.UserStatus.DeleteOnSubmit(temp[index]); db.SubmitChanges(); }
public static void RemoveType(int index) { AnimeDataContext db = new AnimeDataContext(); SerialType[] temp = (from tp in db.SerialTypes select tp).ToArray(); db.SerialTypes.DeleteOnSubmit(temp[index]); db.SubmitChanges(); }
public static void RemoveFavStaff(int index) { AnimeDataContext db = new AnimeDataContext(); FavStaff[] temp = (from tp in db.FavStaffs select tp).ToArray(); db.FavStaffs.DeleteOnSubmit(temp[index]); db.SubmitChanges(); }
// search for id by name public static int ReturnAiredID(string name) { AnimeDataContext db = new AnimeDataContext(); int temp = (from tp in db.AiredYets where tp.AiredName == name select tp.AiredID).FirstOrDefault(); return temp; }
public static void RemoveMangaList(int index) { AnimeDataContext db = new AnimeDataContext(); MangaList[] temp = (from tp in db.MangaLists select tp).ToArray(); db.MangaLists.DeleteOnSubmit(temp[index]); db.SubmitChanges(); }
public static int ReturnUserID(string name) { AnimeDataContext db = new AnimeDataContext(); int temp = (from user in db.Users where user.NickName == name select user.UserID).FirstOrDefault(); return temp; }
public static void RemovePublisher(int index) { AnimeDataContext db = new AnimeDataContext(); Publisher[] temp = (from tp in db.Publishers select tp).ToArray(); db.Publishers.DeleteOnSubmit(temp[index]); db.SubmitChanges(); }
public static void AddUserLog(int uid) { AnimeDataContext db = new AnimeDataContext(); UserLog adusr = new UserLog { UserID = uid}; db.UserLogs.InsertOnSubmit(adusr); db.SubmitChanges(); lastid = uid; }
public static int ReturnTypeID(string name) { AnimeDataContext db = new AnimeDataContext(); int temp = (from tp in db.SerialTypes where tp.SerialName == name select tp.SerialTypeID).FirstOrDefault(); return temp; }
public static void RemoveUser(int index) { AnimeDataContext db = new AnimeDataContext(); User[] temp = (from user in db.Users select user).ToArray(); db.Users.DeleteOnSubmit(temp[index]); db.SubmitChanges(); }