//constructor with parameters public Case( //string caseID, IndivAtRisk indiv, CareGiver careGiver, PersonOfInterest personOfInterest, SocialWorker socialWorker, CaseHistory caseHistory) { // caseID = _caseID; indiv = _indiv; careGiver = _careGiver; personOfInterest = _personOfInterest; socialWorker = _socialWorker; caseHistory = _caseHistory; }
//5)Once a case is chosen, this will load the data from the Persons table and data from the Person of Interest table and loads it into the Person of Interest tab //on the Case View form. public PersonOfInterest RetrievePersonOfInt(int indivId) { var poi = new PersonOfInterest(); sqlConnection1 = InitializeConnectionString(); using (sqlConnection1) { string data = "Select * from Persons, PersonOfInterest, IndividualAtRisk where IndividualAtRisk.IndivId = '" + indivId +"' AND IndividualAtRisk.IndivId = PersonOfInterest.IndivId AND PersonOfInterest.PersonId = Persons.PersonId"; System.Data.SqlClient.SqlCommand cmd = new System.Data.SqlClient.SqlCommand(data, sqlConnection1); sqlConnection1.Open(); using (SqlDataReader read = cmd.ExecuteReader()) { while (read.Read()) { poi.personId = read["PersonId"].ToString(); poi.lastName = read["Last_Name"].ToString(); poi.firstName = read["First_Name"].ToString(); poi.gender = read["Gender"].ToString(); poi.race = read["Race"].ToString(); poi.dob = read["DOB"].ToString(); poi.ssn = read["SSN"].ToString(); poi.milDependent = read["Military_Dependent"].ToString(); poi.churchConnection = read["Church_Connections"].ToString(); poi.streetAddress = read["Street_Address"].ToString(); poi.apartment = read["Apartment_Number"].ToString(); poi.city = read["City"].ToString(); poi.state = read["State"].ToString(); poi.zip = read["Zip_Code"].ToString(); poi.email = read["Email"].ToString(); poi.homePhone = read["Telephone_Home"].ToString(); poi.mobilePhone = read["Telephone_Mobile"].ToString(); poi.workPhone = read["Telephone_Work"].ToString(); poi.type = read["Person_Type"].ToString(); poi.relationship = read["Relationship"].ToString(); //indiv.personID = read["PersonId"].ToString(); } } } sqlConnection1.Close(); return poi; }
//11)This will pull the individual id in the case so a person of interest id can be created in the person of interest table. public PersonOfInterest IndivId() { var poi = new PersonOfInterest(); sqlConnection1 = InitializeConnectionString(); using (sqlConnection1) { string data = "Select IndivId, Last_Value(IndivId) Over (Partition By IndivId Order By IndivId) from IndividualAtRisk"; System.Data.SqlClient.SqlCommand cmd = new System.Data.SqlClient.SqlCommand(data, sqlConnection1); sqlConnection1.Open(); using (SqlDataReader read = cmd.ExecuteReader()) { while (read.Read()) { poi.indivId = read["IndivId"].ToString(); } } } sqlConnection1.Close(); return poi; }