public IActionResult BookingApproval(BillingModel BillingModel, string submit) { string value = string.Empty; if (string.IsNullOrEmpty(BillingModel.BookingNo)) { return(RedirectToAction("AllBookings", "ShowBookingDetails")); } if (submit == "Approve") { value = "A"; } else if (submit == "Reject") { value = "R"; } else { value = "P"; } var result = _IBookingVenue.UpdateBookingStatus(BillingModel.BookingNo, value); if (result > 0) { if (submit == "Approve") { TempData["StatusMessage"] = BillingModel.BookingNo + "has been Approved"; } else if (submit == "Reject") { TempData["StatusMessage"] = BillingModel.BookingNo + "has been Cancelled"; } var detailsBooking = _ITotalbilling.GetBillingDetailsbyBookingNo(BillingModel.BookingNo); return(View(detailsBooking)); } else { var detailsBooking = _ITotalbilling.GetBillingDetailsbyBookingNo(BillingModel.BookingNo); return(View(detailsBooking)); } }
public IActionResult BookFlower(BookingFlower bookingflower) { try { if (!ModelState.IsValid) { return(View("BookFood", bookingflower)); } if (bookingflower != null && bookingflower.FlowerList != null) { var result = 0; var validateChecked = 0; for (int i = 0; i < bookingflower.FlowerList.Count(); i++) { if (bookingflower.FlowerList[i].FlowerChecked) { validateChecked = 1; BookingFlower objbookingflower = new BookingFlower() { FlowerID = Convert.ToInt32(bookingflower.FlowerList[i].FlowerID), BookingID = Convert.ToInt32(HttpContext.Session.GetInt32("BookingID")), Createdby = Convert.ToInt32(HttpContext.Session.GetString("UserID")), CreatedDate = DateTime.Now }; result = _IBookFlower.BookFlower(objbookingflower); if (result > 0) { _IBookingVenue.UpdateBookingStatus(Convert.ToInt32(HttpContext.Session.GetInt32("BookingID"))); } } } if (validateChecked == 0) { ModelState.AddModelError("", "You have not choose any Flower !"); } SetSlider(); if (result > 0) { ModelState.Clear(); ViewData["BookingFlowerMessage"] = "Flower Booked Successfully"; return(View("Success")); } else { return(View("BookFlower", bookingflower)); } } else { return(View("BookFlower", bookingflower)); } } catch (Exception) { throw; } }
public IActionResult BookingApproval(BillingModel BillingModel, string submit) { var BookingUser = (from BD in _context.BookingDetails join uid in _context.Registration on BD.Createdby equals uid.ID where BD.BookingNo == BillingModel.BookingNo select new { BD.BookingNo, BD.BookingDate, BD.BookingID, uid.Name, uid.EmailID }).Single(); var message = new MimeMessage(); message.From.Add(new MailboxAddress("Dream Weeding", "*****@*****.**")); message.To.Add(new MailboxAddress(BookingUser.Name, BookingUser.EmailID)); //message.Subject = "Event Booking Approved"; //message.Body = new TextPart("plain") //{ // Text = "Your Booking Application is Approved!" //}; string value = string.Empty; if (string.IsNullOrEmpty(BillingModel.BookingNo)) { return(RedirectToAction("AllBookings", "ShowBookingDetails")); } if (submit == "Approve") { message.Subject = "Event Booking Approved"; message.Body = new TextPart("plain") { Text = "Dear " + BookingUser.Name + ",\n" + "Your Booking Application is Approved!" + "\n\n" + "Thank you for being with us, Dream Weeding!" }; using (var client = new SmtpClient()) { client.Connect("smtp.gmail.com", 587, false); client.Authenticate("*****@*****.**", "saiful002528"); client.Send(message); client.Disconnect(true); } value = "A"; } else if (submit == "Reject") { message.Subject = "Event Booking Rejected!"; message.Body = new TextPart("plain") { Text = "Dear " + BookingUser.Name + ",\n" + "Your Booking Application is Rejected!" + "\n\n" + "Thank you for being with us, Dream Weeding!" }; using (var client = new SmtpClient()) { client.Connect("smtp.gmail.com", 587, false); client.Authenticate("*****@*****.**", "saiful002528"); client.Send(message); client.Disconnect(true); } value = "R"; } else { value = "P"; } var result = _IBookingVenue.UpdateBookingStatus(BillingModel.BookingNo, value); if (result > 0) { if (submit == "Approve") { TempData["StatusMessage"] = BillingModel.BookingNo + " has been Approved"; } else if (submit == "Reject") { TempData["StatusMessage"] = BillingModel.BookingNo + " has been Cancelled"; } var detailsBooking = _ITotalbilling.GetBillingDetailsbyBookingNo(BillingModel.BookingNo); return(View(detailsBooking)); } else { var detailsBooking = _ITotalbilling.GetBillingDetailsbyBookingNo(BillingModel.BookingNo); return(View(detailsBooking)); } }