public string AddTransactionDetails(Transaction transaction) { try { HRSCustomersBLL customerBLLObject = new HRSCustomersBLL(); var customer = customerBLLObject.GetCustomerDetailsById(transaction.CustomerID); DateTime zeroTime = new DateTime(1, 1, 1); TimeSpan span = DateTime.Now - customer.DateOfBirth; int years = (zeroTime + span).Year - 1; if (years > 50) { transaction.Amount = (int)(transaction.Amount - transaction.Amount * 0.05); } SqlDataReader reader = HRSPaymentDALObject.AddTransactionDetails(transaction); string transactionID = string.Empty; while (reader.Read()) { transactionID = reader["TXNID"].ToString(); SendEmail.SendEmail.PaymentConfirmation(transaction.CustomerID, customer.EmailAddress, transaction.BookingID, transaction.Amount.ToString(), transactionID); } return(transactionID); } catch (Exception ex) { Utility.ExceptionUtility.ExceptionLog(ex); throw; } }
public int DeleteBookingDetails(string bookingID, string customerID) { try { int result = HRSBookingDALObject.DeleteBookingDetails(bookingID); if (result >= 1) { HRSCustomersBLL customerBLLObject = new HRSCustomersBLL(); var customer = customerBLLObject.GetCustomerDetailsById(customerID); SendEmail.SendEmail.CancelReservation(customerID, customer.EmailAddress, bookingID); } return(result); } catch (Exception ex) { ExceptionUtility.ExceptionLog(ex); throw; } }
public string AddBookingDetails(Booking booking) { try { SqlDataReader result = HRSBookingDALObject.AddBookingDetails(booking); string bookingId = string.Empty; if (result.HasRows) { result.Read(); bookingId = result["BookingID"].ToString(); HRSCustomersBLL customerBLLObject = new HRSCustomersBLL(); var customer = customerBLLObject.GetCustomerDetailsById(booking.CustomerID); SendEmail.SendEmail.BookHotel(booking.CustomerID, customer.EmailAddress, bookingId); } return(bookingId); } catch (Exception ex) { ExceptionUtility.ExceptionLog(ex); throw; } }