}//end page_load protected void ShowInstitutionSelect(int patientId) { groupMessage.Text = ""; PatientInstitutionDa da = new PatientInstitutionDa(); //get users existing insts DataTable dt = da.GetPatientInstitutionsByPatientId(patientId); rptInstitutions.DataSource = dt.DefaultView; rptInstitutions.DataBind(); if (dt.Rows.Count == 0) { groupMessage.Text = "No Institutions Assigned. This patient will only be accessible in the All Dataset"; } //get groups InstitutionDa i = new InstitutionDa(); DataTable iDt = i.GetInstitutions(); Institutions.DataSource = iDt.DefaultView; Institutions.DataValueField = "InstitutionId"; Institutions.DataTextField = "Institution"; Institutions.DataBind(); Institutions.Items.Insert(0, new ListItem("")); SelectInstitutionTable.Visible = true; }
private void InsertDimension(object atts, int patientId, SqlTransaction trans) { DataRow dr; if (atts is XmlNode) { dr = this.AttributesToRow(((XmlNode)atts).Attributes); } else { dr = (DataRow)atts; } string dimType = (string)dr["type"]; switch (dimType) { case "Institution": InstitutionDa ida = new InstitutionDa(); int institutionId = ida.GetPrimKey((string)dr["value"]); this._CheckId(institutionId, dimType, dr); PatientInstitutionDa pida = new PatientInstitutionDa(); if (VerifyUnique((pida.GetPatientInstitution(patientId, institutionId, trans)).Tables[0])) { // NEW CODE, insert record though middle tier PatientInstitution ptInstitution = new PatientInstitution(); ptInstitution[PatientInstitution.PatientId] = patientId; ptInstitution[PatientInstitution.InstitutionId] = institutionId; ptInstitution.Save(); // OLD CODE, inserts now handled by middle tier // pida.InsertPatientInstitution(patientId, institutionId, trans); add trans logic after concurrency fully tested- spy 2/21 // pida.InsertPatientInstitution(patientId, institutionId, trans); } break; case "Physician": PhysicianDa pda = new PhysicianDa(); //to get Physician primary key need to pass first and last name in from dataset defined in XML int physicianId = pda.GetPrimKey((string)dr["value"], (string)dr["value2"]); this._CheckId(physicianId, dimType, dr); PatientPhysicianDa ppda = new PatientPhysicianDa(); if (VerifyUnique((ppda.ValidatePatientPhysician(patientId, physicianId)).Tables[0])) { // NEW CODE, insert record though middle tier PatientPhysician ptPhysician = new PatientPhysician(); ptPhysician[PatientPhysician.PatientId] = patientId; ptPhysician[PatientPhysician.PhysicianId] = physicianId; ptPhysician.Save(); // OLD CODE, inserts now handled by middle tier //should be creating Patient Physician biz object and passing object to PatientPhysicianDa //ppda.InsertPatientPhysicianDimension(patientId, physicianId, _sc.GetUserName(), trans); } break; case "Protocol": ProtocolDa protDa = new ProtocolDa(); int protocolId = protDa.GetPrimKey((string)dr["value"]); this._CheckId(protocolId, dimType, dr); PatientProtocolDa ptProtDa = new PatientProtocolDa(); if (VerifyUnique((ptProtDa.ValidatePatientProtocol(patientId, protocolId)).Tables[0])) { // NEW CODE, insert record though middle tier PatientProtocol ptProtocol = new PatientProtocol(); ptProtocol[PatientProtocol.PatientId] = patientId; ptProtocol[PatientProtocol.ProtocolId] = protocolId; ptProtocol.Save(); // OLD CODE, inserts now handled by middle tier //ptProtDa.InsertPatientProtocolDimension(patientId, protocolId, _sc.GetUserName(), trans); } break; case "Disease": DiseaseDa disDa = new DiseaseDa(); int diseaseId = disDa.GetPrimKey((string)dr["value"]); this._CheckId(diseaseId, dimType, dr); PatientDiseaseDa ptDiseaseDa = new PatientDiseaseDa(); if (VerifyUnique((ptDiseaseDa.GetPatientDisease(patientId, diseaseId)).Tables[0])) { // NEW CODE, insert record though middle tier PatientDisease ptDisease = new PatientDisease(); ptDisease[PatientDisease.PatientId] = patientId; ptDisease[PatientDisease.DiseaseId] = diseaseId; ptDisease.Save(); // OLD CODE, inserts now handled by middle tier //ptDiseaseDa.InsertPatientDisease(patientId, diseaseId, trans); } break; } }