// GET: EventBookings/Create
        public ActionResult Create()
        {
            ViewBag.Pay_Event_BookingID = new SelectList(db.payment_Booking, "Pay_Event_BookingID", "Payment_Type");
            ViewBag.EventTypeID         = new SelectList(db.EventTypes, "EventTypeID", "EventType1");
            ViewBag.PaymentID           = new SelectList(db.Payments, "PaymentID", "Payment_Status");
            ViewBag.Service_Company_ID  = new SelectList(db.service_company, "Service_Company_ID", "Service_Company1");
            ViewBag.servicetypeid       = new SelectList(db.serviceTypes, "ServiceTypeID", "ServiceType1");
            ViewBag.Venue_ID            = new SelectList(db.Venues, "Venue_ID", "Venue_Name");


            List <SelectListItem> EventName = new List <SelectListItem>();
            EventBooking          Drop      = new EventBooking();

            List <EventType> Event = db.EventTypes.ToList();

            Event.ForEach(x =>
            {
                EventName.Add(new SelectListItem {
                    Text = x.EventType1, Value = x.EventTypeID.ToString()
                });
            });
            Drop.EventType = Convert.ToString(EventName);

            return(View(Drop));
            // return View();
        }
        public ActionResult Create([Bind(Include = "Event_ID,Event_Name,Start_Date,End_Date,No_Of_Participants,Pay_Event_BookingID,Venue_ID,servicetypeid,PaymentID,EventTypeID,Service_Company_ID,Descriptions,EventType,Venue,FoodCompany,ElectricalCompany")] EventBooking eventBooking)
        {
            if (ModelState.IsValid)
            {
                db.EventBookings.Add(eventBooking);
                db.SaveChanges();
                return(RedirectToAction("Summary"));
            }

            Session["Event_Name"]         = eventBooking.Event_Name;
            Session["Start_Date"]         = eventBooking.Start_Date;
            Session["End_Date"]           = eventBooking.End_Date;
            Session["No_Of_Participants"] = eventBooking.No_Of_Participants;
            Session["EventTypeID"]        = eventBooking.EventTypeID;
            Session["Venue_ID"]           = eventBooking.Venue_ID;
            Session["FoodCompany"]        = eventBooking.FoodCompany;
            Session["ElectricalCompany"]  = eventBooking.ElectricalCompany;


            ViewBag.Pay_Event_BookingID = new SelectList(db.payment_Booking, "Pay_Event_BookingID", "Payment_Type", eventBooking.Pay_Event_BookingID);
            ViewBag.EventTypeID         = new SelectList(db.EventTypes, "EventTypeID", "EventType1", eventBooking.EventTypeID);
            ViewBag.PaymentID           = new SelectList(db.Payments, "PaymentID", "Payment_Status", eventBooking.PaymentID);
            ViewBag.Service_Company_ID  = new SelectList(db.service_company, "Service_Company_ID", "Service_Company1", eventBooking.Service_Company_ID);
            ViewBag.servicetypeid       = new SelectList(db.serviceTypes, "ServiceTypeID", "ServiceType1", eventBooking.servicetypeid);
            ViewBag.Venue_ID            = new SelectList(db.Venues, "Venue_ID", "Venue_Name", eventBooking.Venue_ID);
            return(View(eventBooking));
        }
