/// <summary> /// /// </summary> /// <param name="od"></param> /// <returns></returns> public List <OrderDetails> AddTablesAndOrderBooking(OrderDetailsEntities od) { List <OrderDetails> oredrDetails = new List <OrderDetails>(); using (bookmytableEntities1 Context = new bookmytableEntities1()) { var result = Context.AddBookMyTableAndMenuOrder(od.HotelId, od.TableID, od.TotalQuantity, od.TotalAmount, od.IsPayed, od.ApprovalName, od.CustomerName, od.PhoneNumber, od.EmailID, od.City, od.Country, od.Address).ToList(); foreach (var menuItem in od.MenuList) { if (menuItem.MenuID != 0) { var result2 = Context.AddsalesOrderItemTable(od.HotelId, menuItem.MenuID, od.TableID, menuItem.ItemTotalAmount, result[0].OrderID, menuItem.Quantity, menuItem.MenuName); } } foreach (var item in result) { oredrDetails.Add(new OrderDetails { CustomerID = Convert.ToInt32(item.CustomerID), OrderID = Convert.ToInt32(item.OrderID), EmailID = od.EmailID //OrderPaymentID = Convert.ToInt32(item.OrderPaymentID), }); } if (!string.IsNullOrEmpty(od.EmailID)) { string subject = "Your reservation confirmation : " + oredrDetails[0].OrderID; string message = "Your order has been Succesfully placed"; //SendMailToCustomer(od.EmailID, message, subject); } }; return(oredrDetails); }
/// <summary> /// /// </summary> /// <param name="od"></param> /// <returns></returns> public List <OrderDetails> AddTablesAndOrderBooking(OrderDetailsEntities od) { List <OrderDetails> oredrDetails = new List <OrderDetails>(); using (bookmytableEntities Context = new bookmytableEntities()) { var result = Context.AddTableBookAndMenuOrder(od.HotelId, 1, od.TotalAmount, od.ApprovalName, od.CustomerName, od.PhoneNumber, od.EmailID, od.City, od.Country, od.Address).ToList(); foreach (var menuItem in od.MenuList) { var result2 = Context.AddOrderMenuDetails(od.HotelId, menuItem.MenuID, od.TotalAmount, result[0].OrderID, menuItem.Quantity, menuItem.MenuName); } foreach (var item in result) { oredrDetails.Add(new OrderDetails { CustomerID = Convert.ToInt32(item.CustomerID), OrderID = Convert.ToInt32(item.OrderID), OrderPaymentID = Convert.ToInt32(item.OrderPaymentID), }); } //od.EmailID = "*****@*****.**"; if (!string.IsNullOrEmpty(od.EmailID)) { string subject = "Your Order confirmation : " + oredrDetails[0].OrderID; string message = "Your order has been Succesfully placed </br> Your Total Amount : " + od.TotalAmount; SendMailToCustomer(od.EmailID, message, subject); } }; return(oredrDetails); }
public OrderDetails AddTablesAndOrderBooking(OrderDetailsEntities od) { OrderDetails oredrDetails = new OrderDetails(); using (bookmytableEntities Context = new bookmytableEntities()) { // var result = Context.AddTableBookAndMenuOrder().ToList(); }; return(oredrDetails); }
public List <OrderDetails> AddTablesAndOrderBooking(OrderDetailsEntities orderDetails) { List <OrderDetails> orderDetailsResponse = new List <OrderDetails>(); try { orderDetailsResponse = _repository.AddTablesAndOrderBooking(orderDetails); } catch (Exception ex) { throw ex; } return(orderDetailsResponse); }