/// <summary> /// Deprecated Method for adding a new object to the PARTICIPANT_DATA EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToPARTICIPANT_DATA(PARTICIPANT_DATA pARTICIPANT_DATA) { base.AddObject("PARTICIPANT_DATA", pARTICIPANT_DATA); }
/// <summary> /// Create Participant and try to migrate some details from user table. /// </summary> public void createParticipant(int userid,int sessionid) { try { USER userData = (from user in dbpollContext.USERS where user.USER_ID == userid select user).First<USER>(); var participants = from part in dbpollContext.PARTICIPANTS join data in dbpollContext.PARTICIPANT_DATA on part.PARTICIPANT_ID equals data.PARTICIPANT_ID where part.USER_ID == userData.USER_ID select new participantModel { userweight = (int)data.USER_WEIGHT, name = data.NAME, address = data.ADDRESS, city = data.CITY, postcode = data.POSTCODE, state = data.STATE, country = data.COUNTRY, department = data.DEPARTMENT, company = data.COMPANY, email = data.EMAIL, fax = data.FAX, phone = data.PHONE, title = data.TITLE }; PARTICIPANT p = new PARTICIPANT(); PARTICIPANT_DATA partdata = new PARTICIPANT_DATA(); p.PARTICIPANT_ID = getMaxParticipantID() + 1; p.USER_ID = userid; p.SESSION_ID = sessionid; partdata.DATA_ID = getMaxDataID() + 1; partdata.PARTICIPANT_ID = p.PARTICIPANT_ID; partdata.NAME = userData.NAME; // See if we can set data from a previous participant entry if (participants.ToArray().Length > 0) { participantModel participant = participants.First<participantModel>(); partdata.USER_WEIGHT = participant.userweight; partdata.ADDRESS = participant.address; partdata.CITY = participant.city; partdata.POSTCODE = participant.postcode; partdata.STATE = participant.state; partdata.COUNTRY = participant.country; partdata.DEPARTMENT =participant.department; partdata.COMPANY = partdata.COMPANY; partdata.EMAIL = partdata.EMAIL; partdata.FAX = participant.fax; partdata.PHONE= participant.phone; partdata.TITLE= participant.title; } dbpollContext.AddToPARTICIPANTS(p); dbpollContext.AddToPARTICIPANT_DATA(partdata); dbpollContext.SaveChanges(); } catch (Exception e) { throw (e); } }
/// <summary> /// Create a new PARTICIPANT_DATA object. /// </summary> /// <param name="dATA_ID">Initial value of the DATA_ID property.</param> public static PARTICIPANT_DATA CreatePARTICIPANT_DATA(global::System.Int32 dATA_ID) { PARTICIPANT_DATA pARTICIPANT_DATA = new PARTICIPANT_DATA(); pARTICIPANT_DATA.DATA_ID = dATA_ID; return pARTICIPANT_DATA; }