Example #3
0
        /// <summary>
        /// Wait for Room Events and send it to the O365 Subscription Service Bus Queue
        /// </summary>
        /// <param name="queueConnection"></param>
        /// <param name="roomSmtp"></param>
        /// <param name="roomEvent"></param>
        /// <returns></returns>
        public async System.Threading.Tasks.Task SendQueueO365ChangesAsync(string queueConnection, string roomSmtp, ItemEvent roomEvent)
        {
            var sender = new MessageSender(queueConnection, SBQueueSubscriptionO365);

            Trace.WriteLine($"SendQueueO365ChangesAsync({roomSmtp}, {roomEvent.EventType.ToString("f")}) status");
            var i = RandomSeed.Next(1, 15679);

            var ewsbooking = new EventBooking()
            {
                SiteMailBox       = roomSmtp,
                EventType         = roomEvent.EventType,
                TimeStamp         = roomEvent.TimeStamp,
                ExchangeId        = roomEvent.ItemId.UniqueId,
                ExchangeChangeKey = roomEvent.ItemId.ChangeKey
            };

            if (roomEvent.OldItemId != null)
            {
                ewsbooking.OldExchangeId        = roomEvent.OldItemId.UniqueId;
                ewsbooking.OldExchangeChangeKey = roomEvent.OldItemId.ChangeKey;
            }

            var message = new Message(Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(ewsbooking)))
            {
                ContentType = "application/json",
                Label       = SBMessageSubscriptionO365,
                MessageId   = i.ToString()
            };

            await sender.SendAsync(message);

            Trace.WriteLine($"SendQueueO365ChangesAsync({roomSmtp}, {roomEvent.EventType.ToString("f")}) status => sent: Id = {message.MessageId}");
        }
        public HttpResponseMessage Post([FromBody] JObject value)
        {
            EventBooking editeventbooking  = new EventBooking();
            var          neweventid        = value["neweventid"].ToString();
            var          newmemberid       = value["newmemberid"].ToString();
            var          newbookingdate    = value["newbookingdate"].ToString();
            var          newemployeestatus = value["newemployeestatus"].ToString();

            if (editeventbooking != null)
            {
                editeventbooking.Event_ID           = Convert.ToInt32(neweventid);
                editeventbooking.mb_ID              = Convert.ToInt32(newmemberid);
                editeventbooking.BookingDate        = DateTime.Parse(newbookingdate);
                editeventbooking.EmployeeJoinStatus = newemployeestatus;
                db.EventBooking.Add(editeventbooking);
                db.SaveChanges();
            }
            var result = new
            {
                STATUS = true,
                MSG    = "成功",
            };

            return(Request.CreateResponse(HttpStatusCode.OK, result));
        }
        public ActionResult DeleteConfirmed(int id)
        {
            EventBooking eventBooking = db.EventBookings.Find(id);

            db.EventBookings.Remove(eventBooking);
            db.SaveChanges();
            return(RedirectToAction("Index", "Events"));
        }
        public ActionResult Create([Bind(Include = "ApplicantId,EventId,Id")] EventBooking booking)
        {
            bool success = (db.EventBookings.Any(a => a.ApplicantId == booking.ApplicantId && a.EventId == booking.EventId));

            if (!success)
            {
                if (ModelState.IsValid)
                {
                    db.EventBookings.Add(booking);
                    db.SaveChanges();
                    //ApplicationUser user = System.Web.HttpContext.Current.GetOwinContext().GetUserManager<ApplicationUserManager>().FindById(System.Web.HttpContext.Current.User.Identity.GetUserId());
                    //var client = new SendGridClient(API_KEY);
                    //var from = new EmailAddress("*****@*****.**", "Invitation from Salutem");
                    var subject = "Notification of Booking Confirmation";

                    var user = db.Applicants.Find(booking.ApplicantId);
                    //var to = new EmailAddress("*****@*****.**", user.Email);
                    //TempData["message"] = "Congratulations!!! You've successfully booked for this Event.";
                    var eventName = db.Events.Find(booking.EventId);
                    var contents  = "<h4> Hi " + user.FirstName + "</h4>" + "Congratulations!!! You've successfully booked for " + eventName.EventName + "<h5>Regards Salutem </h5>";
                    // var plainTextContent = contents;
                    //var htmlContent = "<p>" + contents + "</p>";
                    //var msg = MailHelper.CreateSingleEmail(from, to, subject, plainTextContent, htmlContent);
                    //var response =  client.SendEmailAsync(msg);

                    es.Send(user.Email, subject, contents);

                    TempData["msg"] = "<script>alert('Congratulations!!! You've successfully booked for this Event.');</script>";
                    return(RedirectToAction("UserIndex", "Events"));
                }
            }
            else
            {
                TempData["message"] = "Congratulations!!! You're already enrolled for this Event.";
                TempData["msg"]     = "<script>alert('Sorry! You're already booked for this Event.');</script>";
            }

            string currentUserId = User.Identity.GetUserId();
            var    fullName      = db.Applicants.Where(m => m.UserId == currentUserId)
                                   .Select(a => new SelectListItem
            {
                Value = a.ApplicantId.ToString(),
                Text  = a.FirstName + " " + a.LastName
            });

            ViewBag.ApplicantId = new SelectList(fullName, "Value", "Text");
            var events = db.Events
                         .Select(a => new SelectListItem
            {
                Value = a.EventId.ToString(),
                Text  = a.EventName
            });

            ViewBag.EventId = new SelectList(events, "Value", "Text");

            return(View(booking));
        }
        public ActionResult Summary()
        {
            EventBooking eb = (from record in db.EventBookings
                               orderby record.Event_ID descending
                               select record).First();


            return(View(eb));
        }
 public ActionResult Edit([Bind(Include = "EventBookingID,MemberID,EventID")] EventBooking eventBooking)
 {
     if (ModelState.IsValid)
     {
         db.Entry(eventBooking).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.EventID  = new SelectList(db.Events, "EventID", "Title", eventBooking.EventID);
     ViewBag.MemberID = new SelectList(db.Members, "MemberID", "FirstName", eventBooking.MemberID);
     return(View(eventBooking));
 }
 public ActionResult Edit([Bind(Include = "ApplicantId,EventId,Id")] EventBooking eventBooking)
 {
     if (ModelState.IsValid)
     {
         db.Entry(eventBooking).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.ApplicantId = new SelectList(db.Applicants, "ApplicantId", "FirstName", eventBooking.ApplicantId);
     ViewBag.EventId     = new SelectList(db.Events, "EventId", "EventName", eventBooking.EventId);
     return(View(eventBooking));
 }
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            EventBooking eventBooking = db.EventBookings.Find(id);

            if (eventBooking == null)
            {
                return(HttpNotFound());
            }
            return(View(eventBooking));
        }
Example #11
0
        public EventBooking ValidateBooking(string email, long?eventId)
        {
            EventBooking getBookingDetail = null;

            try
            {
                getBookingDetail = (from user in db.EventBookings.Where(x => x.EmailAddress.Trim() == email.Trim() && x.EventId == eventId) select user).FirstOrDefault();
            }
            catch (Exception ex)
            {
                //log.Error(ex.Message);
            }
            return(getBookingDetail);
        }
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            EventBooking eventBooking = db.EventBookings.Find(id);

            if (eventBooking == null)
            {
                return(HttpNotFound());
            }
            ViewBag.EventID  = new SelectList(db.Events, "EventID", "Title", eventBooking.EventID);
            ViewBag.MemberID = new SelectList(db.Members, "MemberID", "FirstName", eventBooking.MemberID);
            return(View(eventBooking));
        }
 public ActionResult Edit([Bind(Include = "Event_ID,Event_Name,Start_Date,End_Date,No_Of_Participants,Pay_Event_BookingID,Venue_ID,servicetypeid,PaymentID,EventTypeID,Service_Company_ID,Descriptions,EventType,Venue,FoodCompany,ElectricalCompany")] EventBooking eventBooking)
 {
     if (ModelState.IsValid)
     {
         db.Entry(eventBooking).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.Pay_Event_BookingID = new SelectList(db.payment_Booking, "Pay_Event_BookingID", "Payment_Type", eventBooking.Pay_Event_BookingID);
     ViewBag.EventTypeID         = new SelectList(db.EventTypes, "EventTypeID", "EventType1", eventBooking.EventTypeID);
     ViewBag.PaymentID           = new SelectList(db.Payments, "PaymentID", "Payment_Status", eventBooking.PaymentID);
     ViewBag.Service_Company_ID  = new SelectList(db.service_company, "Service_Company_ID", "Service_Company1", eventBooking.Service_Company_ID);
     ViewBag.servicetypeid       = new SelectList(db.serviceTypes, "ServiceTypeID", "ServiceType1", eventBooking.servicetypeid);
     ViewBag.Venue_ID            = new SelectList(db.Venues, "Venue_ID", "Venue_Name", eventBooking.Venue_ID);
     return(View(eventBooking));
 }
        public ActionResult Create(int id)
        {
            var loggedInUser = User.Identity.GetUserId();
            //fetches the member object associated with the current logged in user.
            var currentMember = db.Members.ToList().SingleOrDefault(m => string.Equals(m.userId, loggedInUser));

            EventBooking eventBooking = new EventBooking()
            {
                MemberID = currentMember.MemberID,
                EventID  = id
            };

            db.EventBookings.Add(eventBooking);
            db.SaveChanges();

            return(RedirectToAction("Index", "Events"));
        }
Example #15
0
        public IActionResult BookingEvent(int EventId, [FromBody] BookingInfo info)
        {
            var _BookingData = new EventBooking()
            {
                EventId    = EventId,
                NameFirst  = info.FirstName,
                NameMiddle = info.MiddleName,
                NameLast   = info.LastName,

                Email       = info.Email,
                PhoneNumber = info.Phone
            };

            var _return = _repo.Create(_BookingData);

            return(Ok(_return));
        }
        public HttpResponseMessage Delete(int id)
        {
            EventBooking eventBooking = db.EventBooking.FirstOrDefault(p => p.mb_ID == id);


            if (eventBooking != null)
            {
                db.EventBooking.Remove(eventBooking);
                db.SaveChanges();
            }
            var result = new
            {
                STATUS = true,
                MSG    = "刪除成功",
            };

            return(Request.CreateResponse(HttpStatusCode.OK, result));
        }
        // GET: EventBookings/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            EventBooking eventBooking = db.EventBookings.Find(id);

            if (eventBooking == null)
            {
                return(HttpNotFound());
            }
            ViewBag.Pay_Event_BookingID = new SelectList(db.payment_Booking, "Pay_Event_BookingID", "Payment_Type", eventBooking.Pay_Event_BookingID);
            ViewBag.EventTypeID         = new SelectList(db.EventTypes, "EventTypeID", "EventType1", eventBooking.EventTypeID);
            ViewBag.PaymentID           = new SelectList(db.Payments, "PaymentID", "Payment_Status", eventBooking.PaymentID);
            ViewBag.Service_Company_ID  = new SelectList(db.service_company, "Service_Company_ID", "Service_Company1", eventBooking.Service_Company_ID);
            ViewBag.servicetypeid       = new SelectList(db.serviceTypes, "ServiceTypeID", "ServiceType1", eventBooking.servicetypeid);
            ViewBag.Venue_ID            = new SelectList(db.Venues, "Venue_ID", "Venue_Name", eventBooking.Venue_ID);
            return(View(eventBooking));
        }
