private void InsertParentTableData() { try { if (Session["UserCode"] != null) { blsr._iAgentId = Convert.ToInt32(Session["UserCode"].ToString()); } else { blsr._iAgentId = Convert.ToInt32(Session["CustId"].ToString()); } blsr.action = "GetDepartureDetails"; blsr._iBookingId = 0; blsr.PackageId = Session["PackageId"].ToString(); dtGetReturnedData = dlsr.GetDepartureDetails(blsr); blsr._sBookingRef = Session["BookingRef"].ToString(); blsr._dtStartDate = Convert.ToDateTime(dtGetReturnedData.Rows[0]["CheckInDate"]); blsr._dtEndDate = Convert.ToDateTime(dtGetReturnedData.Rows[0]["CheckOutDate"]); blsr._iAccomTypeId = Convert.ToInt32(dtGetReturnedData.Rows[0]["AccomTypeId"]); blsr._iAccomId = Convert.ToInt32(dtGetReturnedData.Rows[0]["AccomId"]); blsr._iNights = Convert.ToInt32(dtGetReturnedData.Rows[0]["NoOfNights"]); DataTable dtRoomBookingDetails = SessionServices.RetrieveSession <DataTable>("BookedRooms"); blsr._iPersons = Convert.ToInt32(dtRoomBookingDetails.Compute("SUM(Pax)", string.Empty)); blsr._BookingStatusId = 1; blsr._SeriesId = 0; blsr._proposedBooking = false; blsr._chartered = false; Session.Add("tblBookingBAL", blsr); int iBRC = dlsr.GetBookingReferenceCount(blsr); if (iBRC > 0) { System.Web.UI.ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "AlertBox", "alert('The Booking Reference mentioned by you is not unique. Please enter a different reference number.');", true); return; } int GetQueryResponse = dlsr.AddParentBookingDetail(blsr); } catch { } }
private int InsertBookingTableData(int acmid, int acmtpid, int agid, string bkref, DateTime cin, DateTime cout) { try { BALBooking blsr = new BALBooking(); DALBooking dlsr = new DALBooking(); DataTable dtbkdetails = SessionServices.RetrieveSession <DataTable>("Bookingdt"); blsr._sBookingRef = bkref; blsr._dtStartDate = cin; blsr._dtEndDate = cout; if (Session["CustId"] != null && Session["UserCode"] == null) { blsr.CustomerId = Session["CustId"].ToString(); } else { blsr.CustomerId = "0"; } blsr._iAccomTypeId = acmtpid; blsr._iAccomId = acmid; blsr._iAgentId = agid; blsr._iNights = Convert.ToInt32((cout - cin).TotalDays); blsr._iPersons = Convert.ToInt32(dtbkdetails.Compute("SUM(Pax)", string.Empty)); blsr._BookingStatusId = 1; blsr._SeriesId = 0; blsr._proposedBooking = false; blsr._chartered = false; blsr._BookingStatusId = (int)BookingStatusTypes.BOOKED; blsr._proposedBooking = true; int bookingId = dlsr.AddParentBookingDetail(blsr); var bookingDetails = dlsr.GetBookingDetails(bookingId); if (bookingDetails != null) { blsr.BookingCode = bookingDetails.BookingCode; } blsr._iBookingId = bookingId; //Session["tblBookingBAL"] = blsr; SessionServices.SaveSession <BALBooking>("tblBookingBAL", blsr); return(bookingId); } catch (Exception ex) { throw ex; } }
public int InsertParentTableData(string packageid, DateTime chekindate, DateTime checkoutdate, int pax, string bRef, int Agentid) { BALBooking blsr = new BALBooking(); DALBooking dlsr = new DALBooking(); try { //blsr._iAgentId = 247; blsr._iAgentId = Agentid; blsr.CustomerId = "0"; blsr.action = "GetDepartureDetails"; blsr._iBookingId = 0; blsr.PackageId = packageid; DataTable dtDepartureDetails = dlsr.GetDepartureDetails(blsr); DateTime startDate = chekindate; DataRow packageRow = null; foreach (DataRow row in dtDepartureDetails.Rows) { if (DateTime.Compare(Convert.ToDateTime(row["CheckInDate"]), startDate) == 0) { packageRow = row; break; } } if (packageRow == null) { return(-1); } blsr._iPersons = pax; blsr._sBookingRef = bRef; blsr._dtStartDate = Convert.ToDateTime(packageRow["CheckInDate"]); blsr._dtEndDate = checkoutdate; blsr._iAccomTypeId = Convert.ToInt32(packageRow["AccomTypeId"]); blsr._iAccomId = Convert.ToInt32(packageRow["AccomId"]); blsr._iNights = Convert.ToInt32(packageRow["NoOfNights"]); blsr._BookingStatusId = (int)BookingStatusTypes.BOOKED; //This is a proposed booking and it will be marked as booked on the next page once the payment is received. blsr._SeriesId = 0; blsr._proposedBooking = true; blsr._chartered = false; //Session.Add("tblBookingBAL", blsr); //SessionServices.SaveSession<BALBooking>("tblBookingBAL", blsr); int iBRC = dlsr.GetBookingReferenceCount(blsr); if (iBRC > 0) { //System.Web.UI.ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "AlertBox", "alert('The Booking Reference mentioned by you is not unique. Please enter a different reference number.');", true); return(-1); } int bookingId = dlsr.AddParentBookingDetail(blsr); //var bookingDetails = dlsr.GetBookingDetails(bookingId); //if (bookingDetails != null) //{ // blsr.BookingCode = bookingDetails.BookingCode; //} blsr._iBookingId = bookingId; //SessionServices.SaveSession<BALBooking>("tblBookingBAL", blsr); return(bookingId); } catch { throw; } }