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");
            }
        }
Beispiel #2
0
 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;
     }
 }
Beispiel #3
0
        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);
            }
        }
Beispiel #4
0
        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;
            }
        }
Beispiel #5
0
 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 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 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 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");
            }
        }
Beispiel #9
0
        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 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);

                    context.SP_USER_PROFILE_REFEREE_UPDATE(refProfile.ref_Game_Specialization_Type,
                        refProfile.userProfile_ID,
                        refProfile.Sport_Name_spt_Sport_Name_ID);
                    context.SaveChanges();

                }
                else
                {
                    //Inserting Profile
                    userProfile.UserProfileInsert(context, refProfile);

                    context.SP_USER_PROFILE_REFEREE_INSERT(refProfile.ref_Game_Specialization_Type,
                        refProfile.userProfile_ID,
                        refProfile.Sport_Name_spt_Sport_Name_ID);
                    context.SaveChanges();
                }

                return RedirectToAction("Profile");
            }
        }