Exemplo n.º 1
0
        /// <summary>
        /// saves Event Registration details
        /// </summary>
        /// <param name="evntr"> Event Registration Model </param>
        public void PostEventRegistration(EventRegistrationModel evntr)
        {
            using (var _ctx = new ChinmayaEntities())
            {
                var config = new MapperConfiguration(cfg =>
                {
                    cfg.CreateMap <EventRegistrationModel, EventRegistration>();
                });
                IMapper mapper = config.CreateMapper();

                var eventRegistration = new EventRegistration();
                eventRegistration.EventId        = evntr.EventId;
                eventRegistration.FamilyMemberId = evntr.FamilyMemberId;
                eventRegistration.OwnerId        = evntr.OwnerId;
                eventRegistration.CheckPaymentId = _ctx.CheckPayments.Where(r => r.CreatedBy == evntr.OwnerId).Select(n => n.Id).FirstOrDefault();
                eventRegistration.InvoiceId      = _ctx.CreditCardPayments.Where(r => r.UserId == evntr.OwnerId).Select(n => n.InvoiceId).FirstOrDefault();
                eventRegistration.IsRegister     = true;
                eventRegistration.IsConfirm      = true;
                eventRegistration.IsPaid         = true;
                eventRegistration.CreatedBy      = evntr.OwnerId;
                eventRegistration.CreatedDate    = DateTime.Now;

                _ctx.EventRegistrations.Add(eventRegistration);
                try
                {
                    _ctx.SaveChanges();
                }
                catch
                {
                    throw;
                }
            }
        }
 public IHttpActionResult EventRegistration(EventRegistrationModel obj)
 {
     try
     {
         _payment.PostEventRegistration(obj);
         return(Ok("Success"));
     }
     catch
     {
         throw;
     }
 }
Exemplo n.º 3
0
        public IHttpActionResult Post(int id, [FromBody] EventRegistrationModel model)
        {
            var user = new User(id)
            {
                Schedule = model.EventIds.Select(x => new StandAloneEvent(x)).ToList <Event>()
            };

            var result = PerformAction <RegisterForStandAloneEvent, User>(new RegisterForStandAloneEvent(user));

            return(new ActionResultToOkHttpActionResult <User, UserModel>(result, x => x.ToModel(), this)
                   .Do());
        }
Exemplo n.º 4
0
        private EventRegistrationModel CreateEventRegistrationModel(EventPageBase currentPage, string contentLink)
        {
            var model               = new EventRegistrationModel(currentPage);
            var repository          = ServiceLocator.Current.GetInstance <IContentLoader>();
            var localizationService = ServiceLocator.Current.GetInstance <LocalizationService>();

            var           pageRouteHelper = EPiServer.ServiceLocation.ServiceLocator.Current.GetInstance <EPiServer.Web.Routing.PageRouteHelper>();
            PageReference currentPageLink = pageRouteHelper.PageLink;

            model.HostPageData   = pageRouteHelper.Page;
            model.EventPageBase  = currentPage;
            model.Sessions       = BVNetwork.Attend.Business.API.AttendSessionEngine.GetSessionsList(model.EventPageBase.PageLink);
            model.AvailableSeats = AttendRegistrationEngine.GetAvailableSeats(model.EventPageBase.PageLink);
            model.PriceText      = model.EventPageBase.EventDetails.Price > 0 ? model.EventPageBase.EventDetails.Price + " " + localizationService.GetString("/eventRegistrationTemplate/norwegianCurrencey") : localizationService.GetString("/eventRegistrationTemplate/freeOfCharge");
            return(model);
        }
        public async Task <ActionResult> PaymentMethod(CheckPaymentModel data, string prevBtn, string nextBtn)
        {
            ViewBag.AccountType = await _common.GetAccountType();

            if (prevBtn != null)
            {
                List <ClassesConfirmModel> classesConfirm = new List <ClassesConfirmModel>();
                classesConfirm = TempData["mydata"] as List <ClassesConfirmModel>;
                return(View("../EventRegistration/ClassesConfirm", classesConfirm));
            }

            else
            {
                if (nextBtn != null)
                {
                    if (ModelState.IsValid && data.paymentType == "Check")
                    {
                        var amount = TempData["Amount"];
                        data.CreatedBy = User.UserId;
                        data.Amount    = Convert.ToDecimal(amount);
                        HttpResponseMessage userResponseMessage = await Utility.GetObject("/api/Payment/PostCheckPayment", data, true);

                        List <ClassesConfirmModel> classConfirm = new List <ClassesConfirmModel>();
                        classConfirm = TempData["mydata"] as List <ClassesConfirmModel>;
                        foreach (var item in classConfirm)
                        {
                            EventRegistrationModel registrationModel = new EventRegistrationModel();
                            registrationModel.OwnerId        = User.UserId;
                            registrationModel.FamilyMemberId = item.uFamilyMembers.Id;
                            foreach (var i in item.Events)
                            {
                                registrationModel.EventId = i.Id;
                                HttpResponseMessage userResponseMessage1 = await Utility.GetObject("/api/Payment/EventRegistration", registrationModel, true);
                            }
                        }
                        //return RedirectToAction("MyAccount", "Account");
                        ViewBag.Message = "Your payment details has been received. The payment will be processed subject to check realization.";
                        return(View());
                    }
                }
            }
            return(View());
        }
 public async Task<List<EventRegistrationModel>> GetAllEventRegistrations()
 {
     var registeredUsers = await db.user.Where(u => [email protected] != 0).ToListAsync();
     var events = new List<EventRegistrationModel>();
     if (registeredUsers.Any())
     {
         foreach (user registeredUser in registeredUsers)
         {
             foreach (@event evt in registeredUser.@event)
             {
                 var myevent = new EventRegistrationModel()
                 {
                     eventId = evt.eventId,
                     eventname = evt.eventName,
                     userId = registeredUser.userId,
                     username = string.Format("{0} {1}", registeredUser.firstname, registeredUser.lastname)
                 };
                 events.Add(myevent);
             }
         }
     }
     return events;
 
 }
Exemplo n.º 7
0
 public IHttpActionResult Post([FromBody] EventRegistrationModel model)
 {
     return(Post(_currentUser.Id, model));
 }