public ActionResult PostCalendarForm_Adult(AdultModel adult) { SetAttendeeDetail_Adult(adult); adult.Event.AdditionalInfo.TotalCost = GetTotalPrice(adult.AdultNumber, adult.GetAdultAttendeeCost()).ToString("c2"); contentController.SetPostCalendarForm_Adult(adult); NameValueCollection routeValues = new NameValueCollection(); routeValues.Add("id", adult.Id.ToString()); return(RedirectToUmbracoPage(contentController.GetContentIDByName("AdultConfirm"), routeValues)); }
public string CreateNewTourBookingOnThankQ <T>(BaseModel model) { API_TOURBOOKING tourBooking = new API_TOURBOOKING(); tourBooking.REFERENCE = ""; tourBooking.TOURID = model.Event.id; tourBooking.STARTDATE = Convert.ToDateTime(model.Event.start).ToShortDateString(); tourBooking.STARTTIME = Convert.ToDateTime(model.Event.start).ToString("HH:mm:ffff"); tourBooking.ENDDATE = Convert.ToDateTime(model.Event.end).ToShortDateString(); tourBooking.ENDTIME = Convert.ToDateTime(model.Event.end).ToString("HH:mm:ffff"); tourBooking.STATUS = TOURBOOKINGSTATUS.BOOKED; tourBooking.BOOKERSERIALNUMBER = model.Event.GroupCoordinator.SerialNumber; tourBooking.INVOICEESERIALNUMBER = model.Event.Invoice.SerialNumber; tourBooking.BOOKINGCOMMENT = model.Comments; if (typeof(T).Equals(new SchoolModel().GetType())) { SchoolModel school = (SchoolModel)model; float totalCost = GetTotalPrice(school.StudentsNumber, school.GetStudentAttendeeCost()) + GetTotalPrice(school.StaffNumber, school.GetStaffAttendeeCost()); tourBooking.FORSERIALNUMBER = school.SerialNumber; tourBooking.TOTALCOST = totalCost; tourBooking.YEARGROUP = school.Year; tourBooking.SUBJECT = school.SubjectArea; return(PostJsonData_NewTourBooking(school.Event.id, tourBooking).Trim('"')); } else if (typeof(T).Equals(new AdultModel().GetType())) { AdultModel adult = (AdultModel)model; float totalCost = GetTotalPrice(adult.AdultNumber, adult.GetAdultAttendeeCost()); tourBooking.FORSERIALNUMBER = adult.Event.GroupCoordinator.SerialNumber; //Need Clarifiction tourBooking.TOTALCOST = totalCost; tourBooking.YEARGROUP = TOURCATEGORY.ADULT; return(PostJsonData_NewTourBooking(adult.Event.id, tourBooking).Trim('"')); } else if (typeof(T).Equals(new UniversityModel().GetType())) { UniversityModel uni = (UniversityModel)model; float totalCost = GetTotalPrice(uni.StudentNumber, uni.GetStudentAttendeeCost()) + GetTotalPrice(uni.StaffNumber, uni.GetStaffAttendeeCost()); tourBooking.FORSERIALNUMBER = uni.SerialNumber; tourBooking.TOTALCOST = totalCost; tourBooking.YEARGROUP = TOURCATEGORY.UNIVERSITY; return(PostJsonData_NewTourBooking(uni.Event.id, tourBooking).Trim('"')); } return(null); }
public List <string> CreateNewTourBookingAttendeeSummaryOnThankQ <T>(BaseModel model) { List <string> results = new List <string>(); API_TOURBOOKINGATTENDEESUMMARY attendeeSummary = new API_TOURBOOKINGATTENDEESUMMARY(); attendeeSummary.TOURID = model.Event.id; attendeeSummary.TOURBOOKINGID = model.TourBookingID; if (typeof(T).Equals(new SchoolModel().GetType())) { SchoolModel school = (SchoolModel)model; for (int i = 0; i < school.AttendeeList.Count; i++) { if (school.AttendeeList[i].Type.Equals(ATTENDEETYPE.ATTENDEETYPE_STUDENT)) { float discount = 0; attendeeSummary.ATTENDEETYPEID = school.GetStudentAttendeeID(); attendeeSummary.QUANTITYBOOKED = school.StudentsNumber; attendeeSummary.QUANTITYATTENDED = school.StudentsNumber; attendeeSummary.ATTENDEECOST = GetTotalPrice(school.StudentsNumber, school.GetStudentAttendeeCost()); attendeeSummary.DISCOUNT = discount; attendeeSummary.FINALCOST = GetFinalPrice(attendeeSummary.ATTENDEECOST, attendeeSummary.DISCOUNT); results.Add(PostJsonData_NewTourBookingAttendeeSummary(attendeeSummary)); } else if (school.AttendeeList[i].Type.Equals(ATTENDEETYPE.ATTENDEETYPE_STAFF)) { float staffPrice = school.GetStaffAttendeeCost(); int staffNumber = school.StaffNumber; float discount = 0; attendeeSummary.ATTENDEETYPEID = school.GetStaffAttendeeID(); attendeeSummary.QUANTITYBOOKED = school.StaffNumber; attendeeSummary.QUANTITYATTENDED = school.StaffNumber; attendeeSummary.ATTENDEECOST = GetTotalPrice(staffNumber, staffPrice); attendeeSummary.DISCOUNT = discount; attendeeSummary.FINALCOST = GetFinalPrice(attendeeSummary.ATTENDEECOST, attendeeSummary.DISCOUNT); results.Add(PostJsonData_NewTourBookingAttendeeSummary(attendeeSummary)); } } } else if (typeof(T).Equals(new AdultModel().GetType())) { AdultModel adult = (AdultModel)model; float discount = 0; attendeeSummary.ATTENDEETYPEID = adult.GetAdultAttendeeID(); attendeeSummary.QUANTITYBOOKED = adult.AdultNumber; attendeeSummary.QUANTITYATTENDED = adult.AdultNumber; attendeeSummary.ATTENDEECOST = GetTotalPrice(adult.AdultNumber, adult.GetAdultAttendeeCost()); attendeeSummary.DISCOUNT = discount; attendeeSummary.FINALCOST = GetFinalPrice(attendeeSummary.ATTENDEECOST, attendeeSummary.DISCOUNT); results.Add(PostJsonData_NewTourBookingAttendeeSummary(attendeeSummary)); } else if (typeof(T).Equals(new UniversityModel().GetType())) { UniversityModel uni = (UniversityModel)model; for (int i = 0; i < uni.AttendeeList.Count; i++) { if (uni.AttendeeList[i].Type.Equals(ATTENDEETYPE.ATTENDEETYPE_STUDENT)) { float discount = 0; attendeeSummary.ATTENDEETYPEID = uni.GetStudentAttendeeID(); attendeeSummary.QUANTITYBOOKED = uni.StudentNumber; attendeeSummary.QUANTITYATTENDED = uni.StudentNumber; attendeeSummary.ATTENDEECOST = GetTotalPrice(uni.StudentNumber, uni.GetStudentAttendeeCost()); attendeeSummary.DISCOUNT = discount; attendeeSummary.FINALCOST = GetFinalPrice(attendeeSummary.ATTENDEECOST, attendeeSummary.DISCOUNT); results.Add(PostJsonData_NewTourBookingAttendeeSummary(attendeeSummary)); } else if (uni.AttendeeList[i].Type.Equals(ATTENDEETYPE.ATTENDEETYPE_STAFF)) { float staffPrice = uni.GetStaffAttendeeCost(); int staffNumber = uni.StaffNumber; float discount = 0; attendeeSummary.ATTENDEETYPEID = uni.GetStaffAttendeeID(); attendeeSummary.QUANTITYBOOKED = uni.StaffNumber; attendeeSummary.QUANTITYATTENDED = uni.StaffNumber; attendeeSummary.ATTENDEECOST = GetTotalPrice(staffNumber, staffPrice); attendeeSummary.DISCOUNT = discount; attendeeSummary.FINALCOST = GetFinalPrice(attendeeSummary.ATTENDEECOST, attendeeSummary.DISCOUNT); results.Add(PostJsonData_NewTourBookingAttendeeSummary(attendeeSummary)); } } } return(results); }