コード例 #1
0
        public ActionResult AdminUnScheduleVolunteer(int volunteerID, int eventID)
        {
            ScheduleVolunteerDBEntities x = new ScheduleVolunteerDBEntities();

            x.unSchedule_Volunteer(volunteerID, eventID);

            EventDBEntities _Edb   = new EventDBEntities();
            var             events = _Edb.Events.ToList();

            Models.Event myEvent = (Models.Event)(events.Where(y => y.EventID == eventID).FirstOrDefault());

            VolunteersDBEntities _Vdb = new VolunteersDBEntities();
            var volunteers            = _Vdb.Volunteers.ToList();

            Models.Volunteer myVolunteer = (Models.Volunteer)(volunteers.Where(z => z.ID == volunteerID).FirstOrDefault());

            //notify volunteer of schedule change
            SmtpClient  client          = new SmtpClient();
            MailMessage notifyVolunteer = new MailMessage();

            notifyVolunteer.Subject = "You have been unscheduled from an event at the Challenged Champions Equestrian Center";
            notifyVolunteer.Body    = "This is an automated message informing you that an administrator has unscheduled you from the following event: "
                                      + myEvent.EventTitle + " on " + myEvent.EventDate.ToString("MM-dd-yyyy")
                                      + ". Please check the \"My Schedule\" portion of the volunteer website to review your schedule.";
            notifyVolunteer.To.Add(myVolunteer.Email);

            client.Send(notifyVolunteer);

            return(new EmptyResult());
        }
コード例 #2
0
 public ActionResult ScheduleVolunteer(int id)
 {
     //Check if already signed up
     try
     {
         ScheduleVolunteerDBEntities x = new ScheduleVolunteerDBEntities();
         x.Schedule_Volunteer(Convert.ToInt32(currentUser), id);     //we need to revisit inconsistencies in DB with bigint / int for id column datatypes
         return(new EmptyResult());
     }
     catch (Exception e)
     {
         return(Json(new { status = "error", message = "already signed up for this event" }));
     }
 }
コード例 #3
0
        public ActionResult UnScheduleVolunteer(int id)
        {
            EventDBEntities _db   = new EventDBEntities();
            var             Model = _db.Events.Where(e => e.EventID == id).FirstOrDefault();
            Volunteer       v     = Model.Volunteers.FirstOrDefault();

            //Set admin email here
            SendEmail("*****@*****.**", Model.EventTitle + " Decommitted", v.FirstName.Trim() + " " + v.LastName.Trim() + " has decommitted from the " + Model.EventTitle + "event | The event is scheduled for" + Model.EventDate.ToLongDateString());

            ScheduleVolunteerDBEntities x = new ScheduleVolunteerDBEntities();

            x.unSchedule_Volunteer(Convert.ToInt32(currentUser), id);     //we need to revisit inconsistencies in DB with bigint / int for id column datatypes
            return(new EmptyResult());
        }