public bool UserProfileInsert(StripeEntities context, User_Profile refProfile) { try { context.SP_USER_PROFILE_INSERT(refProfile.userProfile_ID, refProfile.userProfile_First_Name, refProfile.userProfile_Last_Name, refProfile.userProfile_Email, refProfile.userProfile_Phone, refProfile.userProfile_Street, refProfile.userProfile_City, refProfile.userProfile_State, refProfile.userProfile_Zip, refProfile.userProfile_Photo, refProfile.userProfile_Background_Description, refProfile.userProfile_ID); context.SaveChanges(); return true; } catch (Exception exception) { return false; } }
public ActionResult Login(Login login) { using (var context = new StripeEntities()) { var loginCheck = context.SP_LOGIN(login.login_username, login.login_password).SingleOrDefault(); if (loginCheck == null) { ModelState.AddModelError("", "Log in credentials invalid"); return View(login); } else { FormsAuthentication.SetAuthCookie(loginCheck.login_username, false); Session["loginid"] = loginCheck.login_ID; switch (loginCheck.User_Type_userType_ID) { case "R": return RedirectToAction("Home", "Referee"); break; case "S": return RedirectToAction("Home", "Director"); break; case "A": return RedirectToAction("Home", "Admin", new { id = loginCheck.login_ID }); break; default: return RedirectToAction("Index", "Home"); break; } } } }
public bool InsertUpdateSchoolRecords(bool insertUpdate, StripeEntities context, SP_SCHOOL_DETAILS_FROM_DIRECTOR_Result schoolDetails) { try { if (insertUpdate) { context.SP_SCHOOL_DETAILS_INSERT(schoolDetails.sch_Name, schoolDetails.sch_Street, schoolDetails.sch_City, schoolDetails.sch_State, schoolDetails.sch_Zip, schoolDetails.sch_Logo, schoolDetails.User_Profile_Director_Profile_ID); } else { //update queries context.SP_SCHOOL_DETAILS_UPDATE(schoolDetails.sch_Name, schoolDetails.sch_Street, schoolDetails.sch_City, schoolDetails.sch_State, schoolDetails.sch_Zip, schoolDetails.sch_Logo, schoolDetails.User_Profile_Director_Profile_ID); } context.SaveChanges(); return true; } catch (Exception exception) { Console.Write(exception.Message); return false; } }
public ActionResult CreateEvent(Sport_Event sportEventDetails) { if (ModelState.IsValid) { using (var context = new StripeEntities()) { int id = Convert.ToInt32(Session["loginid"]); SchoolClass schoolRecord = new SchoolClass(context); sportEventDetails.School_Home_sch_ID = schoolRecord.getSchoolDetailsFromDirector(id).sch_ID; if (sportEventDetails.School_Away_sch_ID == sportEventDetails.School_Home_sch_ID) { ModelState.AddModelError("", "Cannot select same away and home team"); return View(); } else { sportEventDetails.event_Completion = "N"; context.Sport_Event.Add(sportEventDetails); context.SaveChanges(); return RedirectToAction("Home"); } } } else { return View("Error"); } }
public bool InsertUpdateSchoolRecords(bool insertUpdate, StripeEntities context, SP_SCHOOL_DETAILS_FROM_DIRECTOR_Result schoolDetails) { try { if (insertUpdate) { context.SP_SCHOOL_DETAILS_INSERT(schoolDetails.sch_Name, schoolDetails.sch_Street, schoolDetails.sch_City, schoolDetails.sch_State, schoolDetails.sch_Zip, schoolDetails.sch_Logo, schoolDetails.User_Profile_Director_Profile_ID); } else { //update queries context.SP_SCHOOL_DETAILS_UPDATE(schoolDetails.sch_Name, schoolDetails.sch_Street, schoolDetails.sch_City, schoolDetails.sch_State, schoolDetails.sch_Zip, schoolDetails.sch_Logo, schoolDetails.User_Profile_Director_Profile_ID); } context.SaveChanges(); return(true); } catch (Exception exception) { Console.Write(exception.Message); return(false); } }
public bool UserProfileInsert(StripeEntities context, User_Profile refProfile) { try { context.SP_USER_PROFILE_INSERT(refProfile.userProfile_ID, refProfile.userProfile_First_Name, refProfile.userProfile_Last_Name, refProfile.userProfile_Email, refProfile.userProfile_Phone, refProfile.userProfile_Street, refProfile.userProfile_City, refProfile.userProfile_State, refProfile.userProfile_Zip, refProfile.userProfile_Photo, refProfile.userProfile_Background_Description, refProfile.userProfile_ID); context.SaveChanges(); return(true); } catch (Exception exception) { return(false); } }
public ActionResult List() { using (var context = new StripeEntities()) { var eventList = context.Sport_Event.ToList(); return View(eventList); } }
public bool UserProfileExistence(int id, StripeEntities context) { var profile = context.User_Profile.Where(loginid => loginid.userProfile_ID == id).SingleOrDefault(); if (profile == null) return false; else return true; }
public ActionResult UpdateStatus(int refereeId, int eventId, string status) { using (var context = new StripeEntities()) { context.SP_UPDATE_REFEREE_STATUS_BY_EVENTID(eventId, refereeId, status); context.SaveChanges(); return RedirectToAction("ViewApplications", "Director", new { eventid = eventId }); } }
public PartialViewResult GetRefList(int GameCode) { using (var context = new StripeEntities()) { GetGameList getRefList = new GetGameList(context); ViewBag.RefList = getRefList.getRefTypeList(GameCode); return PartialView("_RefList"); } }
public ActionResult Index() { using (var context = new StripeEntities()) { Session["loginid"] = null; ViewBag.UserTypeList = getUserTypeList(context); } return View(); }
public static List<SelectListItem> getSchoolList(StripeEntities context) { List<SelectListItem> RefList = new List<SelectListItem>(); var schoolList = context.Schools.ToList(); foreach (var schoolDetails in schoolList) { RefList.Add(new SelectListItem() { Text = schoolDetails.sch_Name, Value = schoolDetails.sch_ID.ToString() }); } return RefList; }
public List<SelectListItem> getUserTypeList(StripeEntities context) { List<SelectListItem> userTypeList = new List<SelectListItem>(); userTypeList.Add(new SelectListItem() { Text = "Please select User Type", Value = "default" }); var result = context.User_Type.ToList(); foreach (var item in result) { userTypeList.Add(new SelectListItem() { Text = item.userType_Name, Value = item.userType_ID }); } return userTypeList; }
public ActionResult MoreDetails(int eventId) { using (var context = new StripeEntities()) { Event getEventDetails = new Event(context); var eventDetails = getEventDetails.GetEventByEventId(eventId) .SingleOrDefault(); return View(eventDetails); } }
public ActionResult CreateEvent() { using (var context = new StripeEntities()) { ViewBag.SchoolList = SchoolClass.getSchoolList(context); GetGameList getGameList = new GetGameList(context); ViewBag.GameList = getGameList.getGameTypeList(); } return View(); }
public bool UserProfileExistence(int id, StripeEntities context) { var profile = context.User_Profile.Where(loginid => loginid.userProfile_ID == id).SingleOrDefault(); if (profile == null) { return(false); } else { return(true); } }
public ActionResult EditEvent(Sport_Event sportDetails) { using (var context = new StripeEntities()) { context.SP_EVENT_DETAILS_UPDATE(sportDetails.event_Date, sportDetails.event_Time, sportDetails.event_School_Field_Name, sportDetails.Sport_Name_spt_Sport_Name_ID, sportDetails.event_ID); context.SaveChanges(); return RedirectToAction("ViewEvents", "Director"); } }
public static List <SelectListItem> getSchoolList(StripeEntities context) { List <SelectListItem> RefList = new List <SelectListItem>(); var schoolList = context.Schools.ToList(); foreach (var schoolDetails in schoolList) { RefList.Add(new SelectListItem() { Text = schoolDetails.sch_Name, Value = schoolDetails.sch_ID.ToString() }); } return(RefList); }
public ActionResult AllEvents() { using (var context = new StripeEntities()) { UserProfile userProfile = new UserProfile(); int id = Convert.ToInt32(Session["loginid"]); var refereeProfile = userProfile.getUserProfile(id, context); Event allEvents = new Event(context); var allEventsList = allEvents.GetAllEvents("N") .Where(sptId => sptId.Sport_Name_spt_Sport_Name_ID == refereeProfile.Sport_Name_spt_Sport_Name_ID) .ToList(); return View(allEventsList); } }
public ActionResult EditEvent(int eventId) { using (var context = new StripeEntities()) { Event getEventDetails = new Event(context); var eventDetails = getEventDetails.GetEventByEventId(eventId) .SingleOrDefault(); ViewBag.SchoolList = SchoolClass.getSchoolList(context); GetGameList getGameList = new GetGameList(context); ViewBag.GameList = getGameList.getGameTypeList(); return View(eventDetails); } }
public ActionResult UpdateScores(SP_GET_EVENT_BY_EVENTID_Result eventScores) { using (var context = new StripeEntities()) { Event updateEventScores = new Event(context); if (updateEventScores.UpdateEventScores(eventScores)) { return RedirectToAction("ViewEvents", "Director"); } else { return View("Error"); } } }
public ActionResult Apply(FormCollection formCollection) { using (var context = new StripeEntities()) { int eventId = Convert.ToInt32(formCollection["event_ID"]); int refereeType = Convert.ToInt32(formCollection["ref_Game_Specialization_Type"]); int homeSchoolId = Convert.ToInt32(formCollection["School_Home_sch_ID"]); int refereeId = Convert.ToInt32(Session["loginid"]); SchoolClass schoolRecord = new SchoolClass(context); var schoolDetails = schoolRecord.GetDirectorIdFromSchoolId(homeSchoolId); context.SP_EVENT_REFEREE_APPLY(eventId, refereeId, schoolDetails.User_Profile_Director_Profile_ID, "P", refereeType); context.SaveChanges(); return RedirectToAction("AllEvents"); } }
public ActionResult Profile() { using (var context = new StripeEntities()) { try { int id = Convert.ToInt32(Session["loginid"]); var refereeProfile = context.User_Profile.Where(userid => userid.userProfile_ID == id).SingleOrDefault(); return View(refereeProfile); } catch (Exception exception) { Console.Write(exception.Message); ViewBag.ErrorMessage = "There is something wrong with the account. Please contact admin"; return View("Error"); } } }
public ActionResult Apply(int eventId) { using (var context = new StripeEntities()) { int refereeId = Convert.ToInt32(Session["loginid"]); EventReferee eventReferee = new EventReferee(context); if (eventReferee.CheckRefereeEligibilityForApplication(eventId, refereeId)) { Event allEvents = new Event(context); var eventDetails = allEvents.GetEventByEventId(eventId).SingleOrDefault(); GetGameList getRefList = new GetGameList(context); ViewBag.RefereeList = getRefList.getRefTypeList(eventDetails.Sport_Name_spt_Sport_Name_ID); return View(eventDetails); } else { ViewBag.ErrorMessage = "You've already applied for this event. Please wait for any further notification."; return View("Error"); } } }
public ActionResult SchoolDetails() { using (var context = new StripeEntities()) { int id = Convert.ToInt32(Session["loginid"]); SchoolClass schoolClass = new SchoolClass(context); var schoolDetails = schoolClass.getSchoolDetailsFromDirector(id); return View("SchoolDetails", schoolDetails); } }
public Event(StripeEntities context) { this.context = context; }
public GetGameList(StripeEntities context) { this.context = context; }
public ActionResult SignUp(Login login) { using (var context = new StripeEntities()) { EncryptDecrypt encrypt = new EncryptDecrypt(); login.login_random_string = encrypt.Encrypt(login.login_username, "r0b1nr0y"); context.Logins.Add(login); context.SaveChanges(); return View("SignUpConfirmation"); } }
public SP_USER_PROFILE_GET_Result getUserProfile(int id, StripeEntities context) { return context.SP_USER_PROFILE_GET(id).SingleOrDefault(); }
public SchoolClass(StripeEntities context) { this.context = context; }
public SP_USER_PROFILE_GET_Result getUserProfile(int id, StripeEntities context) { return(context.SP_USER_PROFILE_GET(id).SingleOrDefault()); }
public EventReferee(StripeEntities context) { this.context = context; }
public ActionResult SchoolDetails(SP_SCHOOL_DETAILS_FROM_DIRECTOR_Result schoolDetails) { using (var context = new StripeEntities()) { SchoolClass schoolClass = new SchoolClass(context); var schoolRecord = schoolClass.getSchoolDetailsFromDirector(schoolDetails.User_Profile_Director_Profile_ID); if (schoolRecord == null) { schoolClass.InsertUpdateSchoolRecords(true, context, schoolDetails); } else { schoolClass.InsertUpdateSchoolRecords(false, context, schoolDetails); } return RedirectToAction("SchoolDetails"); } }
public ActionResult ViewEvents() { using (var context = new StripeEntities()) { int id = Convert.ToInt32(Session["loginid"]); SchoolClass schoolRecord = new SchoolClass(context); var schoolDetails = schoolRecord.getSchoolDetailsFromDirector(id); var eventList = context.SP_GET_EVENT_BY_SCHOOLID(schoolDetails.sch_ID).ToList(); return View(eventList); } }
public ActionResult ViewApplications(int eventId) { using (var context = new StripeEntities()) { var eventDetails = context.SP_GET_APPLICATION_STATUS_BY_EVENTID(eventId).ToList(); return View(eventDetails); } }
public ActionResult Profile(User_Profile refProfile) { using (var context = new StripeEntities()) { UserProfileExistCheck profileCheck = new UserProfileExistCheck(); UserProfile userProfile = new UserProfile(); if (profileCheck.UserProfileExistence(refProfile.userProfile_ID, context)) { userProfile.UserProfileUpdate(context, refProfile); } else { //Inserting Profile userProfile.UserProfileInsert(context, refProfile); } return RedirectToAction("Profile"); } }