protected void btnApprove_Click(object sender, EventArgs e) { long tripId = 0; int vehicleMakeId = 0, vehicleModelId = 0, vehicleId = 0; if (cboVehicleMake.SelectedIndex > 0) { vehicleMakeId = Convert.ToInt32(cboVehicleMake.SelectedValue); } if (cboVehicleModel.SelectedIndex > 0) { vehicleModelId = Convert.ToInt32(cboVehicleModel.SelectedValue); } if (cboVechile.SelectedIndex > 0) { vehicleId = Convert.ToInt32(cboVechile.SelectedValue); } if (!long.TryParse(this.RedirectId, out tripId)) { this.RedirectPage(Pages.TRIP_CLOSURE); return; } m_Repository.ApproveTrip(tripId, vehicleMakeId, vehicleModelId, vehicleId, this.UserName); string body = string.Format("Dear {0} \r\n\r\nThere vehicle request has been approved. You are allocated {1} with registration number: {2}. Use the the reference number: {3} on your mobile app. \r\n\r\nEnjoy your trip. \r\n\r\nRegards", this.DriverName, cboVehicleModel.SelectedItem.Text, cboVechile.SelectedItem.Text, tripId); var success = new EmailRepository().SendEmail(this.Driver, this.DriverName, this.ManagerAddress, "Trip request appoved", body); if (success) { this.ShowMessage("The trip has been approved"); } }