public async Task<ActionResult> Retreaters()
		{
			var name = HttpContext.User.Identity.Name;
			var User = await db.Users.FirstOrDefaultAsync( c => c.UserName == name );
			var userView = new UserInput( User );

			var carriers = await db.Carriers.OrderBy( c => c.Title ).ToListAsync<Carrier>();
			var carriersView = new Collection<CarrierView>();
			foreach ( var carrier in carriers )
			{
				carriersView.Add( new CarrierView( carrier ) );
			}
			var tshirtsizes = await db.TShirtSizes.OrderBy( c => c.Number ).ToListAsync<TShirtSize>();
			var tshirtsizesView = new Collection<TShirtSizeView>();
			foreach ( var size in tshirtsizes )
			{
				tshirtsizesView.Add( new TShirtSizeView( size ) );
			}
			var grades = await db.Grades.OrderBy( c => c.Number ).ToListAsync<Grade>();
			var gradesView = new Collection<GradeView>();
			foreach ( var grade in grades )
			{
				gradesView.Add( new GradeView( grade ) );
			}
			var retreatersPending = await db.Users.CountAsync( c => c.RetreaterPending == true);
			var retreaters = await db.Users.CountAsync( c => c.Retreater == true);



			ViewBag.Grades = new SelectList(gradesView, "RID", "Title");
			ViewBag.Sizes =  new SelectList(tshirtsizesView, "RID", "Size");
			ViewBag.Carriers = new SelectList( carriersView, "RID", "Title" );
			ViewBag.RetreatersCount = retreatersPending + retreaters;
			return View( "Retreaters", userView );
		}
