public DoctorResponse GetDoctors(DoctorRequest request) { DoctorResponse response = new DoctorResponse(); // Set correlation Id response.CorrelationId = request.RequestId; try { // Get customer list via Customer Facade. DoctorFacade facade = new DoctorFacade(); response.ds = facade.GetDoctor(request.lastName); //response.Doctors = new DoctorTransferObject[ListDoc.Count]; //Console.WriteLine(ListDoc.Count.ToString()); // // Package customer data in Customer Transfer Object // int index = 0; // foreach (Doctor doctor in ListDoc) // { //DoctorResponse response = new DoctorResponse(); // transfer.docID = doctor.DoctorID; // transfer.fName = doctor.fName; // transfer.LName = doctor.LName; // transfer.phone = doctor.Phone; // response.Doctors[index++] = transfer; //} } catch (Exception ex) { response.Acknowledge = AcknowledgeType.Failure; response.Message = "Request cannot be handled at this time."+ex.Message; } return response; }
public PersistDoctorResponse PersistDoctor(PersistDoctorRequest request) { PersistDoctorResponse response = new PersistDoctorResponse(); // Set correlation Id response.CorrelationId = request.RequestId; try { // Call persistence request via Customer Facade. DoctorFacade facade = new DoctorFacade(); switch (request.PersistAction) { case PersistType.Insert: { Doctor doctor = new Doctor(); doctor.fName = request.Doctor.fName; doctor.LName = request.Doctor.LName; doctor.Phone = request.Doctor.phone; doctor.UserID = request.Doctor.user; doctor.email = request.Doctor.email; doctor.SecQues = request.Doctor.secQu; doctor.SecAns = request.Doctor.answer; doctor.Password = request.Doctor.pass; doctor.City = request.Doctor.city; doctor.DateOfBirth = request.Doctor.dOBirth; doctor.gender = request.Doctor.gender; doctor.License_Type = request.Doctor.LicType; doctor.National_PrvID = request.Doctor.NatProvID; doctor.officeAdr = request.Doctor.officeAdr; doctor.Primary_spl = request.Doctor.PrmSpl; doctor.Title = request.Doctor.title; doctor.zip = request.Doctor.zip; doctor.State = request.Doctor.state; facade.AddDoctor(doctor); response.Doctor = request.Doctor; response.Doctor.docID = doctor.DoctorID; break; } //case PersistType.Update: // { // Customer customer = new Customer(); // customer.CustomerId = DecryptId(request.Customer.CustomerId); // customer.Company = request.Customer.Company; // customer.City = request.Customer.City; // customer.Country = request.Customer.Country; // facade.UpdateCustomer(customer); // response.Customer = request.Customer; // break; // } //case PersistType.Delete: // { // int customerId = DecryptId(request.Customer.CustomerId); // int rowsAffected = facade.DeleteCustomer(customerId); // if (rowsAffected == 0) // throw new Exception("Customer has orders and therefore cannot be deleted. "); // break; // } } } catch (Exception ex) { response.Acknowledge = AcknowledgeType.Failure; response.Message = ex.Message; } return response; }