public ShowInfo MakeBooking(string Paymentmode) { ShowInfo ticketInfo = null; int ShowId = Context.Session.GetInt32("ShowId").Value; int CustomerId = Context.Session.GetInt32("CustomerId").Value; string seats = Context.Session.GetString("seats"); string[] Seats = JsonConvert.DeserializeObject <string[]>(seats); BookingInformation obj = new BookingInformation(); obj.CustomerId = CustomerId; obj.Seatno = Seats; obj.ShowId = ShowId; obj.Paymentmode = Paymentmode; string json = JsonConvert.SerializeObject(obj); HttpContent content = new StringContent(json, Encoding.UTF8, "application/json"); HttpResponseMessage response = client.PostAsync("Booking/BookTickets", content).Result; if (response.IsSuccessStatusCode == true) { string ticketJson = response.Content.ReadAsStringAsync().Result; ticketInfo = JsonConvert.DeserializeObject <ShowInfo>(ticketJson); } return(ticketInfo); }
public async Task Get_ShouldRetrieve_BookingInformation_FromFormData_WhenStoredInCache() { var bookingInfo = new BookingInformation(); _mockDistributedCache.Setup(_ => _.GetString(It.Is <string>(_ => _.Equals("guid")))) .Returns(Newtonsoft.Json.JsonConvert.SerializeObject(new FormAnswers { FormData = new Dictionary <string, object> { { $"bookingQuestion{BookingConstants.APPOINTMENT_TYPE_SEARCH_RESULTS}", bookingInfo } } })); var element = new ElementBuilder() .WithType(EElementType.Booking) .WithQuestionId("bookingQuestion") .Build(); var page = new PageBuilder() .WithElement(element) .Build(); var result = await _service.Get("form", page, "guid"); Assert.IsType <BookingProcessEntity>(result); Assert.NotNull(result.BookingInfo); _mockDistributedCache.Verify(_ => _.GetString(It.Is <string>(_ => _.Equals("guid"))), Times.Once); }
public IActionResult BookTickets(BookingInformation bookingInformation) { BookingService1 obj = new BookingService1(); var ticketInfo = obj.BookTickets(bookingInformation); return(Ok(ticketInfo)); }
public ActionResult DeleteConfirmed(int id) { BookingInformation bookingInformation = db.BookingInformation.Find(id); db.BookingInformation.Remove(bookingInformation); db.SaveChanges(); return(RedirectToAction("Index")); }
public async Task ProcessMonthRequest(Dictionary <string, object> viewModel, FormSchema baseForm, Page currentPage, string guid) { if (!viewModel.ContainsKey(BookingConstants.BOOKING_MONTH_REQUEST)) { throw new ApplicationException("BookingService::ProcessMonthRequest, request for appointment did not contain requested month"); } var requestedMonth = DateTime.Parse(viewModel[BookingConstants.BOOKING_MONTH_REQUEST].ToString()); var currentDate = DateTime.Now; var bookingElement = currentPage.Elements .Where(_ => _.Type == EElementType.Booking) .FirstOrDefault(); if (requestedMonth.Month == currentDate.Month && requestedMonth.Year == currentDate.Year) { requestedMonth = currentDate; } if (requestedMonth > new DateTime(currentDate.Year, currentDate.Month, 1).AddMonths(bookingElement.Properties.SearchPeriod)) { throw new ApplicationException("BookingService::ProcessMonthRequest, Invalid request for appointment search, Start date provided is after allowed search period"); } if (requestedMonth < currentDate) { throw new ApplicationException("BookingService::ProcessMonthRequest, Invalid request for appointment search, Start date provided is before today"); } var bookingSearchResultsKey = $"{bookingElement.Properties.QuestionId}{BookingConstants.APPOINTMENT_TYPE_SEARCH_RESULTS}"; var appointmentTimes = await _bookingProviders.Get(bookingElement.Properties.BookingProvider) .GetAvailability(new AvailabilityRequest { StartDate = requestedMonth.Date, EndDate = requestedMonth.Date.LastDayOfTheMonth(), AppointmentId = bookingElement.Properties.AppointmentType, OptionalResources = bookingElement.Properties.OptionalResources }); var bookingInformationCacheKey = $"{bookingElement.Properties.QuestionId}{BookingConstants.APPOINTMENT_TYPE_SEARCH_RESULTS}"; var cachedAnswers = _distributedCache.GetString(guid); var convertedAnswers = JsonConvert.DeserializeObject <FormAnswers>(cachedAnswers); var cachedBookingInformation = JsonConvert.DeserializeObject <BookingInformation>(convertedAnswers.FormData[bookingInformationCacheKey].ToString()); var bookingInformation = new BookingInformation { Appointments = appointmentTimes, CurrentSearchedMonth = requestedMonth, FirstAvailableMonth = cachedBookingInformation.FirstAvailableMonth, IsFullDayAppointment = cachedBookingInformation.IsFullDayAppointment, AppointmentEndTime = cachedBookingInformation.AppointmentEndTime, AppointmentStartTime = cachedBookingInformation.AppointmentStartTime }; _pageHelper.SaveFormData(bookingSearchResultsKey, bookingInformation, guid, baseForm.BaseURL); }
public ActionResult Edit([Bind(Include = "BookingId,Arrivaldate,DepartureDate,RoomNo,Status,SumDays,ChildTotal,ChildWithFeeTotal,PersonQuantity,AllPersonTotal,AccommodationType,BoardType,Breakfast,Lunch,Dinner,InsertDateTime,UpdateDateTime")] BookingInformation bookingInformation) { if (ModelState.IsValid) { db.Entry(bookingInformation).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(bookingInformation)); }
public ShowInfo BookTickets(BookingInformation bookinginformation) { Bookingdetails obj = new Bookingdetails(); Shows obj1 = new Shows(); var showobj = (from s in context.Shows where s.ShowId == bookinginformation.ShowId select s).FirstOrDefault(); obj.Customerid = bookinginformation.CustomerId; obj.Showid = bookinginformation.ShowId; obj.Paymentmethod = bookinginformation.Paymentmode; obj.Paymentdate = DateTime.Now; obj.Totalprice = bookinginformation.Seatno.Length * (int)showobj.Price; obj.Paymenttime = new TimeSpan(DateTime.Now.Hour, DateTime.Now.Minute, DateTime.Now.Second); context.Bookingdetails.Add(obj); context.SaveChanges(); //-------------------------------------------------- Bookedseat temp; foreach (string seat in bookinginformation.Seatno) { temp = new Bookedseat() { Seatno = seat, Bookingid = obj.Bookingid }; context.Bookedseat.Add(temp); } showobj.BookedSeat += bookinginformation.Seatno.Length; context.SaveChanges(); var ticketNosForInvoice = (from b in context.Bookedseat where b.Bookingid == obj.Bookingid select b).ToArray(); var info = (from s in context.Shows join m in context.Multiplex on s.MultiplexId equals m.MultiplexId join h in context.MultiplexHall on m.MultiplexId equals h.MultiplexId where s.ShowId == showobj.ShowId select new ShowInfo() { MultiplexName = m.MultiplexName, HallName = h.HallName }).FirstOrDefault(); for (int i = 0; i < ticketNosForInvoice.Length; i++) { ticketNosForInvoice[i].Booking = null; } info.Seats = ticketNosForInvoice; var moviename = (from s in context.Shows join m in context.Movie on s.MovieId equals m.MovieId where s.ShowId == showobj.ShowId select m.MovieName).FirstOrDefault(); info.MovieName = moviename; return(info); }
protected void Page_Load(object sender, EventArgs e) { Label1.Text = Session["Name"].ToString(); FYPDataContext db = new FYPDataContext(); BookingInformation bk = new BookingInformation(); var chkdate = from x in db.BookingInformations where x.LawnName.Equals(Session["Name"].ToString()) select new { x.LawnName, x.UserName, x.Date }; grid1.DataSource = chkdate; grid1.DataBind(); }
public void BookingTest() { //Arrange BookingInformation book = new BookingInformation() { CustomerId = 8, ShowId = 1001, Paymentmode = "DC", }; var result = controller.BookTickets(book); Assert.IsInstanceOfType(result, typeof(OkObjectResult)); }
protected void Page_Load(object sender, EventArgs e) { if (IsPostBack) { FYPDataContext db = new FYPDataContext(); BookingInformation BookInf = new BookingInformation(); String date = txtDate.Text; DateTime now1 = Convert.ToDateTime(txtDate.Text); var checkdate = (from x in db.BookingInformations where x.Date.Equals(date) & x.LawnName.Equals(txtOrgName.Text) select x).FirstOrDefault(); DateTime now = DateTime.Now.Date; if (now1.Day <= now.Day && now1.Month <= now.Month && now1.Year <= now.Year) { ScriptManager.RegisterStartupScript(this, this.GetType(), "popup", "alert('You have selected OLD Date or Current Date. Please Select tomorrow or Onward Date');", true); } else if (checkdate != null) { ScriptManager.RegisterStartupScript(this, this.GetType(), "popup", "alert('This Date Already has been taken');", true); } } if (!IsPostBack) { if (Session["BookingUser"] == null) { Session["CurrentURL"] = "" + HttpContext.Current.Request.Url.AbsolutePath + ""; string ddddd = HttpContext.Current.Request.Url.AbsolutePath + HttpContext.Current.Request.Url.AbsolutePath; // Response.Redirect(Session["CurrentURL"].ToString()); // Server.Transfer("UserSignIn.aspx"); Response.Redirect("UserSignIn.aspx"); } FYPDataContext db = new FYPDataContext(); BookingInformation bookinfo = new BookingInformation(); var info = (from x in db.LawnOwners where x.Address.Equals(Session["CheckAvail"].ToString()) select x).FirstOrDefault(); txtOrgName.Text = info.LawnName; txtGuests.Text = info.SeatingCapacity; Session["LawnOwnerEmail"] = info.Email; Session["LawnIDs"] = info.Id; Session["LCapa"] = info.SeatingCapacity; } }
// GET: BookingInformation/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } BookingInformation bookingInformation = db.BookingInformation.Find(id); if (bookingInformation == null) { return(HttpNotFound()); } return(View(bookingInformation)); }
public void BookingNumberIsNull() { BookingInformation bookingInfo = new BookingInformation(); Booking booking = new Booking(); bookingInfo.Booking = booking; booking.BookingIdentifier = new BookingIdentifier(); booking.BookingIdentifier.BookingSystem = BookingSystem.Nurvis; booking.BookingIdentifier.SourceMarket = "DE"; var response = controller.Update(bookingInfo); Assert.AreEqual(response.StatusCode, HttpStatusCode.BadRequest); Assert.AreEqual(((System.Net.Http.ObjectContent)response.Content).Value, Constants.Messages.SourceKeyNotPresent); }
public void ActionThrowsException() { BookingInformation bookingInfo = new BookingInformation(); bookingInfo.Booking = bookingWithNmber; TestCrmService service = new TestCrmService(context); service.Switch = DataSwitch.ActionThrowsError; controller = new BookingController(bookingService, service); controller.Request = new System.Net.Http.HttpRequestMessage(); controller.Request.Properties.Add(HttpPropertyKeys.HttpConfigurationKey, new HttpConfiguration()); var response = controller.Update(bookingInfo); Assert.AreEqual(response.StatusCode, HttpStatusCode.InternalServerError); }
public HttpResponseMessage Update(BookingInformation bookingInfo) { try { var messages = bookingService.Validate(bookingInfo); if (messages != null && messages.Count != 0) { var message = bookingService.GetStringFrom(messages); Trace.TraceWarning(message); return(Request.CreateResponse(HttpStatusCode.BadRequest, message)); } var booking = bookingInfo.Booking; bookingService.ResolveReferences(booking); if (string.IsNullOrWhiteSpace(booking.BookingIdentifier.SourceMarket)) { Trace.TraceWarning(Constants.Messages.SourceMarketMissing); return(Request.CreateResponse(HttpStatusCode.BadRequest, Constants.Messages.SourceMarketMissing)); } if (string.IsNullOrWhiteSpace(booking.BookingGeneral.Currency)) { Trace.TraceWarning(Constants.Messages.CurrencyResolutionError); return(Request.CreateResponse(HttpStatusCode.BadRequest, Constants.Messages.CurrencyResolutionError)); } if (booking.Customer != null && booking.Customer.CustomerIdentifier != null) { if (string.IsNullOrWhiteSpace(booking.Customer.CustomerIdentifier.SourceMarket)) { Trace.TraceWarning(Constants.Messages.CustomerSourceMarketMissing); return(Request.CreateResponse(HttpStatusCode.BadRequest, Constants.Messages.CustomerSourceMarketMissing)); } } var jsonData = JsonConvert.SerializeObject(booking); var response = bookingService.Update(jsonData, crmService); if (response.Created) { return(Request.CreateResponse(HttpStatusCode.Created, response.Id)); } else { return(Request.CreateResponse(HttpStatusCode.NoContent, response.Id)); } } catch (Exception ex) { Trace.TraceError("Unexpected error Booking.Update::Message:{0}||Trace:{1}", ex.Message, ex.StackTrace.ToString()); return(Request.CreateResponse(HttpStatusCode.InternalServerError, ex.Message)); } }
public void BookingConsultationReferenceNotPresentForTCVCheck() { BookingInformation bookingInfo = new BookingInformation(); Booking booking = new Booking(); bookingInfo.Booking = booking; booking.BookingIdentifier = new BookingIdentifier(); booking.BookingIdentifier.BookingSystem = BookingSystem.Nurvis; booking.BookingIdentifier.SourceMarket = "DE"; booking.BookingIdentifier.BookingNumber = "123423"; booking.BookingIdentifier.SourceSystemId = SourceSystemId.TCV; var response = controller.Update(bookingInfo); Assert.AreEqual(response.StatusCode, HttpStatusCode.BadRequest); Assert.AreEqual(Constants.Messages.ConsultationReferenceNotPresent, ((System.Net.Http.ObjectContent)response.Content).Value); }
protected void Unnamed3_Click(object sender, EventArgs e) { if (Page.IsValid) { FYPDataContext db = new FYPDataContext(); BookingInformation bookinfo = new BookingInformation(); //var info = (from x in db.LawnOwners // where x.Address.Equals(Session["Booking"].ToString()) // select x).FirstOrDefault(); bookinfo.LawnID = Convert.ToInt32(Session["LawnIDs"].ToString()); bookinfo.CustomerID = Convert.ToInt32(Session["BookingUser"].ToString()); bookinfo.LawnName = txtOrgName.Text; bookinfo.UserName = txtUser.Text; bookinfo.CNIC = txtCNIC.Text; bookinfo.Capcaity = Convert.ToInt32(Session["LCapa"].ToString()); bookinfo.Contact_No = txtContact.Text; bookinfo.Date = Convert.ToDateTime(txtDate.Text); db.BookingInformations.InsertOnSubmit(bookinfo); db.SubmitChanges(); String EmailID = Session["LawnOwnerEmail"].ToString(); MailMessage msg = new MailMessage(); msg.From = new MailAddress("*****@*****.**"); msg.Bcc.Add("*****@*****.**"); msg.Bcc.Add("*****@*****.**"); msg.To.Add(EmailID); msg.Body = "Your banquet is booked on" + Convert.ToDateTime(txtDate.Text) + ". You will recieve Token Money in two Days"; msg.Subject = "IqraEventManagementSystem"; msg.IsBodyHtml = true; SmtpClient smtp = new SmtpClient(); smtp.Host = "smtp.gmail.com"; smtp.EnableSsl = true; System.Net.NetworkCredential Networkcard = new System.Net.NetworkCredential(); Networkcard.UserName = "******"; Networkcard.Password = "******"; smtp.DeliveryMethod = SmtpDeliveryMethod.Network; smtp.UseDefaultCredentials = true; smtp.Credentials = Networkcard; smtp.Port = 587; smtp.Send(msg); ScriptManager.RegisterStartupScript(this, this.GetType(), "popup", "alert('Booking Completed');", true); } }
public async Task ProcessBooking_Should_Return_CurrentPage_When_CheckYourBooking_IsTrue() { var bookingInfo = new BookingInformation(); _mockDistributedCache.Setup(_ => _.GetString(It.Is <string>(_ => _.Equals("guid")))) .Returns(Newtonsoft.Json.JsonConvert.SerializeObject(new FormAnswers { FormData = new Dictionary <string, object> { { $"bookingQuestion{BookingConstants.APPOINTMENT_TYPE_SEARCH_RESULTS}", bookingInfo } } })); var appointmentTypeGuid = new Guid(); var element = new ElementBuilder() .WithType(EElementType.Booking) .WithBookingProvider("testBookingProvider") .WithQuestionId("bookingQuestion") .WithAppointmentType(appointmentTypeGuid) .WithCheckYourBooking(true) .Build(); var page = new PageBuilder() .WithElement(element) .WithValidatedModel(true) .Build(); var formSchema = new FormSchemaBuilder() .WithBaseUrl("base-form") .Build(); var model = new Dictionary <string, object> { { $"{element.Properties.QuestionId}-{BookingConstants.APPOINTMENT_TYPE_SEARCH_RESULTS}", DateTime.Now.ToString() }, { $"{element.Properties.QuestionId}-{BookingConstants.APPOINTMENT_DATE}", DateTime.Now.ToString() }, { $"{element.Properties.QuestionId}-{BookingConstants.APPOINTMENT_START_TIME}", DateTime.Now.ToString() } }; var result = await _service.ProcessBooking(model, page, formSchema, "guid", "path"); _bookingProvider.Verify(_ => _.Reserve(It.IsAny <BookingRequest>()), Times.Never); _bookingProvider.Verify(_ => _.GetLocation(It.IsAny <LocationRequest>()), Times.Never); _mockPageHelper.Verify(_ => _.SaveAnswers(It.IsAny <Dictionary <string, object> >(), It.IsAny <string>(), It.IsAny <string>(), It.IsAny <IEnumerable <CustomFormFile> >(), It.IsAny <bool>(), It.IsAny <bool>()), Times.Once); _mockDistributedCache.Verify(_ => _.GetString(It.IsAny <string>()), Times.Never); _mockPageFactory.Verify(_ => _.Build(It.IsAny <Page>(), It.IsAny <Dictionary <string, object> >(), It.IsAny <FormSchema>(), It.IsAny <string>(), It.IsAny <FormAnswers>(), It.IsAny <List <object> >()), Times.Never); Assert.IsType <ProcessRequestEntity>(result); Assert.Equal("Index", result.RedirectAction); Assert.True(result.RedirectToAction); }
public void BookingIdentifierIsNull() { BookingInformation bookingInfo = new BookingInformation(); Booking booking = new Booking(); bookingInfo.Booking = booking; var response = controller.Update(bookingInfo); Collection <string> messages = new Collection <string>(); messages.Add(Constants.Messages.SourceKeyNotPresent); messages.Add(Constants.Messages.BookingSystemIsUnknown); messages.Add(Constants.Messages.SourceMarketMissing); var expectedMessage = bookingService.GetStringFrom(messages); Assert.AreEqual(HttpStatusCode.BadRequest, response.StatusCode); Assert.AreEqual(expectedMessage, ((System.Net.Http.ObjectContent)response.Content).Value); }
public void CustomerSourceMarketMissingCheck() { BookingInformation bookingInfo = new BookingInformation(); Booking booking = new Booking(); bookingInfo.Booking = booking; booking.BookingIdentifier = new BookingIdentifier(); booking.BookingIdentifier.BookingSystem = BookingSystem.Nurvis; booking.BookingIdentifier.SourceMarket = "DE"; booking.BookingIdentifier.BookingNumber = "123423"; booking.BookingIdentifier.SourceSystemId = SourceSystemId.OnTour; booking.Customer = new Customer(); booking.Customer.CustomerIdentifier = new CustomerIdentifier(); booking.Customer.CustomerIdentifier.CustomerId = "123"; var response = controller.Update(bookingInfo); Assert.AreEqual(response.StatusCode, HttpStatusCode.BadRequest); Assert.AreEqual(Constants.Messages.CustomerSourceMarketMissing, ((System.Net.Http.ObjectContent)response.Content).Value); }
public Collection <string> Validate(BookingInformation bookingInformation) { var validationMessages = new Collection <string>(); if (bookingInformation == null || bookingInformation.Booking == null) { validationMessages.Add(Constants.Messages.BookingDataPassedIsNullOrCouldNotBeParsed); return(validationMessages); } var booking = bookingInformation.Booking; if (booking.BookingIdentifier == null) { validationMessages.Add(Constants.Messages.SourceKeyNotPresent); validationMessages.Add(Constants.Messages.BookingSystemIsUnknown); validationMessages.Add(Constants.Messages.SourceMarketMissing); } else { if (string.IsNullOrWhiteSpace(booking.BookingIdentifier.BookingNumber)) { validationMessages.Add(Constants.Messages.SourceKeyNotPresent); } if (booking.BookingIdentifier.BookingSystem == BookingSystem.Unknown) { validationMessages.Add(Constants.Messages.BookingSystemIsUnknown); } if (string.IsNullOrWhiteSpace(booking.BookingIdentifier.SourceMarket)) { validationMessages.Add(Constants.Messages.SourceMarketMissing); } } if (booking.Customer != null && (booking.Customer.CustomerIdentifier == null || string.IsNullOrWhiteSpace(booking.Customer.CustomerIdentifier.CustomerId))) { validationMessages.Add(Constants.Messages.CustomerIdIsNull); } return(validationMessages); }
public ActionResult Booking(Guid?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Shipping model = db.Shippings.Find(id); //lay danh sach lich su booking var lstBookingHistory = model.ShippingBookings.OrderByDescending(n => n.CreatedAt); ViewBag.BookingHistory = lstBookingHistory; //lay danh sach so kien so kg tham khao var lstInformation = new List <BookingInformation>(); //lay danh sach tren duong var lstTrenDuong = db.Shipments.Where(n => n.AgencyId == user.Agency.Id && n.StatusId == -1); double counttracking = 0; double weigh = 0; foreach (var item in lstTrenDuong) { counttracking += item.AgencyPackages.Count(); weigh += item.AgencyPackages.Sum(n => n.Weigh).Value; } var infoTrenDuong = new BookingInformation() { Notes = "Trên đường", TrackingCount = counttracking, Weigh = weigh }; lstInformation.Add(infoTrenDuong); ViewBag.Weigh = weigh; ViewBag.TrackingCount = counttracking; counttracking = 0; weigh = 0; //lay danh sach luu kho va xuat kho //+ lay danh sach luu kho khong nam trong xuat kho var lstLuuKho = db.StorageJPs.Where(n => n.AgencyId == user.Agency.Id); lstLuuKho = lstLuuKho.Where(n => n.TrackingDetails.Where(k => db.ExportGoodDetails.Where(m => m.ExportGood.AgencyId == user.Agency.Id).Where(m => m.TrackingDetailId == k.Id).Count() == 0).Count() >= 0); weigh += lstLuuKho.Where(n => n.Weigh != null).Sum(n => n.Weigh).Value; counttracking += lstLuuKho.Count(); infoTrenDuong = new BookingInformation() { Notes = "Lưu kho", TrackingCount = counttracking, Weigh = weigh }; lstInformation.Add(infoTrenDuong); //+ lay dan sach xuat kho khong nam trong chuyen bay hoac chuyen bay chua thong quan var lstXuatKho = db.ExportGoods.Where(n => n.AgencyId == user.Agency.Id); //lay kien xuat kho co trong chuyen bay int ex_counttracking = 0; double ex_weigh = 0; var lstXuatKhoInFlight = lstXuatKho.Where(n => db.ShippingHAWBDetails.Where(m => m.AgencyId == user.Agency.Id).Where(m => m.ShippingHAWB.Shipping.StatusId == 14).Where(m => m.ExportGoodId == n.Id).Count() > 0); lstXuatKho = lstXuatKho.Where(n => lstXuatKhoInFlight.Where(m => m.Id == n.Id).Count() == 0); foreach (var item in lstXuatKho) { counttracking += item.ExportGoodDetails.Count(); ex_counttracking += item.ExportGoodDetails.Count(); } weigh += lstXuatKho.Where(n => n.Weigh != null).Sum(n => n.Weigh).Value; ex_weigh += lstXuatKho.Where(n => n.Weigh != null).Sum(n => n.Weigh).Value; //thong tin xuat kho infoTrenDuong = new BookingInformation() { Notes = "Xuất kho", TrackingCount = ex_counttracking, Weigh = ex_weigh }; lstInformation.Add(infoTrenDuong); //thong tin tong cong luu kho + xuat kho infoTrenDuong = new BookingInformation() { Notes = "Lưu kho & xuất kho chưa thông quan", TrackingCount = counttracking, Weigh = weigh }; lstInformation.Add(infoTrenDuong); ViewBag.Information = lstInformation; //lay trang thai cua booking var Status = lstBookingHistory == null || lstBookingHistory.Count() == 0 ? 11 : lstBookingHistory.First().StatusId; ViewBag.Status = Status; ViewBag.Count = lstBookingHistory.Count(); ViewBag.StatusId = new SelectList(StatusUtils.GetStatus(4), "Value", "Text", Status); return(View(model)); }
public bool UpdateBooking(BookingInformation b) { return(db.UpdateBooking(b)); }
public ActionResult Edit(BookingInformation booking, GuestInformation guest, Payments payment) { if (booking == null || guest == null || payment == null) { return(new HttpNotFoundResult()); } var updateBooking = db.BookingInformation.FirstOrDefault(i => i.BookingId == booking.BookingId); updateBooking.UpdateDateTime = DateTime.Now; updateBooking.Arrivaldate = booking.Arrivaldate; updateBooking.DepartureDate = booking.DepartureDate; updateBooking.Status = booking.Status; updateBooking.AccommodationType = booking.AccommodationType; updateBooking.AllPersonTotal = booking.AllPersonTotal; updateBooking.BoardType = booking.BoardType; updateBooking.Breakfast = booking.Breakfast; updateBooking.ChildTotal = booking.ChildTotal; updateBooking.ChildWithFeeTotal = booking.ChildWithFeeTotal; updateBooking.Dinner = booking.Dinner; updateBooking.Lunch = booking.Lunch; updateBooking.PersonQuantity = booking.PersonQuantity; updateBooking.RoomNo = booking.RoomNo; updateBooking.SumDays = booking.SumDays; var updateGuest = db.GuestInformation.FirstOrDefault(i => i.BookingId == guest.BookingId); updateGuest.UpdateDateTime = DateTime.Now; updateGuest.GuestAddress = guest.GuestAddress; updateGuest.GuestBirthDay = guest.GuestBirthDay; updateGuest.GuestCarPlate = guest.GuestCarPlate; updateGuest.GuestCity = guest.GuestCity; updateGuest.GuestCountry = guest.GuestCountry; updateGuest.GuestDistrict = guest.GuestDistrict; updateGuest.GuestEmail = guest.GuestEmail; updateGuest.GuestFatherName = guest.GuestFatherName; updateGuest.GuestGender = guest.GuestGender; updateGuest.GuestIdentNumber = guest.GuestIdentNumber; updateGuest.GuestIdentSerialNo = guest.GuestIdentSerialNo; updateGuest.GuestIdentType = guest.GuestIdentType; updateGuest.GuestMartialStatus = guest.GuestMartialStatus; updateGuest.GuestMotherName = guest.GuestMotherName; updateGuest.GuestName = guest.GuestName; updateGuest.GuestPhone = guest.GuestPhone; updateGuest.GuestRezervationNote = guest.GuestRezervationNote; updateGuest.GuestSurName = guest.GuestSurName; var updatePayment = db.Payments.FirstOrDefault(i => i.BookingId == payment.BookingId); updatePayment.UpdateDateTime = DateTime.Now; updatePayment.TotalPrice = payment.TotalPrice; updatePayment.BreakfastPrice = payment.BreakfastPrice; updatePayment.ChildFee = payment.ChildFee; updatePayment.ChildFeeTotal = payment.ChildFeeTotal; updatePayment.DailyGuestFee = payment.DailyGuestFee; updatePayment.DailyPersonPrice = payment.DailyPersonPrice; updatePayment.DinnerPrice = payment.DinnerPrice; updatePayment.DiscountPrice = payment.DiscountPrice; updatePayment.Extrasprice = payment.Extrasprice; updatePayment.LunchPrice = payment.LunchPrice; updatePayment.RoomPrice = payment.RoomPrice; updatePayment.TotalAccommodationFee = payment.TotalAccommodationFee; updatePayment.TotalBreakFastFee = payment.TotalBreakFastFee; updatePayment.TotalDinnerFee = payment.TotalDinnerFee; updatePayment.TotalLunchFee = payment.TotalLunchFee; updatePayment.TotalRoomFee = payment.TotalRoomFee; updatePayment.Totaldayspersonfee = payment.Totaldayspersonfee; db.SaveChanges(); return(Redirect("Index")); }
static void Main(string[] args) { Context _context = new Context(); DateTime tarih = DateTime.Now; BookingInformation bookinginf = new BookingInformation(); bookinginf.Arrivaldate = tarih; bookinginf.DepartureDate = tarih.AddDays(+1); bookinginf.InsertDateTime = tarih; bookinginf.UpdateDateTime = tarih; bookinginf.AllPersonTotal = 10; GuestInformation guestinf = new GuestInformation(); guestinf.GuestName = "Lemmy"; guestinf.GuestSurName = "Kilmester"; guestinf.GuestPhone = "5312232322"; guestinf.InsertDateTime = tarih; guestinf.UpdateDateTime = tarih; guestinf.GuestBirthDay = tarih; Payments pay = new Payments(); pay.InsertDateTime = tarih; pay.UpdateDateTime = tarih; pay.DailyGuestFee = 44.58; pay.TotalPrice = 60.88; _context.BookingInformation.Add(bookinginf); _context.GuestInformation.Add(guestinf); _context.Payments.Add(pay); _context.SaveChanges(); //Console.WriteLine("***************"); //Console.WriteLine("Kayıt Girildi!"); //Console.WriteLine("***************"); //var bknfgd = _context.BookingInformation.Include(g => g.GuestInformation).Include(p => p.Payments); //foreach (var item in bknfgd) //{ // foreach (var item2 in item.GuestInformation) // { // item2.GuestName; // } //} //var bookings = _context.BookingInformation // .Include(i => i.GuestInformation) // .Include(i => i.Payments) // .Select(i => new // { // i.BookingId, // i.Arrivaldate, // i.DepartureDate, // i.RoomNo, // i.AllPersonTotal, // i.GuestInformation, // i.Payments // }); var BookingsAll = (from Booking in _context.BookingInformation join Guest in _context.GuestInformation on Booking.BookingId equals Guest.BookingId join Payment in _context.Payments on Booking.BookingId equals Payment.BookingId select new { ID = Booking.BookingId, ArrivalDates = Booking.Arrivaldate, DepartureDates = Booking.DepartureDate, BookingInsertDate = Booking.InsertDateTime, BookingUpdateDate = Booking.UpdateDateTime, GuestTotal = Booking.AllPersonTotal, GuestNames = Guest.GuestName, GuestSurNames = Guest.GuestSurName, GuestInsertDate = Guest.InsertDateTime, GuestUpdateDate = Guest.UpdateDateTime, DailyGuestFees = Payment.DailyGuestFee, TotalFee = Payment.TotalPrice }).ToList(); foreach (var BookingsAllItem in BookingsAll) { Console.WriteLine("Misafir Numarası={0} Misafir Adı={1} Tutar={2}", BookingsAllItem.ID, BookingsAllItem.GuestNames, BookingsAllItem.TotalFee); } //var BookingsAll1 = _context.BookingInformation // .Include(i => i.GuestInformation) // .Include(i => i.Payments) // .ToList(); //int id = 0; //string name = ""; //double price = 0; //foreach (var BookingsAllItem in BookingsAll1) //{ // id = BookingsAllItem.BookingId; // foreach (var guest in BookingsAllItem.GuestInformation) // { // name = guest.GuestName; // } // foreach (var payment in BookingsAllItem.Payments) // { // price = payment.TotalPrice; // } //} //Console.WriteLine("Misafir Numarası={0} Misafir Adı={1} Tutar={2}", id, name, price); //var guests = con.GuestInformation.ToList(); //foreach (var guest in guests) //{ // Console.WriteLine("Misafir No={0} | Misafir Adı={1} | Misafir Soyadı={2}",guest.Id,guest.GuestName,guest.GuestSureName); //} //Console.WriteLine(" "); //Console.WriteLine("-----------------------------------"); //Console.WriteLine(" "); //var guest1 = con.GuestInformation.Find(4); //Console.WriteLine("Misaifir No:{0} | Misafir Adı:{1}",guest1.Id,guest1.GuestName); //if (guest1!=null) //{ // con.GuestInformation.Remove(guest1); //} //con.SaveChanges(); //Console.WriteLine(" "); //Console.WriteLine("Misafir Bilgisi Silindi!"); //Console.WriteLine(" "); //foreach (var guest in con.GuestInformation) //{ // Console.WriteLine("Misafir No={0} | Misafir Adı={1} | Misafir Soyadı={2}", guest.Id, guest.GuestName, guest.GuestSureName); //} //var guest = con.GuestInformation.Find(); //var pay = con.Payments.ToList(); //foreach (var payment in pay) //{ // Console.WriteLine("Fiyat No: {0} Günlük Fiyat:{1}", payment.Id, payment.DailyPersonPrice); //} //Console.WriteLine("-----------------------------------"); //foreach (var payment in pay) //{ // payment.DailyPersonPrice *= 1.25; // Console.WriteLine("Fiyat No: {0} Günlük Fiyat:{1}",payment.Id,payment.DailyPersonPrice); //} //con.SaveChanges(); //var payment = con.Payments.Find(2); //Console.WriteLine("Ödeme No: {2} Günlük Kişi Başı:{0} Toplam:{1}", payment.DailyPersonPrice, payment.TotalPrice, payment.Id); //payment.DailyPersonPrice /= 2; //payment.TotalPrice= payment.TotalPrice+(payment.TotalPrice * 1.5); //Console.WriteLine("Ödeme No: {2} Günlük Kişi Başı:{0} Toplam:{1}", payment.DailyPersonPrice, payment.TotalPrice, payment.Id); //con.SaveChanges(); //var guest1 = con.GuestInformation.Find(2); //Console.WriteLine("Misafir No:{0} Misafir Adı:{1} Misafir Soyadı:{2}",guest1.Id,guest1.GuestName,guest1.GuestSureName); //guest1.GuestName = "Şerafettin"; //guest1.GuestSureName = "Şahin"; //Console.WriteLine("Misafir No:{0} Misafir Adı:{1} Misafir Soyadı:{2}", guest1.Id, guest1.GuestName, guest1.GuestSureName); //con.SaveChanges(); //var guests = con.GuestInformation.ToList(); //foreach (var guest in guests) //{ // Console.WriteLine("Guest Id:{0} Guest Name:{1}", guest.Id, guest.GuestName ); //} //var bookings = con.BookingInformation.ToList(); //foreach (var booking in bookings) //{ // Console.WriteLine("Booking Id:{0}",booking.Id); //} //var payments = con.Payments.ToList(); //foreach (var payment in payments) //{ // Console.WriteLine("Payment Id:{0}",payment.Id); //} //DateTime tarih = DateTime.Now; //List<BookingInformation> bookings = new List<BookingInformation>() //{ // new BookingInformation() {PersonQuantity=1,SumDays=1,AllPersonTotal=1,Arrivaldate=tarih,DepartureDate=tarih,InsertDateTime=tarih,UpdateDateTime=tarih}, // //new BookingInformation() {PersonQuantity=1,SumDays=1,AllPersonTotal=1}, // //new BookingInformation() {PersonQuantity=3,SumDays=1,AllPersonTotal=3}, // //new BookingInformation() {PersonQuantity=4,SumDays=1,AllPersonTotal=4} //}; //foreach (var bookingslist in bookings) //{ // context.BookingInformation.Add(bookingslist); //} //List<Payments> payment = new List<Payments>() //{ // new Payments() {DailyPersonPrice=0, TotalPrice=0,InsertDateTime=tarih,UpdateDateTime=tarih}, // //new Payments() {DailyPersonPrice=200.0000,TotalPrice=200.0000}, // //new Payments() {DailyPersonPrice=300.0000,TotalPrice=300.0000}, // //new Payments() {DailyPersonPrice=150.0000,TotalPrice=150.0000} //}; //foreach (var paymentslist in payment) //{ // context.Payments.Add(paymentslist); //} //List<GuestInformation> guests = new List<GuestInformation>() //{ // new GuestInformation() {GuestName="Mehmet",GuestSureName="Ak",InsertDateTime=tarih,UpdateDateTime=tarih,GuestBirthDay=tarih}, // //new GuestInformation() {GuestName="Mehmet",GuestSureName="Ay"}, // //new GuestInformation() {GuestName="Ayşe",GuestSureName="YOK"}, // //new GuestInformation() {GuestName="Nebile",GuestSureName="Yim"} //}; //foreach (var guestslist in guests) //{ // context.GuestInformation.Add(guestslist); //} //context.SaveChanges(); //Console.WriteLine("-----------------------------------"); //Console.WriteLine("Ekleme Yapıldı!"); //Console.WriteLine("-----------------------------------"); //var guestss = context.GuestInformation.ToList(); //foreach (var guest in guestss) //{ // Console.WriteLine("Guest Id:{0} Guest Name:{1}", guest.GuestId, guest.GuestName); //} //var bookingss = context.BookingInformation.ToList(); //foreach (var booking in bookingss) //{ // Console.WriteLine("Booking Id:{0}", booking.BookingId); //} //var payments = context.Payments.ToList(); //foreach (var paymentt in payments) //{ // Console.WriteLine("Payment Id:{0}", paymentt.PaymentId); //} Console.ReadLine(); }
public ActionResult BookingInformation(BookingInformation objBookingInformation) { return(View("Information")); }
public ActionResult Information() { BookingInformation objBookingInformation = new BookingInformation(); return(View(objBookingInformation)); }
public async Task <BookingProcessEntity> Get(string baseUrl, Page currentPage, string guid) { var bookingElement = currentPage.Elements .Where(_ => _.Type == EElementType.Booking) .FirstOrDefault(); var appointmentTimes = new List <AvailabilityDayResponse>(); var bookingInformationCacheKey = $"{bookingElement.Properties.QuestionId}{BookingConstants.APPOINTMENT_TYPE_SEARCH_RESULTS}"; var cachedAnswers = _distributedCache.GetString(guid); if (cachedAnswers != null) { var convertedAnswers = JsonConvert.DeserializeObject <FormAnswers>(cachedAnswers); if (convertedAnswers.FormData.ContainsKey(bookingInformationCacheKey)) { var cachedBookingInformation = JsonConvert.DeserializeObject <BookingInformation>(convertedAnswers.FormData[bookingInformationCacheKey].ToString()); var cachedInfo = new List <object> { cachedBookingInformation }; return(new BookingProcessEntity { BookingInfo = cachedInfo }); } } var bookingProvider = _bookingProviders.Get(bookingElement.Properties.BookingProvider); var nextAvailability = await RetrieveNextAvailability(bookingElement, bookingProvider); if (nextAvailability.BookingHasNoAvailableAppointments) { return new BookingProcessEntity { BookingHasNoAvailableAppointments = true } } ; appointmentTimes = await bookingProvider.GetAvailability(new AvailabilityRequest { StartDate = nextAvailability.DayResponse.Date, EndDate = nextAvailability.DayResponse.Date.LastDayOfTheMonth(), AppointmentId = bookingElement.Properties.AppointmentType, OptionalResources = bookingElement.Properties.OptionalResources }); var bookingInformation = new BookingInformation { Appointments = appointmentTimes, CurrentSearchedMonth = new DateTime(nextAvailability.DayResponse.Date.Year, nextAvailability.DayResponse.Date.Month, 1), FirstAvailableMonth = new DateTime(nextAvailability.DayResponse.Date.Year, nextAvailability.DayResponse.Date.Month, 1), IsFullDayAppointment = nextAvailability.DayResponse.IsFullDayAppointment }; if (nextAvailability.DayResponse.IsFullDayAppointment) { bookingInformation.AppointmentStartTime = DateTime.Today.Add(nextAvailability.DayResponse.AppointmentTimes.First().StartTime); bookingInformation.AppointmentEndTime = DateTime.Today.Add(nextAvailability.DayResponse.AppointmentTimes.First().EndTime); } _pageHelper.SaveFormData(bookingInformationCacheKey, bookingInformation, guid, baseUrl); var bookingInfo = new List <object> { bookingInformation }; return(new BookingProcessEntity { BookingInfo = bookingInfo }); }
partial void DeleteBookingInformation(BookingInformation instance);
partial void UpdateBookingInformation(BookingInformation instance);
partial void InsertBookingInformation(BookingInformation instance);