public decimal GetRegistrationPathValue(int registrationId) { IRegistrationService service = new RegistrationService(this._repository, false); return(service.GetRegistrationPathValue(registrationId)); }
private List<CartSummaryLineItem> GenerateLineItems(SessionCart currentCart) { List<CartSummaryLineItem> lineItems = new List<CartSummaryLineItem>(); IRegistrationService regService = new RegistrationService(this._repository, false); foreach (var item in currentCart.ActionItems.Where(x => x.Value.ItemReadyForCheckout)) { var lineItem = new CartSummaryLineItem(); EventService evtService = new EventService(_repository, false); Registration reg; EventFee fee; Event evt; EventDate evtDate; EventWave evtWave; switch (item.Value.ActionType) { case CartActionType.NewRegistration: reg = (Registration)item.Value.ActionObject; evtWave = evtService.GetEventWaveById(reg.EventWaveId); evtDate = evtWave.EventDate; evt = evtDate.Event; fee = evtService.GetCurrentFeeForEvent(evt.EventId, EventFeeType.Registration); lineItems.Add(GenerateLineItem(evt.EventId, item.Key, PurchaseType.Registration, ProcessType.Individual, "Registration", string.Format("{0}, {1} : {2} {3}", evt.GeneralLocality, evt.Region.Code, evtDate.DateOfEvent.ToString("dddd MMMM dd, yyyy"), evtWave.StartTime.ToString("h:mm tt")), fee.PurchaseItemId, reg.RegistrationType == RegistrationType.CancerRegistration ? 0 : fee.Cost, fee.Discountable, fee.Taxable, evt.StateTax, evt.LocalTax, true)); break; case CartActionType.EventChange: var changeAction = (ChangeEventAction)item.Value.ActionObject; evtWave = evtService.GetEventWaveById(changeAction.UpdatedEventWaveId); evtDate = evtWave.EventDate; evt = evtDate.Event; fee = evtService.GetCurrentFeeForEvent(evt.EventId, EventFeeType.ChangeEvent); lineItems.Add(GenerateLineItem(evt.EventId, item.Key, PurchaseType.Fee, ProcessType.General, "Event Change", string.Format("Changing your registration to {0}, {1} : {2} {3}", evt.GeneralLocality, evt.Region.Code, evtDate.DateOfEvent.ToString("dddd MMMM dd, yyyy"), evtWave.StartTime.ToString("h:mm tt")), fee.PurchaseItemId, fee.Cost, false, false, null, null, true)); var originalCost = regService.GetRegistrationPathValue(changeAction.RegistrationId); var regFee = evtService.GetCurrentFeeForEvent(evt.EventId, EventFeeType.Registration); if (regFee.Cost > originalCost) { var additionalcost = regFee.Cost - originalCost; lineItems.Add(GenerateLineItem(evt.EventId, null, PurchaseType.FeeDifference, ProcessType.Individual, "Difference Cost", string.Format("The event you have selected has a fee difference of {0}.", additionalcost.ToString("c")), 1, additionalcost, true, true, evt.StateTax, evt.LocalTax, true)); } break; case CartActionType.TransferRregistration: var transferAction = (TransferAction)item.Value.ActionObject; evtWave = _repository.Registrations.Find(transferAction.RegistrationId).EventWave; evtDate = evtWave.EventDate; evt = evtDate.Event; fee = evtService.GetCurrentFeeForEvent(evt.EventId, EventFeeType.Transfer); lineItems.Add(GenerateLineItem(evt.EventId, item.Key, PurchaseType.Fee, ProcessType.General, "Transfer to friend", string.Format("Transfering your registration for {0}, {1} : {2} {3} to {4} using {5}.", evt.GeneralLocality, evt.Region.Code, evtDate.DateOfEvent.ToString("dddd MMMM dd, yyyy"), evtWave.StartTime.ToString("h:mm tt"), string.Format("{0} {1}", transferAction.FirstName, transferAction.LastName), transferAction.Email), fee.PurchaseItemId, fee.Cost, false, false, null, null, true)); break; case CartActionType.CancelRegistration: var cancelAction = (CancellationAction)item.Value.ActionObject; evtWave = _repository.Registrations.Find(cancelAction.RegistrationId).EventWave; evtDate = evtWave.EventDate; evt = evtDate.Event; fee = evtService.GetCurrentFeeForEvent(evt.EventId, EventFeeType.Cancellation); lineItems.Add(GenerateLineItem(evt.EventId, item.Key, PurchaseType.Fee, ProcessType.General, "Cancellation", string.Format("Cancelling your registration for {0}, {1} : {2} {3}. You will be issued a cancellation code of the original value that can be used towards another event.", evt.GeneralLocality, evt.Region.Code, evtDate.DateOfEvent.ToString("dddd MMMM dd, yyyy"), evtWave.StartTime.ToString("h:mm tt")), fee.PurchaseItemId, fee.Cost, false, false, null, null, true)); break; case CartActionType.ShippingFee: var shippingCost = (ShippingFeeAction)item.Value.ActionObject; evtWave = evtService.GetEventWaveById(shippingCost.EventWaveId); evtDate = evtWave.EventDate; evt = evtDate.Event; fee = evtService.GetCurrentFeeForEvent(evt.EventId, EventFeeType.Shipping); lineItems.Add(GenerateLineItem(evt.EventId, item.Key, PurchaseType.Fee, ProcessType.General, "Shipping Fee", "Shipping Fee for registration packet", fee.PurchaseItemId, fee.Cost, false, false, null, null, false)); break; case CartActionType.ProcessingFee: var processingCost = (ProcessingFeeAction)item.Value.ActionObject; evtWave = evtService.GetEventWaveById(processingCost.EventWaveId); evtDate = evtWave.EventDate; evt = evtDate.Event; fee = evtService.GetCurrentFeeForEvent(evt.EventId, EventFeeType.ProcessingFee); lineItems.Add(GenerateLineItem(evt.EventId, item.Key, PurchaseType.Fee, ProcessType.General, PROCESSING_FEE, "", fee.PurchaseItemId, fee.Cost, false, false, null, null, false)); break; } } return lineItems; }
public decimal GetRegistrationPathValue(int registrationId) { IRegistrationService service = new RegistrationService(this._repository, false); return service.GetRegistrationPathValue(registrationId); }
private void CompleteActions(ActionItem item, int cartItemId, int? discountId, string confirmationCode) { IRegistrationService regService = new RegistrationService(this._repository, false); switch (item.ActionType) { case CartActionType.NewRegistration: var newReg = (Registration)item.ActionObject; newReg.CartItemId = cartItemId; newReg.ConfirmationCode = confirmationCode; regService.CreateNewRegistration(newReg, discountId); break; case CartActionType.EventChange: var changeAction = (ChangeEventAction)item.ActionObject; regService.ChangeEvent(changeAction.RegistrationId, changeAction.UpdatedEventWaveId, cartItemId, confirmationCode); break; case CartActionType.TransferRregistration: var transferAction = (TransferAction)item.ActionObject; regService.TransferRegistration(transferAction.RegistrationId, transferAction.FullName, transferAction.Email); break; case CartActionType.CancelRegistration: var cancelAction = (CancellationAction)item.ActionObject; regService.CancelRegistration(cancelAction.RegistrationId); break; } }
private List <CartSummaryLineItem> GenerateLineItems(SessionCart currentCart) { List <CartSummaryLineItem> lineItems = new List <CartSummaryLineItem>(); IRegistrationService regService = new RegistrationService(this._repository, false); foreach (var item in currentCart.ActionItems.Where(x => x.Value.ItemReadyForCheckout)) { var lineItem = new CartSummaryLineItem(); EventService evtService = new EventService(_repository, false); Registration reg; EventFee fee; Event evt; EventDate evtDate; EventWave evtWave; switch (item.Value.ActionType) { case CartActionType.NewRegistration: reg = (Registration)item.Value.ActionObject; evtWave = evtService.GetEventWaveById(reg.EventWaveId); evtDate = evtWave.EventDate; evt = evtDate.Event; fee = evtService.GetCurrentFeeForEvent(evt.EventId, EventFeeType.Registration); lineItems.Add(GenerateLineItem(evt.EventId, item.Key, PurchaseType.Registration, ProcessType.Individual, "Registration", string.Format("{0}, {1} : {2} {3}", evt.GeneralLocality, evt.Region.Code, evtDate.DateOfEvent.ToString("dddd MMMM dd, yyyy"), evtWave.StartTime.ToString("h:mm tt")), fee.PurchaseItemId, reg.RegistrationType == RegistrationType.CancerRegistration ? 0 : fee.Cost, fee.Discountable, fee.Taxable, evt.StateTax, evt.LocalTax, true)); break; case CartActionType.EventChange: var changeAction = (ChangeEventAction)item.Value.ActionObject; evtWave = evtService.GetEventWaveById(changeAction.UpdatedEventWaveId); evtDate = evtWave.EventDate; evt = evtDate.Event; fee = evtService.GetCurrentFeeForEvent(evt.EventId, EventFeeType.ChangeEvent); lineItems.Add(GenerateLineItem(evt.EventId, item.Key, PurchaseType.Fee, ProcessType.General, "Event Change", string.Format("Changing your registration to {0}, {1} : {2} {3}", evt.GeneralLocality, evt.Region.Code, evtDate.DateOfEvent.ToString("dddd MMMM dd, yyyy"), evtWave.StartTime.ToString("h:mm tt")), fee.PurchaseItemId, fee.Cost, false, false, null, null, true)); var originalCost = regService.GetRegistrationPathValue(changeAction.RegistrationId); var regFee = evtService.GetCurrentFeeForEvent(evt.EventId, EventFeeType.Registration); if (regFee.Cost > originalCost) { var additionalcost = regFee.Cost - originalCost; lineItems.Add(GenerateLineItem(evt.EventId, null, PurchaseType.FeeDifference, ProcessType.Individual, "Difference Cost", string.Format("The event you have selected has a fee difference of {0}.", additionalcost.ToString("c")), 1, additionalcost, true, true, evt.StateTax, evt.LocalTax, true)); } break; case CartActionType.TransferRregistration: var transferAction = (TransferAction)item.Value.ActionObject; evtWave = _repository.Registrations.Find(transferAction.RegistrationId).EventWave; evtDate = evtWave.EventDate; evt = evtDate.Event; fee = evtService.GetCurrentFeeForEvent(evt.EventId, EventFeeType.Transfer); lineItems.Add(GenerateLineItem(evt.EventId, item.Key, PurchaseType.Fee, ProcessType.General, "Transfer to friend", string.Format("Transfering your registration for {0}, {1} : {2} {3} to {4} using {5}.", evt.GeneralLocality, evt.Region.Code, evtDate.DateOfEvent.ToString("dddd MMMM dd, yyyy"), evtWave.StartTime.ToString("h:mm tt"), string.Format("{0} {1}", transferAction.FirstName, transferAction.LastName), transferAction.Email), fee.PurchaseItemId, fee.Cost, false, false, null, null, true)); break; case CartActionType.CancelRegistration: var cancelAction = (CancellationAction)item.Value.ActionObject; evtWave = _repository.Registrations.Find(cancelAction.RegistrationId).EventWave; evtDate = evtWave.EventDate; evt = evtDate.Event; fee = evtService.GetCurrentFeeForEvent(evt.EventId, EventFeeType.Cancellation); lineItems.Add(GenerateLineItem(evt.EventId, item.Key, PurchaseType.Fee, ProcessType.General, "Cancellation", string.Format("Cancelling your registration for {0}, {1} : {2} {3}. You will be issued a cancellation code of the original value that can be used towards another event.", evt.GeneralLocality, evt.Region.Code, evtDate.DateOfEvent.ToString("dddd MMMM dd, yyyy"), evtWave.StartTime.ToString("h:mm tt")), fee.PurchaseItemId, fee.Cost, false, false, null, null, true)); break; case CartActionType.ShippingFee: var shippingCost = (ShippingFeeAction)item.Value.ActionObject; evtWave = evtService.GetEventWaveById(shippingCost.EventWaveId); evtDate = evtWave.EventDate; evt = evtDate.Event; fee = evtService.GetCurrentFeeForEvent(evt.EventId, EventFeeType.Shipping); lineItems.Add(GenerateLineItem(evt.EventId, item.Key, PurchaseType.Fee, ProcessType.General, "Shipping Fee", "Shipping Fee for registration packet", fee.PurchaseItemId, fee.Cost, false, false, null, null, false)); break; case CartActionType.ProcessingFee: var processingCost = (ProcessingFeeAction)item.Value.ActionObject; evtWave = evtService.GetEventWaveById(processingCost.EventWaveId); evtDate = evtWave.EventDate; evt = evtDate.Event; fee = evtService.GetCurrentFeeForEvent(evt.EventId, EventFeeType.ProcessingFee); lineItems.Add(GenerateLineItem(evt.EventId, item.Key, PurchaseType.Fee, ProcessType.General, PROCESSING_FEE, "", fee.PurchaseItemId, fee.Cost, false, false, null, null, false)); break; } } return(lineItems); }
public decimal GetRegistrationValue(int registrationId) { IRegistrationService regService = new RegistrationService(this._repository, false); var reg = regService.GetRegistrationById(registrationId); return reg.CartItem == null ? 0 : reg.CartItem.Cost; }
public JsonResult LeaveTeam(int regId, int teamId) { IRegistrationService regService = new RegistrationService(new RepositoryGroup(), false); Registration registration = regService.GetRegistrationById(regId); registration.TeamId = null; var verify = regService.UpdateRegistration(registration); return Json("sucess"); }
public JsonResult JoinTeam(int registrationId, string teamCode, int eventId) { string errors = string.Empty; // Get Team for the team Code var team = _teamService.GetTeamByCode(eventId, teamCode); // Get the current registration for the user IRegistrationService regService = new RegistrationService(new RepositoryGroup(), false); var registration = regService.GetRegistrationById(registrationId); if (team != null && registration != null) { if (team.EventId != registration.EventWave.EventDate.EventId) return Json(string.Format("The code entered is not associated with a team for this event.")); registration.TeamId = team.TeamId; var result = regService.Save(); if (result.Success) { return Json(new {redirect = Url.Action("ViewTeam", "Team", new {teamId = team.TeamId})}); } result.GetServiceErrors().ForEach(x => errors += x.ErrorMessage + "<br/>"); return Json(errors); } return Json("The code entered is not associated with a team for this event."); }