private void ReviewSubmit_Click(object sender, EventArgs e) { var userId = GetUserId(currentUser); if (SqlDriver.Exists($"SELECT * FROM universityReviews WHERE userId = {userId} AND universityId = {selectedUniversity} LIMIT 1")) { MessageBox.Show(Messages.reviewAlreadySubmitted); return; } tabsController.SelectTab(universityReview); }
public bool IsDuplicate() { if (SqlDriver.Exists($"SELECT * FROM universityReviews WHERE userId ={UserId} AND universityId={UniversityId}")) { DuplicateReviewEventArgs args = new DuplicateReviewEventArgs(); args.Message = Messages.reviewAlreadySubmitted; args.Id = UniversityId; DuplicateReview?.Invoke(this, args); return(true); } return(false); }
private void ProgrammesGrid_CellClick(object sender, DataGridViewCellEventArgs e) { var dgv = sender as DataGridView; if (dgv == null) { return; } int selectedId = (int)dgv.CurrentRow.Cells["Id"].Value; selectedCourse = selectedId; string userId = GetUserId(currentUser); if (SqlDriver.Exists($"SELECT * FROM coursereviews WHERE userId = {userId} AND courseId = {selectedCourse} LIMIT 1")) { MessageBox.Show(Messages.reviewAlreadySubmitted); return; } tabsController.SelectTab(courseReview); }
public bool IsDuplicate() { return(SqlDriver.Exists($"SELECT * FROM courseReviews WHERE userId ={UserId} AND courseId={StudyProgramId}")); }