public long BookRoom(RoomReservationDTO arr_arr) { long ll_bookingId; ll_bookingId = 0; try { if (arr_arr.GuestName == null || arr_arr.GuestName.Trim().Length == 0) { throw new Exception("El nombre del huesped es obligatorio"); } if (arr_arr.RoomNumber == 0) { throw new Exception("El numero de la habitación es obligatorio"); } if (arr_arr.CheckIn == null) { throw new Exception("El check-in es obligatorio"); } if (arr_arr.CheckOut == null) { throw new Exception("El check-out es obligatorio"); } if (arr_arr.Hotel == null || arr_arr.Hotel.Trim().Length == 0) { throw new Exception("El hotel es obligatorio"); } IHiltonBookingServiceDAL lhbsDAL_hbsDAL; lhbsDAL_hbsDAL = new HiltonBookingServiceDAL(); ll_bookingId = lhbsDAL_hbsDAL.BookRoom(arr_arr); } catch (Exception ae_e) { Exception le_e; le_e = ae_e.InnerException != null ? ae_e.InnerException : ae_e; ll_bookingId = -1; Common.CreateTrace.WriteLog(Common.CreateTrace.LogLevel.Error, "ERROR EN EL SERVICIO HiltonBookingService BookRoom"); Common.CreateTrace.WriteLog(Common.CreateTrace.LogLevel.Error, " :: " + ae_e.Message); throw ae_e; } return(ll_bookingId); }
public bookRoomResponse BookRoom(bookRoomRequest abrr_brr) { bookRoomResponse lbrr_response; lbrr_response = new bookRoomResponse(); lbrr_response.Body = new bookRoomResponseBody(); lbrr_response.Body.Status = new services.hilton.com.types.Status(); try { RoomReservationDTO lrr_rr; IHiltonBookingServiceBusiness lhbsb_hbsb; long ll_bookingId; lrr_rr = new RoomReservationDTO(); lrr_rr.GuestName = abrr_brr.Body.RoomReservation.guestName; lrr_rr.RoomNumber = abrr_brr.Body.RoomReservation.roomNumber; lrr_rr.CheckIn = abrr_brr.Body.RoomReservation.checkin; lrr_rr.CheckOut = abrr_brr.Body.RoomReservation.checkout; lrr_rr.Hotel = abrr_brr.Body.RoomReservation.hotel; lhbsb_hbsb = new HiltonBookingServiceBusiness(); ll_bookingId = lhbsb_hbsb.BookRoom(lrr_rr); if (ll_bookingId > 0) { lbrr_response.Body.Status.codeError = "0"; lbrr_response.Body.Status.message = ""; lbrr_response.Body.result = true; lbrr_response.Body.bookingId = ll_bookingId.ToString(); } else { lbrr_response.Body.Status.codeError = "01"; lbrr_response.Body.Status.message = "Error en la reserva"; lbrr_response.Body.result = false; } } catch (Exception ae_e) { Exception le_e; le_e = ae_e.InnerException != null ? ae_e.InnerException : ae_e; lbrr_response.Body.Status.codeError = "01"; lbrr_response.Body.Status.message = "Error en la ejecución del servicio:" + ae_e.Message; lbrr_response.Body.result = false; Common.CreateTrace.WriteLog(Common.CreateTrace.LogLevel.Error, "ERROR EN EL SERVICIO HiltonBookingService:BookRoom"); Common.CreateTrace.WriteLog(Common.CreateTrace.LogLevel.Error, " :: " + ae_e.Message); } return(lbrr_response); }
public long BookRoom(RoomReservationDTO arr_arr) { long ll_bookingId; ll_bookingId = 0; try { SqlParameter lsp_parameter; List <SqlParameter> llsp_parameters; DataSet lds_data; lsp_parameter = new SqlParameter("@GuestName", DbType.String); lsp_parameter.Value = arr_arr.GuestName; llsp_parameters = new List <SqlParameter>(); llsp_parameters.Add(lsp_parameter); lsp_parameter = new SqlParameter("@roomNumer", DbType.Int16); lsp_parameter.Value = arr_arr.RoomNumber; llsp_parameters.Add(lsp_parameter); lsp_parameter = new SqlParameter("@checkIN", DbType.Date); lsp_parameter.Value = arr_arr.CheckIn; llsp_parameters.Add(lsp_parameter); lsp_parameter = new SqlParameter("@ChecOUT", DbType.Date); lsp_parameter.Value = arr_arr.CheckOut; llsp_parameters.Add(lsp_parameter); lsp_parameter = new SqlParameter("@Hotel", DbType.String); lsp_parameter.Value = arr_arr.Hotel; llsp_parameters.Add(lsp_parameter); lds_data = GetDataBaseHelper().ExecuteProcedureToDataSet("BookRoom", llsp_parameters); if (lds_data != null && lds_data.Tables.Count > 0) { foreach (DataRow ldr_temp in lds_data.Tables[0].Rows) { ll_bookingId = Convert.ToInt64(ldr_temp["CodReserva"]); } } } catch (Exception ae_e) { Exception le_e; le_e = ae_e.InnerException != null ? ae_e.InnerException : ae_e; ll_bookingId = -1; Common.CreateTrace.WriteLog(Common.CreateTrace.LogLevel.Error, "ERROR EN EL SERVICIO HiltonBookingServiceDAL:BookRoom"); Common.CreateTrace.WriteLog(Common.CreateTrace.LogLevel.Error, " :: " + ae_e.Message); } return(ll_bookingId); }