Example #18
0
        public async Task <EventBooking> AddEventBooking(EventBookingViewModel events, int eventId)
        {
            EventBooking itemCollections = null;

            try
            {
                itemCollections = new EventBooking
                {
                    EmailAddress = events.EmailAddress,
                    PhoneNumber  = events.PhoneNumber,
                    EventId      = eventId,
                };
                db.EventBookings.Add(itemCollections);
                await db.SaveChangesAsync();
            }
            catch (Exception ex)
            {
                //log.Error(ex.Message);
                throw ex;
            }
            return(itemCollections);
        }
        public static void Update(EventBooking item)
        {
            try
            {
                log.Debug("Update EventBundlePPABokingStatus Started. (" + item.SuperPNRNo + ")");

                SqlCommand command = new SqlCommand();
                if (command.Connection == null)
                {
                    command = dbADO.OpenConnection(command);
                }

                var UpdateEventBookingQuery = "EXEC EventMgt.usp_EventBookingUpdate @BookingID, @BookingStatusCode, @ModifiedByID";
                command.CommandText = UpdateEventBookingQuery;
                command.Parameters.Clear();

                #region SQL Parameter
                SqlParameter[] sqlParam = new SqlParameter[] {
                    new SqlParameter("BookingID", item.BookingID),
                    new SqlParameter("BookingStatusCode", "EXP"),
                    new SqlParameter("ModifiedByID", "0"),
                };
                #endregion

                command.Parameters.AddRange(sqlParam);

                dbADO.UpdateDataByStoredProcedure(command);

                command.Transaction.Commit();
                log.Debug("Update EventBundlePPABokingStatus Ended. (" + item.SuperPNRNo + ")");
            }
            catch (Exception ex)
            {
                log.Debug("Unable to complete update EventBundlePPABokingStatus. (" + item.SuperPNRNo + ") ---" + ex.ToString());
                throw ex;
            }
        }
Example #20
0
        protected void ProcessUpdatePartyCustomerResponse(TransactionalResponse result, EventBooking eventBooking, EventConfirmation confirmation)
        {
            try
            {
                if (IsSuccess(result) &&
                    result.TransactionResponses != null &&
                    result.TransactionResponses.Length != 0)
                {
                    confirmation.Result.Status = Status.Success;

                    var responses = result.TransactionResponses;

                    ProcessExigoApiResponse(typeof(UpdateCustomerResponse), responses, confirmation);

                    ProcessExigoApiResponse(typeof(SetCustomerSiteResponse), responses, confirmation);

                    ProcessExigoApiResponse(typeof(UpdateCustomerExtendedResponse), responses, confirmation);
                }
                else
                {
                    confirmation.Result.Status = Status.Failure;

                    ProcessWarnings(result, confirmation);
                    ProcessErrors(result, confirmation);
                }
            }
            catch (Exception ex)
            {
                if (Status.Success.Equals(confirmation.Result.Status))
                {
                    confirmation.Result.Errors.Add("Your event was updated but an unexpected error was encountered: " + ex.Message);
                }
                else
                {
                    confirmation.Result.Errors.Add("There was an unexpected error while updateing your event: " + ex.Message);
                }
            }
        }