public static R_Volunteer ConvertDTOtoEntity(VolunteerDTO dto) { R_Volunteer volunteer = new R_Volunteer(); volunteer.VolunteerId = dto.VolunteerId; volunteer.Name = dto.Name; volunteer.Gender = dto.Gender; volunteer.BirthDate = dto.BirthDate; volunteer.Occupation = dto.Occupation; volunteer.Employer = dto.Employer; volunteer.Phone = dto.Phone; volunteer.Email = dto.Email; volunteer.IdentityCardNumber = dto.IdentityCardNumber; volunteer.CountryId = dto.CountryId; volunteer.FriendOrFamilyContact = dto.FriendOrFamilyContact; volunteer.Photo = dto.Photo; volunteer.AddressId = dto.AddressId; volunteer.HasCar = dto.HasCar; volunteer.HasDriverLicense = dto.HasDriverLicense; volunteer.HasBike = dto.HasBike; volunteer.VehicleMake = dto.VehicleMake; volunteer.VehicleModel = dto.VehicleModel; volunteer.Active = dto.Active; volunteer.IsDeleted = dto.IsDeleted; volunteer.CreateBy = dto.CreateBy; volunteer.CreateOn = dto.CreateOn; volunteer.UpdateBy = dto.UpdateBy; volunteer.UpdateOn = dto.UpdateOn; return(volunteer); }
// logging helper public static string FormatVolunteerDTO(VolunteerDTO volunteerDTO) { if (volunteerDTO == null) { // null return("volunteerDTO: null"); } else { // output values return("volunteerDTO: \n" + "{ \n" + " VolunteerId: " + "'" + volunteerDTO.VolunteerId + "'" + ", \n" + " Name: " + (volunteerDTO.Name != null ? "'" + volunteerDTO.Name + "'" : "null") + ", \n" + " Gender: " + (volunteerDTO.Gender != null ? "'" + volunteerDTO.Gender + "'" : "null") + ", \n" + " BirthDate: " + (volunteerDTO.BirthDate != null ? "'" + volunteerDTO.BirthDate + "'" : "null") + ", \n" + " Occupation: " + (volunteerDTO.Occupation != null ? "'" + volunteerDTO.Occupation + "'" : "null") + ", \n" + " Employer: " + (volunteerDTO.Employer != null ? "'" + volunteerDTO.Employer + "'" : "null") + ", \n" + " Phone: " + (volunteerDTO.Phone != null ? "'" + volunteerDTO.Phone + "'" : "null") + ", \n" + " Email: " + (volunteerDTO.Email != null ? "'" + volunteerDTO.Email + "'" : "null") + ", \n" + " IdentityCardNumber: " + (volunteerDTO.IdentityCardNumber != null ? "'" + volunteerDTO.IdentityCardNumber + "'" : "null") + ", \n" + " CountryId: " + (volunteerDTO.CountryId != null ? "'" + volunteerDTO.CountryId + "'" : "null") + ", \n" + " FriendOrFamilyContact: " + (volunteerDTO.FriendOrFamilyContact != null ? "'" + volunteerDTO.FriendOrFamilyContact + "'" : "null") + ", \n" + " Photo: " + (volunteerDTO.Photo != null ? "'" + volunteerDTO.Photo + "'" : "null") + ", \n" + " AddressId: " + (volunteerDTO.AddressId != null ? "'" + volunteerDTO.AddressId + "'" : "null") + ", \n" + " HasCar: " + "'" + volunteerDTO.HasCar + "'" + ", \n" + " HasDriverLicense: " + "'" + volunteerDTO.HasDriverLicense + "'" + ", \n" + " HasBike: " + "'" + volunteerDTO.HasBike + "'" + ", \n" + " VehicleMake: " + (volunteerDTO.VehicleMake != null ? "'" + volunteerDTO.VehicleMake + "'" : "null") + ", \n" + " VehicleModel: " + (volunteerDTO.VehicleModel != null ? "'" + volunteerDTO.VehicleModel + "'" : "null") + ", \n" + " Active: " + "'" + volunteerDTO.Active + "'" + ", \n" + " IsDeleted: " + "'" + volunteerDTO.IsDeleted + "'" + ", \n" + " CreateBy: " + (volunteerDTO.CreateBy != null ? "'" + volunteerDTO.CreateBy + "'" : "null") + ", \n" + " CreateOn: " + (volunteerDTO.CreateOn != null ? "'" + volunteerDTO.CreateOn + "'" : "null") + ", \n" + " UpdateBy: " + (volunteerDTO.UpdateBy != null ? "'" + volunteerDTO.UpdateBy + "'" : "null") + ", \n" + " UpdateOn: " + (volunteerDTO.UpdateOn != null ? "'" + volunteerDTO.UpdateOn + "'" : "null") + " \n" + "} \n"); } }