public static bool checkIsMustBeCancelled(int bookingId) { SqlCommand command = new SqlCommand(); command.CommandText = "PUNTO_ZIP.sp_estadia_cancel_is_after_date_check_in"; command.Parameters.AddWithValue("@p_stay_booking_id", bookingId); command.Parameters.Add(new SqlParameter("@p_system_date", SqlDbType.DateTime)); command.Parameters["@p_system_date"].Value = VarGlobal.FechaHoraSistema; var returnParameterHotel = command.Parameters.Add(new SqlParameter("@p_stay_change_to_cancel", SqlDbType.Bit)); returnParameterHotel.Direction = ParameterDirection.InputOutput; ProcedureHelper.execute(command, "cancel if checkin past", false); Int16 isCancel = Convert.ToInt16(returnParameterHotel.Value); if (isCancel != 0) { return(true); } else { return(false); } }
public static Boolean existFullStay(int bookingId) { SqlCommand command = new SqlCommand(); command.CommandText = "PUNTO_ZIP.sp_estadia_exist_full_stay"; command.Parameters.AddWithValue("@p_stay_booking_id", bookingId); var returnParameterExistFullStay = command.Parameters.Add(new SqlParameter("@p_stay_exist_full_stay", SqlDbType.Bit)); returnParameterExistFullStay.Direction = ParameterDirection.InputOutput; ProcedureHelper.execute(command, "check if checkin and checkout was release", false); Int16 existFullStay = Convert.ToInt16(returnParameterExistFullStay.Value); if (existFullStay != 0) { return(true); } else { return(false); } }
public static Boolean closePeriod(int hotelId, Period period) { SqlCommand sp_hotel_close_period_valid = new SqlCommand(); sp_hotel_close_period_valid.CommandType = CommandType.StoredProcedure; sp_hotel_close_period_valid.CommandText = "PUNTO_ZIP.sp_hotel_close_period_valid"; var returnParameterAddOk = sp_hotel_close_period_valid.Parameters.Add(new SqlParameter("@p_add_ok", SqlDbType.Int)); returnParameterAddOk.Direction = ParameterDirection.InputOutput; sp_hotel_close_period_valid.Parameters.AddWithValue("@p_user_id", VarGlobal.usuario.id); sp_hotel_close_period_valid.Parameters.AddWithValue("@p_hotel_id", hotelId); sp_hotel_close_period_valid.Parameters.AddWithValue("@p_hotel_close_period_from", period.from); sp_hotel_close_period_valid.Parameters.AddWithValue("@p_hotel_close_period_to", period.to); sp_hotel_close_period_valid.Parameters.AddWithValue("@p_hotel_close_period_motive", period.motive); ProcedureHelper.execute(sp_hotel_close_period_valid, "check down period", false); Int16 enable = Convert.ToInt16(returnParameterAddOk.Value); if (enable != 0) { return(true); } else { return(false); } }
public static Int32 save(Cliente clientData) { SqlCommand sp_save_or_update_client = new SqlCommand(); sp_save_or_update_client.CommandType = CommandType.StoredProcedure; sp_save_or_update_client.CommandText = "PUNTO_ZIP.sp_client_save_update"; var returnParameterClientId = sp_save_or_update_client.Parameters.Add(new SqlParameter("@p_client_id", SqlDbType.Int)); returnParameterClientId.Direction = ParameterDirection.InputOutput; sp_save_or_update_client.Parameters["@p_client_id"].Value = clientData.id; sp_save_or_update_client.Parameters.AddWithValue("@p_client_name", clientData.name); sp_save_or_update_client.Parameters.AddWithValue("@p_client_lastname", clientData.lastname); sp_save_or_update_client.Parameters.AddWithValue("@p_client_type_document", clientData.typeDocument); sp_save_or_update_client.Parameters.AddWithValue("@p_client_document_number", clientData.documentNumber); sp_save_or_update_client.Parameters.AddWithValue("@p_client_mail", clientData.mail); sp_save_or_update_client.Parameters.AddWithValue("@p_client_telephone", clientData.telephone); sp_save_or_update_client.Parameters.AddWithValue("@p_client_address_name", clientData.addressName); sp_save_or_update_client.Parameters.AddWithValue("@p_client_address_number", clientData.addressNum); if (clientData.addressFloor != VarGlobal.NoAddressFloor) { sp_save_or_update_client.Parameters.AddWithValue("@p_client_address_floor", clientData.addressFloor); sp_save_or_update_client.Parameters.AddWithValue("@p_client_address_dept", clientData.adressDeptName); } sp_save_or_update_client.Parameters.AddWithValue("@p_client_nationality", clientData.nacionality); sp_save_or_update_client.Parameters.AddWithValue("@p_client_birthdate", clientData.birthdate); ProcedureHelper.execute(sp_save_or_update_client, "save or update client data", false); return(Convert.ToInt32(returnParameterClientId.Value)); }
public static Boolean existUser(string user) { SqlCommand sp_check_user = new SqlCommand(); sp_check_user.CommandText = "PUNTO_ZIP.sp_login_check_valid_user"; sp_check_user.Parameters.Add(new SqlParameter("@p_id", SqlDbType.VarChar)); sp_check_user.Parameters["@p_id"].Value = user; var returnParameterIsValid = sp_check_user.Parameters.Add(new SqlParameter("@p_is_valid", SqlDbType.Bit)); returnParameterIsValid.Direction = ParameterDirection.InputOutput; ProcedureHelper.execute(sp_check_user, "chequear usuario valido", false); int isValid = Convert.ToInt16(returnParameterIsValid.Value); if (isValid == 1) { return(true); } else { return(false); } }
public static Boolean isBefore(Int32 bookingId) { SqlCommand command = new SqlCommand(); command.CommandText = "PUNTO_ZIP.sp_estadia_booking_is_before"; command.Parameters.AddWithValue("@p_stay_booking_id", bookingId); command.Parameters.AddWithValue("@p_stay_hotel_id", VarGlobal.usuario.hotel); command.Parameters.Add(new SqlParameter("@p_system_date", SqlDbType.DateTime)); command.Parameters["@p_system_date"].Value = VarGlobal.FechaHoraSistema; var returnParameterBefore = command.Parameters.Add(new SqlParameter("@p_stay_booking_before", SqlDbType.Bit)); returnParameterBefore.Direction = ParameterDirection.InputOutput; ProcedureHelper.execute(command, "check if booking before", false); Int16 isBefore = Convert.ToInt16(returnParameterBefore.Value); if (isBefore != 0) { return(true); } else { return(false); } }
public static Boolean isCancel(Int32 bookingId) { SqlCommand command = new SqlCommand(); command.CommandText = "PUNTO_ZIP.sp_estadia_booking_is_cancel"; command.Parameters.AddWithValue("@p_stay_booking_id", bookingId); command.Parameters.AddWithValue("@p_stay_hotel_id", VarGlobal.usuario.hotel); var returnParameterCancel = command.Parameters.Add(new SqlParameter("@p_stay_booking_cancel", SqlDbType.Bit)); returnParameterCancel.Direction = ParameterDirection.InputOutput; ProcedureHelper.execute(command, "check if booking cancel", false); Int16 isCancel = Convert.ToInt16(returnParameterCancel.Value); if (isCancel != 0) { return(true); } else { return(false); } }
public static Int32 save(Hotel hotelData) { SqlCommand sp_save_or_update_hotel = new SqlCommand(); sp_save_or_update_hotel.CommandType = CommandType.StoredProcedure; sp_save_or_update_hotel.CommandText = "PUNTO_ZIP.sp_hotel_save_update"; var returnParameterHotelId = sp_save_or_update_hotel.Parameters.Add(new SqlParameter("@p_hotel_id", SqlDbType.Int)); returnParameterHotelId.Direction = ParameterDirection.InputOutput; sp_save_or_update_hotel.Parameters["@p_hotel_id"].Value = hotelData.id; sp_save_or_update_hotel.Parameters.AddWithValue("@p_user_id", VarGlobal.usuario.id); sp_save_or_update_hotel.Parameters.AddWithValue("@p_user_rol_id", VarGlobal.usuario.rol.id); sp_save_or_update_hotel.Parameters.AddWithValue("@p_hotel_name", hotelData.name); sp_save_or_update_hotel.Parameters.AddWithValue("@p_hotel_mail", hotelData.mail); sp_save_or_update_hotel.Parameters.AddWithValue("@p_hotel_address", hotelData.address); sp_save_or_update_hotel.Parameters.AddWithValue("@p_hotel_address_number", hotelData.addressNumber); sp_save_or_update_hotel.Parameters.AddWithValue("@p_hotel_telephone", hotelData.telephone); sp_save_or_update_hotel.Parameters.AddWithValue("@p_hotel_city", hotelData.city); sp_save_or_update_hotel.Parameters.AddWithValue("@p_hotel_country", hotelData.country); sp_save_or_update_hotel.Parameters.AddWithValue("@p_hotel_star", hotelData.star); sp_save_or_update_hotel.Parameters.AddWithValue("@p_hotel_creation", hotelData.creation); ProcedureHelper.execute(sp_save_or_update_hotel, "save or update hotel data", false); return(Convert.ToInt32(returnParameterHotelId.Value)); }
public static int fillHotelByUser(Usuario user) { SqlCommand sp_rol_exist_one_by_user = new SqlCommand(); sp_rol_exist_one_by_user.CommandText = "PUNTO_ZIP.sp_hotel_exist_one_by_user"; sp_rol_exist_one_by_user.Parameters.Add(new SqlParameter("@p_id", SqlDbType.VarChar)); sp_rol_exist_one_by_user.Parameters["@p_id"].Value = user.id; sp_rol_exist_one_by_user.Parameters.Add(new SqlParameter("@p_id_rol", SqlDbType.Int)); sp_rol_exist_one_by_user.Parameters["@p_id_rol"].Value = user.rol.id; var returnParameterCountHotel = sp_rol_exist_one_by_user.Parameters.Add(new SqlParameter("@p_count_hotel", SqlDbType.Int)); returnParameterCountHotel.Direction = ParameterDirection.InputOutput; var returnParameterIdHotel = sp_rol_exist_one_by_user.Parameters.Add(new SqlParameter("@p_id_hotel", SqlDbType.Int)); returnParameterIdHotel.Direction = ParameterDirection.InputOutput; var returnParameterHotelDesc = sp_rol_exist_one_by_user.Parameters.Add(new SqlParameter("@p_hotel_desc", SqlDbType.VarChar, 255)); returnParameterHotelDesc.Direction = ParameterDirection.InputOutput; ProcedureHelper.execute(sp_rol_exist_one_by_user, "chequear si un usuario tiene un solo hotel asignado", false); int countHotel = Convert.ToInt16(returnParameterCountHotel.Value); if (countHotel == 1) { int id = Convert.ToInt16(returnParameterIdHotel.Value); user.hotel = id; } return(countHotel); }
public static Boolean removeRegimenToHotel(Int32 hotelId, Int32 regimenId) { SqlCommand command = new SqlCommand(); command.CommandText = "PUNTO_ZIP.sp_hotel_regimen_remove"; command.Parameters.Add(new SqlParameter("@p_hotel_id", SqlDbType.Int)); command.Parameters["@p_hotel_id"].Value = hotelId; command.Parameters.Add(new SqlParameter("@p_regimen_id", SqlDbType.Int)); command.Parameters["@p_regimen_id"].Value = regimenId; command.Parameters.Add(new SqlParameter("@p_system_date", SqlDbType.DateTime)); command.Parameters["@p_system_date"].Value = VarGlobal.FechaHoraSistema; var returnParameterRemoveOk = command.Parameters.Add(new SqlParameter("@p_remove_ok", SqlDbType.Int)); returnParameterRemoveOk.Direction = ParameterDirection.InputOutput; ProcedureHelper.execute(command, "remover regimen a hotel", false); Int16 enable = Convert.ToInt16(returnParameterRemoveOk.Value); if (enable != 0) { return(true); } else { return(false); } }
public static int fillRolByUser(Usuario user) { SqlCommand sp_rol_exist_one_by_user = new SqlCommand(); sp_rol_exist_one_by_user.CommandText = "PUNTO_ZIP.sp_rol_exist_one_by_user"; sp_rol_exist_one_by_user.Parameters.Add(new SqlParameter("@p_id", SqlDbType.VarChar)); sp_rol_exist_one_by_user.Parameters["@p_id"].Value = user.id; var returnParameterCountRol = sp_rol_exist_one_by_user.Parameters.Add(new SqlParameter("@p_count_rol", SqlDbType.Int)); returnParameterCountRol.Direction = ParameterDirection.InputOutput; var returnParameterIdRol = sp_rol_exist_one_by_user.Parameters.Add(new SqlParameter("@p_id_rol", SqlDbType.Int)); returnParameterIdRol.Direction = ParameterDirection.InputOutput; var returnParameterRolDesc = sp_rol_exist_one_by_user.Parameters.Add(new SqlParameter("@p_rol_desc", SqlDbType.VarChar, 255)); returnParameterRolDesc.Direction = ParameterDirection.InputOutput; ProcedureHelper.execute(sp_rol_exist_one_by_user, "chequear si un usuario tiene un solo rol", false); int countRol = Convert.ToInt16(returnParameterCountRol.Value); if (countRol == 1) { int id = Convert.ToInt16(returnParameterIdRol.Value); string description = Convert.ToString(returnParameterRolDesc.Value); user.rol = new Rol(id, description); } return(countRol); }
public static Boolean existHotelRoom(Int32 hotelId, Int32 floorId, Int32 roomId) { SqlCommand sp_habitacion_exist_hotel_room = new SqlCommand(); sp_habitacion_exist_hotel_room.CommandType = CommandType.StoredProcedure; sp_habitacion_exist_hotel_room.CommandText = "PUNTO_ZIP.sp_habitacion_exist_hotel_room"; sp_habitacion_exist_hotel_room.Parameters.AddWithValue("@p_habitacion_id", roomId); sp_habitacion_exist_hotel_room.Parameters.AddWithValue("@p_habitacion_hotel_id", hotelId); sp_habitacion_exist_hotel_room.Parameters.AddWithValue("@p_habitacion_floor_id", floorId); var returnParameterExist = sp_habitacion_exist_hotel_room.Parameters.Add(new SqlParameter("@p_exist", SqlDbType.Bit)); returnParameterExist.Direction = ParameterDirection.InputOutput; ProcedureHelper.execute(sp_habitacion_exist_hotel_room, "check if exist a room", false); Int16 enable = Convert.ToInt16(returnParameterExist.Value); if (enable != 0) { return(true); } else { return(false); } }
public static Boolean isCorrectPassword(String password) { SqlCommand sp_check_password = new SqlCommand(); sp_check_password.CommandText = "PUNTO_ZIP.sp_password_check_ok"; sp_check_password.Parameters.Add(new SqlParameter("@p_id", SqlDbType.VarChar)); sp_check_password.Parameters["@p_id"].Value = VarGlobal.usuario.id; sp_check_password.Parameters.Add(new SqlParameter("@p_pass", SqlDbType.VarChar)); sp_check_password.Parameters["@p_pass"].Value = Encrypt.Sha256(password); var returnParameterIsOk = sp_check_password.Parameters.Add(new SqlParameter("@p_ok", SqlDbType.Int)); returnParameterIsOk.Direction = ParameterDirection.InputOutput; ProcedureHelper.execute(sp_check_password, "chequear password", false); Int16 isOk = Convert.ToInt16(returnParameterIsOk.Value); if (isOk != 0) { return(true); } return(false); }
public static Boolean checkMail(Int32 clientId, String mail) { SqlCommand sp_client_check_exist_mail = new SqlCommand(); sp_client_check_exist_mail.CommandText = "PUNTO_ZIP.sp_client_check_exist_mail"; sp_client_check_exist_mail.Parameters.Add(new SqlParameter("@p_client_id", SqlDbType.Int)); sp_client_check_exist_mail.Parameters["@p_client_id"].Value = clientId; sp_client_check_exist_mail.Parameters.Add(new SqlParameter("@p_client_mail", SqlDbType.VarChar)); sp_client_check_exist_mail.Parameters["@p_client_mail"].Value = mail; var returnParametersIsValid = sp_client_check_exist_mail.Parameters.Add(new SqlParameter("@p_isValid", SqlDbType.Int)); returnParametersIsValid.Direction = ParameterDirection.InputOutput; ProcedureHelper.execute(sp_client_check_exist_mail, "chequear mail", false); if (Convert.ToInt16(returnParametersIsValid.Value) == 0) { return(false); } else { return(true); } }
public static Boolean checkTypeAndDocumentNumber(Int32 clientId, String typeDocument, Int32 documentNumber) { SqlCommand sp_client_check_exist_document = new SqlCommand(); sp_client_check_exist_document.CommandText = "PUNTO_ZIP.sp_client_check_exist_document"; sp_client_check_exist_document.Parameters.Add(new SqlParameter("@p_client_id", SqlDbType.Int)); sp_client_check_exist_document.Parameters["@p_client_id"].Value = clientId; sp_client_check_exist_document.Parameters.Add(new SqlParameter("@p_client_type_document", SqlDbType.VarChar, 255)); sp_client_check_exist_document.Parameters["@p_client_type_document"].Value = typeDocument; sp_client_check_exist_document.Parameters.Add(new SqlParameter("@p_client_document_number", SqlDbType.Int)); sp_client_check_exist_document.Parameters["@p_client_document_number"].Value = documentNumber; var returnParametersIsValid = sp_client_check_exist_document.Parameters.Add(new SqlParameter("@p_isValid", SqlDbType.Int)); returnParametersIsValid.Direction = ParameterDirection.InputOutput; ProcedureHelper.execute(sp_client_check_exist_document, "chequear tipo y numero de documento", false); if (Convert.ToInt16(returnParametersIsValid.Value) == 0) { return(false); } else { return(true); } }
public static void save(UsuarioDatos userData, Int32 hotel, string rol, String password) { SqlCommand sp_save_or_update_user = new SqlCommand(); sp_save_or_update_user.CommandType = CommandType.StoredProcedure; sp_save_or_update_user.CommandText = "PUNTO_ZIP.sp_user_save_update"; sp_save_or_update_user.Parameters.AddWithValue("@p_user_name", userData.username); sp_save_or_update_user.Parameters.AddWithValue("@p_name_lastName", userData.nameLastname); sp_save_or_update_user.Parameters.AddWithValue("@p_id_type_document", userData.typeDocument); sp_save_or_update_user.Parameters.AddWithValue("@p_document_number", userData.documentNumber); sp_save_or_update_user.Parameters.AddWithValue("@p_mail", userData.mail); sp_save_or_update_user.Parameters.AddWithValue("@p_telephone", userData.telephone); sp_save_or_update_user.Parameters.AddWithValue("@p_address", userData.address); sp_save_or_update_user.Parameters.AddWithValue("@p_birthdate", userData.birthDate); if (userData.enabled) { sp_save_or_update_user.Parameters.AddWithValue("@p_enabled", 1); } else { sp_save_or_update_user.Parameters.AddWithValue("@p_enabled", 0); } sp_save_or_update_user.Parameters.AddWithValue("@p_id_hotel", hotel); sp_save_or_update_user.Parameters.AddWithValue("@p_description_rol", rol); if (password != null) { sp_save_or_update_user.Parameters.AddWithValue("@p_password", Encrypt.Sha256(password)); } ProcedureHelper.execute(sp_save_or_update_user, "save or update user data", false); }
private static Boolean wasCharged(Int32 bookingId) { SqlCommand command = new SqlCommand(); command.CommandText = "PUNTO_ZIP.sp_facturar_estadia_was_charged"; command.Parameters.AddWithValue("@p_charge_stay_booking_id", bookingId); var returnParameterWasCharge = command.Parameters.Add(new SqlParameter("@p_charge_stay_was_charged", SqlDbType.Bit)); returnParameterWasCharge.Direction = ParameterDirection.InputOutput; ProcedureHelper.execute(command, "check if stay was charged", false); Int16 wasCharged = Convert.ToInt16(returnParameterWasCharge.Value); if (wasCharged != 0) { return(true); } else { return(false); } }
private static Boolean isCheckIn(Int32 bookingId) { SqlCommand command = new SqlCommand(); command.CommandText = "PUNTO_ZIP.sp_facturar_estadia_is_check_in"; command.Parameters.AddWithValue("@p_charge_stay_booking_id", bookingId); var returnParameterIsCheckIn = command.Parameters.Add(new SqlParameter("@p_charge_stay_is_check_in", SqlDbType.Bit)); returnParameterIsCheckIn.Direction = ParameterDirection.InputOutput; ProcedureHelper.execute(command, "check if check in exist", false); Int16 isCheckIn = Convert.ToInt16(returnParameterIsCheckIn.Value); if (isCheckIn != 0) { return(true); } else { return(false); } }
public static void cleanLogin(string username) { SqlCommand command = new SqlCommand(); command.CommandText = "PUNTO_ZIP.sp_user_clean_login"; command.Parameters.Add(new SqlParameter("@p_user_name", SqlDbType.VarChar, 255)); command.Parameters["@p_user_name"].Value = username; ProcedureHelper.execute(command, "Limpiar intentos de login", false); }
public static void change(string password) { SqlCommand sp_check_password = new SqlCommand(); sp_check_password.CommandText = "PUNTO_ZIP.sp_password_change"; sp_check_password.Parameters.Add(new SqlParameter("@p_id", SqlDbType.VarChar)); sp_check_password.Parameters["@p_id"].Value = VarGlobal.usuario.id; sp_check_password.Parameters.Add(new SqlParameter("@p_pass", SqlDbType.VarChar)); sp_check_password.Parameters["@p_pass"].Value = Encrypt.Sha256(password); ProcedureHelper.execute(sp_check_password, "chequear password", false); }
public static void saveStayClients(int stayId, List <int> clientsIds) { foreach (Int32 clientId in clientsIds) { SqlCommand command = new SqlCommand(); command.CommandText = "PUNTO_ZIP.sp_estadia_save_stay_client"; command.Parameters.AddWithValue("@p_stay_id", stayId); command.Parameters.AddWithValue("@p_stay_client_id", clientId); ProcedureHelper.execute(command, "save client per stay id", false); } }
public static void setRegimenToHotel(Int32 hotelId, Int32 regimenId) { SqlCommand command = new SqlCommand(); command.CommandText = "PUNTO_ZIP.sp_hotel_regimen_add"; command.Parameters.Add(new SqlParameter("@p_hotel_id", SqlDbType.Int)); command.Parameters["@p_hotel_id"].Value = hotelId; command.Parameters.Add(new SqlParameter("@p_regimen_id", SqlDbType.Int)); command.Parameters["@p_regimen_id"].Value = regimenId; ProcedureHelper.execute(command, "agregar regimen a hotel", false); }
public static void checkout(Int32 bookingId) { SqlCommand command = new SqlCommand(); command.CommandText = "PUNTO_ZIP.sp_estadia_generate_checkout"; command.Parameters.AddWithValue("@p_stay_booking_id", bookingId); command.Parameters.AddWithValue("@p_stay_user_name", VarGlobal.usuario.id); command.Parameters.Add(new SqlParameter("@p_system_date", SqlDbType.DateTime)); command.Parameters["@p_system_date"].Value = VarGlobal.FechaHoraSistema; ProcedureHelper.execute(command, "generate checkout for booking", false); }
public static void removeFunctionalityToRol(Int32 idRol, Int32 idFunctionality) { SqlCommand command = new SqlCommand(); command.CommandText = "PUNTO_ZIP.sp_rol_functionality_remove"; command.Parameters.Add(new SqlParameter("@p_id_rol", SqlDbType.Int)); command.Parameters["@p_id_rol"].Value = idRol; command.Parameters.Add(new SqlParameter("@p_id_functionality", SqlDbType.Int)); command.Parameters["@p_id_functionality"].Value = idFunctionality; ProcedureHelper.execute(command, "quitar funcionalidad a rol", false); }
public static void disableAll(string username, Int32 idHotel) { SqlCommand command = new SqlCommand(); command.CommandText = "PUNTO_ZIP.sp_user_roles_disable_all"; command.Parameters.Add(new SqlParameter("@p_user_name", SqlDbType.VarChar, 255)); command.Parameters["@p_user_name"].Value = username; command.Parameters.Add(new SqlParameter("@p_id_hotel", SqlDbType.Int)); command.Parameters["@p_id_hotel"].Value = idHotel; ProcedureHelper.execute(command, "Deshabilitar roles usuario por hotel", false); }
public static void search_reserva(Reserva reserva) { SqlCommand command = new SqlCommand(); command.CommandText = "PUNTO_ZIP.sp_get_reserva"; command.Parameters.Add(new SqlParameter("@p_id_reserva", SqlDbType.Int)); command.Parameters["@p_id_reserva"].Value = reserva.id; var returnParameter_regimen = command.Parameters.Add(new SqlParameter("@p_regimen", SqlDbType.VarChar, 255)); returnParameter_regimen.Direction = ParameterDirection.Output; var returnParameter_fecha_desde = command.Parameters.Add(new SqlParameter("@p_fecha_desde", SqlDbType.DateTime)); returnParameter_fecha_desde.Direction = ParameterDirection.Output; var returnParameter_estadia = command.Parameters.Add(new SqlParameter("@p_estadia", SqlDbType.Int)); returnParameter_estadia.Direction = ParameterDirection.Output; var returnParameter_estado = command.Parameters.Add(new SqlParameter("@p_estado", SqlDbType.VarChar, 255)); returnParameter_estado.Direction = ParameterDirection.Output; var returnParameter_nro_hab = command.Parameters.Add(new SqlParameter("@p_nro_hab", SqlDbType.Int)); returnParameter_nro_hab.Direction = ParameterDirection.Output; var returnParameter_piso_hab = command.Parameters.Add(new SqlParameter("@p_piso_hab", SqlDbType.Int)); returnParameter_piso_hab.Direction = ParameterDirection.Output; var returnParameter_tipo_hab = command.Parameters.Add(new SqlParameter("@p_tipo_hab", SqlDbType.VarChar, 255)); returnParameter_tipo_hab.Direction = ParameterDirection.Output; ProcedureHelper.execute(command, "buscar reserva", false); reserva.tipo_regimen = Convert.ToString(command.Parameters["@p_regimen"].Value); if (command.Parameters["@p_fecha_desde"].Value == DBNull.Value) { MessageBox.Show("No se encontraron los datos de la reserva seleccionada"); return; } else { reserva.fecha_inicio = Convert.ToDateTime(command.Parameters["@p_fecha_desde"].Value); } reserva.estadia = Convert.ToInt16(command.Parameters["@p_estadia"].Value); reserva.estado = Convert.ToString(command.Parameters["@p_estado"].Value); reserva.piso_hab = Convert.ToInt16(command.Parameters["@p_piso_hab"].Value); reserva.nro_hab = Convert.ToInt16(command.Parameters["@p_nro_hab"].Value); reserva.tipo_habitacion = Convert.ToString(command.Parameters["@p_tipo_hab"].Value); }
public static void removeConsumibleToEstadia(Int32 idEstadia, Int32 idConsumible) { SqlCommand command = new SqlCommand(); command.CommandText = "PUNTO_ZIP.sp_estadia_consumible_remove"; command.Parameters.Add(new SqlParameter("@p_id_estadia", SqlDbType.Int)); command.Parameters["@p_id_estadia"].Value = idEstadia; command.Parameters.Add(new SqlParameter("@p_id_consumible", SqlDbType.Int)); command.Parameters["@p_id_consumible"].Value = idConsumible; command.Parameters.Add(new SqlParameter("@p_system_date", SqlDbType.DateTime)); command.Parameters["@p_system_date"].Value = VarGlobal.FechaHoraSistema; ProcedureHelper.execute(command, "quitar consumible a estadia", false); }
public static void charge(Int32 stayId, Int32 clientId, String typePay, Int32 numberCard) { SqlCommand command = new SqlCommand(); command.CommandText = "PUNTO_ZIP.sp_facturar_estadia_charge"; command.Parameters.AddWithValue("@p_charge_stay_stay_id", stayId); command.Parameters.AddWithValue("@p_charge_stay_client_id", clientId); command.Parameters.AddWithValue("@p_charge_stay_number_card", numberCard); command.Parameters.AddWithValue("@p_charge_stay_type_pay", typePay); command.Parameters.Add(new SqlParameter("@p_system_date", SqlDbType.DateTime)); command.Parameters["@p_system_date"].Value = VarGlobal.FechaHoraSistema; ProcedureHelper.execute(command, "set charge", false); }
public static void save(Habitacion roomData) { SqlCommand sp_save_or_update_room = new SqlCommand(); sp_save_or_update_room.CommandType = CommandType.StoredProcedure; sp_save_or_update_room.CommandText = "PUNTO_ZIP.sp_habitacion_save_update"; sp_save_or_update_room.Parameters.AddWithValue("@p_habitacion_id", roomData.id); sp_save_or_update_room.Parameters.AddWithValue("@p_habitacion_hotel_id", roomData.hotel); sp_save_or_update_room.Parameters.AddWithValue("@p_habitacion_floor_id", roomData.floor); sp_save_or_update_room.Parameters.AddWithValue("@p_habitacion_type", roomData.type); sp_save_or_update_room.Parameters.AddWithValue("@p_habitacion_front", roomData.front); sp_save_or_update_room.Parameters.AddWithValue("@p_habitacion_comodity", roomData.comodity); ProcedureHelper.execute(sp_save_or_update_room, "save or update room data", false); }
public static bool closePeriod(Int32 hotelId, Int32 floorId, Int32 roomId, Period period) { SqlCommand sp_habitacion_close_period_valid = new SqlCommand(); sp_habitacion_close_period_valid.CommandType = CommandType.StoredProcedure; sp_habitacion_close_period_valid.CommandText = "PUNTO_ZIP.sp_habitacion_close_period_valid"; sp_habitacion_close_period_valid.Parameters.Add(new SqlParameter("@p_habitacion_id", SqlDbType.Int)); sp_habitacion_close_period_valid.Parameters["@p_habitacion_id"].Value = roomId; sp_habitacion_close_period_valid.Parameters.Add(new SqlParameter("@p_habitacion_floor_id", SqlDbType.Int)); sp_habitacion_close_period_valid.Parameters["@p_habitacion_floor_id"].Value = floorId; sp_habitacion_close_period_valid.Parameters.Add(new SqlParameter("@p_habitacion_hotel_id", SqlDbType.Int)); sp_habitacion_close_period_valid.Parameters["@p_habitacion_hotel_id"].Value = hotelId; sp_habitacion_close_period_valid.Parameters.Add(new SqlParameter("@p_habitacion_close_period_from", SqlDbType.DateTime)); sp_habitacion_close_period_valid.Parameters["@p_habitacion_close_period_from"].Value = period.from; sp_habitacion_close_period_valid.Parameters.Add(new SqlParameter("@p_habitacion_close_period_to", SqlDbType.DateTime)); sp_habitacion_close_period_valid.Parameters["@p_habitacion_close_period_to"].Value = period.to; sp_habitacion_close_period_valid.Parameters.Add(new SqlParameter("@p_habitacion_close_period_motive", SqlDbType.VarChar, 255)); sp_habitacion_close_period_valid.Parameters["@p_habitacion_close_period_motive"].Value = period.motive; sp_habitacion_close_period_valid.Parameters.Add(new SqlParameter("@p_user_id", SqlDbType.VarChar, 20)); sp_habitacion_close_period_valid.Parameters["@p_user_id"].Value = VarGlobal.usuario.id; var returnParameterAddOk = sp_habitacion_close_period_valid.Parameters.Add(new SqlParameter("@p_add_ok", SqlDbType.Int)); returnParameterAddOk.Direction = ParameterDirection.InputOutput; ProcedureHelper.execute(sp_habitacion_close_period_valid, "check down period", false); Int16 enable = Convert.ToInt16(returnParameterAddOk.Value); if (enable != 0) { return(true); } else { return(false); } }