public void RemoveCollection(int CollectionID) { CollectionModel collectionToRemove = GetCollectionById(CollectionID); LinqAdapter.GetTable <CollectionModel>().DeleteOnSubmit(collectionToRemove); LinqAdapter.SubmitChanges(); }
public void RemoveRequest(int RequestID) { RequestModel requestToRemove = GetRequestById(RequestID); LinqAdapter.GetTable <RequestModel>().DeleteOnSubmit(requestToRemove); LinqAdapter.SubmitChanges(); }
public int AddComment(int UserID, Nullable <int> DocumentID, Nullable <int> CollectionID, String CommentContent) { CommentModel commentToInsert = new CommentModel(); commentToInsert.UserID = UserID; if (DocumentID == 0) { commentToInsert.DocumentID = null; } else { commentToInsert.DocumentID = DocumentID; } if (CollectionID == 0) { commentToInsert.CollectionID = null; } else { commentToInsert.CollectionID = CollectionID; } commentToInsert.CommentContent = CommentContent; LinqAdapter.GetTable <CommentModel>().InsertOnSubmit(commentToInsert); LinqAdapter.SubmitChanges(); return(commentToInsert.CommentID); }
public void RemoveCategory(int CategoryID) { CategoryModel categoryToRemove = GetCategoryById(CategoryID); LinqAdapter.GetTable <CategoryModel>().DeleteOnSubmit(categoryToRemove); LinqAdapter.SubmitChanges(); }
public void AddTag(String TagName, Nullable <int> DocumentID, Nullable <int> CollectionID) { ConvertLetter cv = new ConvertLetter(); String Alias = cv.ClearAccent(TagName); TagsModel tagToInsert = new TagsModel(); if (DocumentID == 0) { tagToInsert.DocumentID = null; } else { tagToInsert.DocumentID = DocumentID; } if (CollectionID == 0) { tagToInsert.CollectionID = null; } else { tagToInsert.CollectionID = CollectionID; } tagToInsert.TagName = TagName; tagToInsert.Alias = Alias; LinqAdapter.GetTable <TagsModel>().InsertOnSubmit(tagToInsert); LinqAdapter.SubmitChanges(); }
public void RemoveTag(int TagID) { TagsModel tagToRemove = GetTagById(TagID); LinqAdapter.GetTable <TagsModel>().DeleteOnSubmit(tagToRemove); LinqAdapter.SubmitChanges(); }
public int AddDocument(String Name, String Description, String Thumbnails, String Link, int FileSize, int UserID, int CategoryID, Nullable <int> CollectionID) { ConvertLetter cvLetter = new ConvertLetter(); String Alias = cvLetter.ClearAccent(Name).ToTitleCase().Replace(" ", ""); DocumentModel documentToInsert = new DocumentModel(); documentToInsert.UserID = UserID; if (CollectionID == 0) { documentToInsert.CollectionID = null; } else { documentToInsert.CollectionID = CollectionID; } documentToInsert.CategoryID = CategoryID; documentToInsert.Name = Name; documentToInsert.Alias = Alias; documentToInsert.Description = Description; documentToInsert.Thumbnails = Thumbnails; documentToInsert.TotalView = 0; documentToInsert.TotalDownload = 0; documentToInsert.UploadDate = DateTime.Now; documentToInsert.Link = Link; documentToInsert.FileSize = FileSize; documentToInsert.IsError = false; documentToInsert.ErrorReportCount = 0; LinqAdapter.GetTable <DocumentModel>().InsertOnSubmit(documentToInsert); LinqAdapter.SubmitChanges(); return(documentToInsert.DocumentID); }
public double DocumentAverageRate(int DocumentID) { IEnumerable <DocumentRatingModel> documentRate = LinqAdapter.GetTable <DocumentRatingModel>().Where(r => r.DocumentID == DocumentID).ToList(); dynamic documentVotes = documentRate.Select(r => new { r.Rate, Votes = 1 }).GroupBy(r => r.Rate).Count(); return(0.0); }
public void RemoveDocument(int DocumentID) { DocumentModel documentToRemove = GetDocumentById(DocumentID); LinqAdapter.GetTable <DocumentModel>().DeleteOnSubmit(documentToRemove); LinqAdapter.SubmitChanges(); }
public void RemoveGroup(int GroupID) { GroupModel groupToRemove = GetGroupById(GroupID); LinqAdapter.GetTable <GroupModel>().DeleteOnSubmit(groupToRemove); LinqAdapter.SubmitChanges(); }
public void RemoveFeedback(int FeedbackID) { FeedbackModel feedbackToRemove = GetFeedbackById(FeedbackID); LinqAdapter.GetTable <FeedbackModel>().DeleteOnSubmit(feedbackToRemove); LinqAdapter.SubmitChanges(); }
public void RemoveUser(int UserID) { UsersModel userToRemove = GetUserById(UserID); LinqAdapter.GetTable <UsersModel>().DeleteOnSubmit(userToRemove); LinqAdapter.SubmitChanges(); }
public void UpdateRate(int DocumentID, int UserID, int Rate) { DocumentRatingModel documentRatingToUpdate = LinqAdapter.GetTable <DocumentRatingModel>().Single(r => r.DocumentID == DocumentID && r.UserID == UserID); documentRatingToUpdate.Rate = Rate; LinqAdapter.SubmitChanges(); }
public void AddRequest(String Content, int UserID) { RequestModel requestToInsert = new RequestModel(); requestToInsert.RequestContent = Content; requestToInsert.UserID = UserID; requestToInsert.RequestDate = DateTime.Now; LinqAdapter.GetTable <RequestModel>().InsertOnSubmit(requestToInsert); LinqAdapter.SubmitChanges(); }
public void AddFeedback(String Sender, String Email, String Content) { FeedbackModel feedbackToIsert = new FeedbackModel(); feedbackToIsert.Sender = Sender; feedbackToIsert.Email = Email; feedbackToIsert.FeedbackContent = Content; feedbackToIsert.FeedbackDate = DateTime.Now; LinqAdapter.GetTable <FeedbackModel>().InsertOnSubmit(feedbackToIsert); LinqAdapter.SubmitChanges(); }
public int AddRate(int DocumentID, int UserID, int Rate) { DocumentRatingModel documentRatingToInsert = new DocumentRatingModel(); documentRatingToInsert.DocumentID = DocumentID; documentRatingToInsert.UserID = UserID; documentRatingToInsert.Rate = Rate; LinqAdapter.GetTable <DocumentRatingModel>().InsertOnSubmit(documentRatingToInsert); LinqAdapter.SubmitChanges(); return(documentRatingToInsert.RateID); }
public void AddCategory(String Name) { ConvertLetter cvLetter = new ConvertLetter(); String Alias = cvLetter.ClearAccent(Name).ToTitleCase().Replace(" ", ""); CategoryModel categoryToInsert = new CategoryModel(); categoryToInsert.Name = Name; categoryToInsert.Alias = Alias; LinqAdapter.GetTable <CategoryModel>().InsertOnSubmit(categoryToInsert); LinqAdapter.SubmitChanges(); }
public void AddGroup(String Name, String Description, bool IsLimt, int DownloadLimit) { GroupModel groupToInsert = new GroupModel(); groupToInsert.Name = Name; groupToInsert.Description = Description; groupToInsert.IsAdmin = false; groupToInsert.IsDefault = false; groupToInsert.IsLimit = IsLimit; groupToInsert.DownloadLimit = DownloadLimit; LinqAdapter.GetTable <GroupModel>().InsertOnSubmit(groupToInsert); LinqAdapter.SubmitChanges(); }
public IEnumerable <DocumentModel> SearchDocumentByCollectionName(String CollectionName) { IEnumerable <CollectionModel> collection = LinqAdapter.GetTable <CollectionModel>(); IEnumerable <DocumentModel> doc = LinqAdapter.GetTable <DocumentModel>(); IEnumerable <DocumentModel> result = from c in collection join d in doc on c.CollectionID equals d.UserID //where SqlMethods.Like(c.Name, "%" + CollectionName + "%") where c.Name.Like("*" + CollectionName + "*") select d; return(result.ToList()); }
public IEnumerable <DocumentModel> SearchDocumentByUsername(String Username) { IEnumerable <UsersModel> user = LinqAdapter.GetTable <UsersModel>(); IEnumerable <DocumentModel> doc = LinqAdapter.GetTable <DocumentModel>(); IEnumerable <DocumentModel> result = from u in user join d in doc on u.UserID equals d.UserID //where SqlMethods.Like(u.Username, "%" + Username + "%") where u.Username.Like("*" + Username + "*") select d; return(result.ToList()); }
public void AddUser(String Username, String Password, String Email, int GroupID) { UsersModel userToInsert = new UsersModel(); userToInsert.Username = Username; userToInsert.Password = Password; userToInsert.Email = Email; userToInsert.Point = 0; userToInsert.TotalUpload = 0; userToInsert.GroupID = GroupID; LinqAdapter.GetTable <UsersModel>().InsertOnSubmit(userToInsert); LinqAdapter.SubmitChanges(); }
public int AddCollection(String Name, String Description, int UserID) { ConvertLetter cvLetter = new ConvertLetter(); String Alias = cvLetter.ClearAccent(Name).ToTitleCase().Replace(" ", "_"); CollectionModel collectionToInsert = new CollectionModel(); collectionToInsert.UserID = UserID; collectionToInsert.Name = Name; collectionToInsert.Alias = Alias; collectionToInsert.Description = Description; collectionToInsert.TotalView = 0; collectionToInsert.CreatedDate = DateTime.Now; collectionToInsert.IsError = false; LinqAdapter.GetTable <CollectionModel>().InsertOnSubmit(collectionToInsert); LinqAdapter.SubmitChanges(); return(collectionToInsert.CollectionID); }
public PreferencesModel GetPreferencesByName(String Name) { return(LinqAdapter.GetTable <PreferencesModel>().SingleOrDefault(p => p.Name == Name)); }
public PreferencesModel GetPreferencesById(int PreferencesID) { return(LinqAdapter.GetTable <PreferencesModel>().SingleOrDefault(p => p.PreferencesID == PreferencesID)); }
public IEnumerable <DocumentModel> GetDocumentList() { return(LinqAdapter.GetTable <DocumentModel>().ToList()); }
public IEnumerable <DocumentModel> SearchDocumentByName(String Name) { return(LinqAdapter.GetTable <DocumentModel>().Where(d => SqlMethods.Like(d.Name, "%" + Name + "%")).ToList()); }
public IEnumerable <DocumentModel> GetDocumentByCategoryID(int CategoryID) { return(LinqAdapter.GetTable <DocumentModel>().Where(d => d.CategoryID == CategoryID).ToList()); }
public IEnumerable <DocumentModel> GetDocumentHasError() { return(LinqAdapter.GetTable <DocumentModel>().Where(d => d.IsError == true)); }
public IEnumerable <DocumentModel> GetDocumentByUserId(int UserID) { return(LinqAdapter.GetTable <DocumentModel>().Where(d => d.UserID == UserID)); }
public DocumentModel GetDocumentById(int DocumentID) { return(LinqAdapter.GetTable <DocumentModel>().SingleOrDefault(d => d.DocumentID == DocumentID)); }