示例#2
0
		public async Task RetreaterAppSubmit(UserInput model)
		{
			var User = await this.User();

			if ( User.Retreater)
			{
				Clients.Caller.errorBack("You are already attending this retreat.");
			}
			else if(User.Staffer )
			{
				Clients.Caller.errorBack("You are already staffing this retreat.");
			}
			else if(User.RetreaterPending)
			{
				Clients.Caller.errorBack("You have already submitted your retreat application.");
			}
			else if(User.StafferPending)
			{
				Clients.Caller.errorBack("You have already submitted your staffer application.");
			}
			else
			{
				User.RetreaterPending = true;

				User.Personal.FirstName = model.Personal.FirstName;
				User.Personal.LastName = model.Personal.LastName;
				User.Personal.Email = model.Personal.Email;
				User.Personal.Phone = new Models.Phone();
				User.Personal.Phone.Number = model.Personal.Phone.Number;
				User.Personal.Phone.Carrier = await db.Carriers.FindAsync(model.Personal.Phone.Carrier);
				User.Personal.Hobbies = model.Personal.Hobbies;
				User.Personal.TShirtSize = await db.TShirtSizes.FindAsync( model.Personal.TShirtSize );

				User.Religion.FavoriteBibleVerse = model.Religion.FavoriteBibleVerse;
				User.Religion.FavoriteSaint = model.Religion.FavoriteSaint;
				User.Religion.Reason = model.Religion.Reason;
				User.Religion.RoleModel = model.Religion.RoleModel;
				User.Religion.PrayerRequest = model.Religion.PrayerRequest;

				User.School.College = model.School.College;
				User.School.Grade = await db.Grades.FindAsync( model.School.Grade );

				User.Medical.Allergies = model.Medical.Allergies;
				User.Medical.HealthConditions = model.Medical.HealthConditions;

				User.Emergency.FirstName = model.Emergency.FirstName;
				User.Emergency.LastName = model.Emergency.LastName;
				User.Emergency.Email = model.Emergency.Email;
				User.Emergency.Phone = new Models.Phone();
				User.Emergency.Phone.Number = model.Emergency.Phone.Number;
				User.Emergency.Phone.Carrier = await db.Carriers.FindAsync( model.Emergency.Phone.Carrier );

				User.Transportation.TransportSelf = model.Transportation.TransportSelf;

				await db.SaveChangesAsync();
				var userView = new UserView(User);
				Clients.Caller.submitRetreatBack( userView );
			}
		}
		public async Task<ViewResult> Index()
        {
			var name = HttpContext.User.Identity.Name;
			var User = await db.Users.FirstOrDefaultAsync( c => c.UserName == name );
			if(User!=null)
			{
				var userView = new UserInput( User );
				return View( userView );
			}
			return View();
        }
		public async Task<ActionResult> Profile(String Id)
		{

			var name = HttpContext.User.Identity.Name;
			var User = await db.Users.FirstOrDefaultAsync( c => c.UserName == name );
			var child = await db.Users.FirstOrDefaultAsync(c => c.Id == Id);

			if(User.Family.Equals(child.Family))
			{
				var childView = new UserInput( child );

				return View( childView );
			}
			else
			{
				return HttpNotFound();
			}
		}
		public async Task<ActionResult> StaffersDelete( String userID )
		{
			var User = await this.db.Users.FirstOrDefaultAsync( c => c.Id == userID );
			if ( User != null )
			{
				User.StafferPending = false;
				User.Staffer = false;
				await db.SaveChangesAsync();
				var userView = new UserInput( User );

				var carriers = await db.Carriers.OrderBy( c => c.Title ).ToListAsync<Carrier>();
				var carriersView = new Collection<CarrierView>();
				foreach ( var carrier in carriers )
				{
					carriersView.Add( new CarrierView( carrier ) );
				}
				var tshirtsizes = await db.TShirtSizes.OrderBy( c => c.Number ).ToListAsync<TShirtSize>();
				var tshirtsizesView = new Collection<TShirtSizeView>();
				foreach ( var size in tshirtsizes )
				{
					tshirtsizesView.Add( new TShirtSizeView( size ) );
				}
				var grades = await db.Grades.OrderBy( c => c.Number ).ToListAsync<Grade>();
				var gradesView = new Collection<GradeView>();
				foreach ( var grade in grades )
				{
					gradesView.Add( new GradeView( grade ) );
				}
				var choices = await db.StaffChoices.OrderBy( c => c.Title ).ToListAsync<StaffChoice>();
				var choicesView = new Collection<StaffChoiceView>();
				foreach ( var choice in choices )
				{
					choicesView.Add( new StaffChoiceView( choice ) );
				}


				ViewBag.Choices = new SelectList( choicesView, "RID", "Title" );
				ViewBag.Grades = new SelectList( gradesView, "RID", "Title" );
				ViewBag.Sizes =  new SelectList( tshirtsizesView, "RID", "Size" );
				ViewBag.Carriers = new SelectList( carriersView, "RID", "Title" );

				this.Mail.From = this.From;
				this.Mail.Subject = "ChattAwakening Staffer Application Deletion";
				this.Mail.Body = User.Personal.FirstName + ", <br /><br />We are emailing you to confirm that we have deleted your application.  We are sorry that you can no longer attend ChattAwakening. If you would like to re-apply, please go to <a href=\"http://utccatholic.org/Awakening/Staffers\">http://utccatholic.org/Awakening/Staffers</a>. We have saved your information there for convenience. <br /> If you have any questions, comments, and/or concerns, please email us back!<br /> <br /> Thank you, <br />ChattAwakening - UTC Catholic";
				this.Mail.IsBodyHtml = true;
				this.Mail.To.Add( User.Personal.Email );
				this.Mail.Bcc.Add(  "[email protected], [email protected], [email protected]" );
				client.Credentials = Credentials;
				client.Send( this.Mail );

				return View( "Staffers", userView );
			}
			else
			{
				return HttpNotFound();
			}
		}
		public async Task<ActionResult> StaffersEdit( UserInput model )
		{
			var carriers = await db.Carriers.OrderBy( c => c.Title ).ToListAsync<Carrier>();
			var carriersView = new Collection<CarrierView>();
			foreach ( var carrier in carriers )
			{
				carriersView.Add( new CarrierView( carrier ) );
			}
			var tshirtsizes = await db.TShirtSizes.OrderBy( c => c.Number ).ToListAsync<TShirtSize>();
			var tshirtsizesView = new Collection<TShirtSizeView>();
			foreach ( var size in tshirtsizes )
			{
				tshirtsizesView.Add( new TShirtSizeView( size ) );
			}
			var grades = await db.Grades.OrderBy( c => c.Number ).ToListAsync<Grade>();
			var gradesView = new Collection<GradeView>();
			foreach ( var grade in grades )
			{
				gradesView.Add( new GradeView( grade ) );
			}
			var choices = await db.StaffChoices.OrderBy( c => c.Title ).ToListAsync<StaffChoice>();
			var choicesView = new Collection<StaffChoiceView>();
			foreach ( var choice in choices )
			{
				choicesView.Add( new StaffChoiceView( choice ) );
			}


			ViewBag.Choices = new SelectList( choicesView, "RID", "Title" );
			ViewBag.Grades = new SelectList( gradesView, "RID", "Title" );
			ViewBag.Sizes =  new SelectList( tshirtsizesView, "RID", "Size" );
			ViewBag.Carriers = new SelectList( carriersView, "RID", "Title" );



			if ( ModelState.IsValid )
			{
				var name = HttpContext.User.Identity.Name;
				var User = await db.Users.FirstOrDefaultAsync( c => c.UserName == name );
				if ( User != null )
				{
					if ( User.Retreater )
					{
						return HttpNotFound();
					}
					else if ( User.RetreaterPending )
					{
						return HttpNotFound();
					}
					User.StafferPending = true;

					User.Personal.FirstName = model.Personal.FirstName;
					User.Personal.LastName = model.Personal.LastName;
					User.Personal.Email = model.Personal.Email;
					User.Personal.Phone = new Models.Phone();
					User.Personal.Phone.Number = model.Personal.Phone.Number;
					User.Personal.Phone.Carrier = await db.Carriers.FindAsync( model.Personal.Phone.Carrier );
					User.Personal.Hobbies = model.Personal.Hobbies;
					User.Personal.TShirtSize = await db.TShirtSizes.FindAsync( model.Personal.TShirtSize );

					User.Staff.PreviousAttended = model.Staff.PreviousAttended;
					User.Staff.PreviousPositions = model.Staff.PreviousPositions;
					User.Staff.PreviousTalk = model.Staff.PreviousTalk;
					User.Staff.InterestedTalk = model.Staff.InterestedTalk;
					User.Staff.LeadershipPosition = model.Staff.LeadershipPosition;
					User.Staff.FirstChoice = await db.StaffChoices.FindAsync( model.Staff.FirstChoice );
					User.Staff.SecondChoice = await db.StaffChoices.FindAsync( model.Staff.SecondChoice );
					User.Staff.ThirdChoice = await db.StaffChoices.FindAsync( model.Staff.ThirdChoice );
					User.Staff.AdditionalComments = model.Staff.AdditionalComments;

					User.School.College = model.School.College;
					User.School.Grade = await db.Grades.FindAsync( model.School.Grade );

					User.Medical.Allergies = model.Medical.Allergies;
					User.Medical.HealthConditions = model.Medical.HealthConditions;

					User.Emergency.FirstName = model.Emergency.FirstName;
					User.Emergency.LastName = model.Emergency.LastName;
					User.Emergency.Email = model.Emergency.Email;
					User.Emergency.Phone = new Models.Phone();
					User.Emergency.Phone.Number = model.Emergency.Phone.Number;
					User.Emergency.Phone.Carrier = await db.Carriers.FindAsync( model.Emergency.Phone.Carrier );

					User.Transportation.TransportSelf = model.Transportation.TransportSelf;

					await db.SaveChangesAsync();
					var userView = new UserInput( User );

					this.Mail.From = this.From;
					this.Mail.Subject = "ChattAwakening Staffer Application Edit";
					this.Mail.Body = User.Personal.FirstName + ", <br /><br />We are emailing you to confirm that you have edited your application.  If you would like to furthur review, edit, or delete your application at any time, please go to <a href=\"http://utccatholic.org/Awakening/Staffers\">http://utccatholic.org/Awakening/Staffers</a>. <br />Please place our address in your contact list so we are not placed in your spam folder! We will be emailing you as we get closer to March 28th! <br /> If you have any questions, comments, and/or concerns, please email us back!<br /> <br /> Thank you, <br />ChattAwakening - UTC Catholic";
					this.Mail.IsBodyHtml = true;
					this.Mail.To.Add( User.Personal.Email );
					this.Mail.Bcc.Add( "[email protected], [email protected], [email protected]" );
					client.Credentials = Credentials;
					client.Send( this.Mail );


					return View( "Staffers", userView );
				}
				else
				{
					return HttpNotFound();
				}
			}
			else
			{
				return View( "Staffers", model );
			}
		}
