+ Start a Discussion

Need some code help with a C# webservice

Ok....I have been on here with one error or another trying to write a webservice that is consumed by C#. I thought I had it, but continue to run into issues. Below is the code that I have written. I am struggling with how to make the objects relate as well as test code coverage. On teh C# side, I have it. Can someone please assist me? Here is the code below that I have been writing. The Patient Data is the Parent to the Trial Session. I know I am missing something here and could really use some guidance.

class wsLoad_NDD_Data {
	webservice static Patient_Data__c LoadPatientData(String strPatientId, String strFirstName, String strLastName, String strIsBioCal, String strEthnicity, String strAsthma, String strGender, Date dtmDateOfBirth, String strCOPD, Decimal numHeight, Decimal numWeight, String strsite)
		Patient_Data__c insertPatientData = null;
		insertPatientData = new Patient_Data__c();
		insertPatientData.Patient_ID__c = strPatientId;
		insertPatientData.First_Name__c = strFirstName;
		insertPatientData.Last_Name__c = strLastName;
		insertPatientData.IsBioCal_Int__c = strIsBioCal;
		insertPatientData.Ethnicity__c = strEthnicity;
		insertPatientData.Asthma__c = strAsthma;
		insertPatientData.Gender__c = strGender;
		insertPatientData.Date_of_Birth__c = dtmDateOfBirth;
		insertPatientData.COPD__c = strCOPD;
		insertPatientData.Height__c = numHeight;
		insertPatientData.Weight__c = numWeight;
		insertPatientData.Site__c = strsite;
		insert insertPatientData;
		return insertPatientData;
	webservice static Trial_Session__c LoadTrialSession(String strOrderID, Date dtmTestDate, String strTypeofTest, String strReviewerName, String strReviewerComments, Date dtmDateofBirth, Decimal numHeight, Decimal numWeight, String strGender, String strEthnicity, String strAsthma, String strCOPD, String strSmoker, Date dtmDateReviewed, Decimal numLungAge, String strQualityGrade, String strQualityGradeOriginal, String strSoftwareVersion)
		Trial_Session__c insertTrialSession = null;
		insertTrialSession = new Trial_Session__c();
		insertTrialSession.Patient_Data__c = ;
		insertTrialSession.External_ID__c = strOrderID;
		insertTrialSession.Test_Date__c = dtmTestDate;
		insertTrialSession.Type_of_Test__c = strTypeofTest;
		insertTrialSession.Reviewer_Name__c = strReviewerName;
		insertTrialSession.Reviewer_Comments__c = strReviewerComments;
		insertTrialSession.Date_of_Birth__c = dtmDateofBirth;
		insertTrialSession.Height__c = numHeight;
		insertTrialSession.Weight__c = numWeight;
		insertTrialSession.Gender__c = strGender;
		insertTrialSession.Ethnicity__c = strEthnicity;
		insertTrialSession.Asthma__c = strAsthma;
		insertTrialSession.COPD__c = strCOPD;
		insertTrialSession.Smoker__c = strSmoker;
		insertTrialSession.Date_Reviewed__c = dtmDateReviewed;
		insertTrialSession.Lung_Age__c = numLungAge;
		insertTrialSession.Quality_Grade__c = strQualityGrade;
		insertTrialSession.Quality_Grade_Original__c = strQualityGradeOriginal;
		insertTrialSession.Software_Version__c = strSoftwareVersion;
		insert insertTrialSession;
		return insertTrialSession;

 I am also really struggling with the test class. In all of the research I have done I have seen two possible ways to handle this and very little guidance on how to relate objects.


Thank you for the help provided. I know this can be done, I just need a bit of the path shown to me.