示例#7
0
 public UserView( UserInput User )
     : base()
 {
     this.Roles = new Collection<RoleView>();
     foreach ( var role in User.Roles )
     {
         this.Roles.Add( new RoleView( role ) );
     }
     this.Fee = User.Fee;
     this.FeePaid = User.FeePaid;
     this.Personal = new PersonalView( User.Personal );
     this.School = new SchoolView( User.School );
     this.Medical = new MedicalView( User.Medical );
     this.Religion = new ReligionView( User.Religion );
     this.Emergency = new EmergencyView( User.Emergency );
     this.Transportation = new TransportationView( User.Transportation );
     this.Staff = new StaffView( User.Staff );
     this.Position = User.Position;
     if ( User.ApplicationStamp != null )
         this.ApplicationStamp = User.ApplicationStamp;
 }
示例#8
0
		public async Task StafferAppSubmit(UserInput model)
		{
			var User = await this.User();
			if ( User.Retreater )
			{
				Clients.Caller.errorBack( "You are already attending this retreat." );
			}
			else if ( User.Staffer )
			{
				Clients.Caller.errorBack( "You are already staffing this retreat." );
			}
			else if ( User.RetreaterPending )
			{
				Clients.Caller.errorBack( "You have already submitted your retreat application." );
			}
			else if ( User.StafferPending )
			{
				Clients.Caller.errorBack( "You have already submitted your staffer application." );
			}
			else
			{
				User.StafferPending = true;

				User.Personal.FirstName = model.Personal.FirstName;
				User.Personal.LastName = model.Personal.LastName;
				User.Personal.Email = model.Personal.Email;
				User.Personal.Phone = new Models.Phone();
				User.Personal.Phone.Number = model.Personal.Phone.Number;
				User.Personal.Phone.Carrier = await db.Carriers.FindAsync( model.Personal.Phone.Carrier );
				User.Personal.Hobbies = model.Personal.Hobbies;
				User.Personal.TShirtSize = await db.TShirtSizes.FindAsync( model.Personal.TShirtSize );

				User.Staff.PreviousAttended = model.Staff.PreviousAttended;
				User.Staff.PreviousPositions = model.Staff.PreviousPositions;
				User.Staff.PreviousTalk = model.Staff.PreviousTalk;
				User.Staff.InterestedTalk = model.Staff.InterestedTalk;
				User.Staff.LeadershipPosition = model.Staff.LeadershipPosition;
				User.Staff.FirstChoice = await db.StaffChoices.FindAsync( model.Staff.FirstChoice );
				User.Staff.SecondChoice = await db.StaffChoices.FindAsync( model.Staff.SecondChoice );
				User.Staff.ThirdChoice = await db.StaffChoices.FindAsync( model.Staff.ThirdChoice );
				User.Staff.AdditionalComments = model.Staff.AdditionalComments;

				User.School.College = model.School.College;
				User.School.Grade = await db.Grades.FindAsync( model.School.Grade );

				User.Medical.Allergies = model.Medical.Allergies;
				User.Medical.HealthConditions = model.Medical.HealthConditions;

				User.Emergency.FirstName = model.Emergency.FirstName;
				User.Emergency.LastName = model.Emergency.LastName;
				User.Emergency.Email = model.Emergency.Email;
				User.Emergency.Phone = new Models.Phone();
				User.Emergency.Phone.Number = model.Emergency.Phone.Number;
				User.Emergency.Phone.Carrier = await db.Carriers.FindAsync( model.Emergency.Phone.Carrier );

				User.Transportation.TransportSelf = model.Transportation.TransportSelf;



				await db.SaveChangesAsync();
				var userView = new UserInput( User );
				Clients.Caller.submitStaffBack( userView );

				var message = new MailMessage( "*****@*****.**", "*****@*****.**" );
				message.Body = "We have received a new application for ChattAwakening. The new applicant is a Staffer by the name of " + User.Personal.FirstName + " " + User.Personal.LastName + ". For more details, please go to: http://utccatholic.org/awakening/admin";
				var client = new SmtpClient( "mail.utccatholic.org", 465 );
				client.EnableSsl = true;
				client.Send( message );
			}
		}