private void deleteMenu_Click(object sender, EventArgs e) { IEnumerator it = patientHistoryGrid.SelectedRows.GetEnumerator(); if (it.MoveNext()) { DataGridViewRow row = (DataGridViewRow)it.Current; DataGridViewCell cell = row.Cells[3]; string idsValue = cell.Value.ToString(); string typeValue = row.Cells[2].Value.ToString(); if (DdtJournalDay.NAME.Equals(typeValue, StringComparison.Ordinal)) { service.GetDdtJournalDayService().Delete(idsValue); service.GetDdtHistoryService().DeleteHistoryById(idsValue); LoadPatientsHistoryGrid(); } else if (!DdtHospital.NAME.Equals(typeValue, StringComparison.Ordinal)) { service.Delete(typeValue, idsValue); service.GetDdtHistoryService().DeleteHistoryById(idsValue); LoadPatientsHistoryGrid(); } } }
public bool Save() { if (!getIsValid()) { return(false); } hospitalitySession.Diagnosis = getSafeStringValue(diagnosisTxt1); service.GetDdtHospitalService().Save(hospitalitySession); DdtConsilium consilium = null; if (!string.IsNullOrEmpty(consiliumId)) { consilium = service.GetDdtConsiliumService().GetById(consiliumId); } else { consilium = new DdtConsilium { ConsiliumDate = DateTime.Now, HospitalitySession = hospitalitySession.ObjectId, Patient = hospitalitySession.Patient, Doctor = hospitalitySession.CuringDoctor }; } consilium.Decision = getSafeStringValue(decisionTxt); consilium.Diagnosis = getSafeStringValue(diagnosisTxt0); consilium.DutyAdminName = getSafeStringValue(adminTxt); consilium.Dynamics = getSafeStringValue(dynamicsTxt); consilium.Goal = getSafeStringValue(goalTxt); consiliumId = service.GetDdtConsiliumService().Save(consilium); foreach (Control doctorInfoPnl in doctorsContainer.Controls) { DdtConsiliumRelation consiliumRelation = null; String doctorInfoPnlName = getSafeObjectValueUni <string>(doctorInfoPnl, new getValue <string>((ctrl) => (ctrl.Name))); string indexstr = string.Intern(doctorInfoPnlName.Substring(CommonUtils.GetFirstDigitIndex(doctorInfoPnlName))); int indx = Int32.Parse(indexstr); Control objectIdCtrl = CommonUtils.FindControl(doctorsContainer, "objectIdLbl" + indx); if (!string.IsNullOrEmpty(objectIdCtrl.Text)) { consiliumRelation = service.GetDdtConsiliumRelationService().GetById(objectIdCtrl.Text); } else { consiliumRelation = new DdtConsiliumRelation(); consiliumRelation.Consilium = consiliumId; } Control appCb = CommonUtils.FindControl(doctorsContainer, "appointmentTxt" + indx); DdtConsiliumGroup group = getSafeObjectValueUni <DdtConsiliumGroup>(appCb, (ctrl) => ((DdtConsiliumGroup)((ComboBox)ctrl).SelectedItem)); Control docCb = CommonUtils.FindControl(doctorsContainer, "doctorWho" + indx); DdvDoctor doctor = getSafeObjectValueUni <DdvDoctor>(docCb, (ctrl) => ((DdvDoctor)((ComboBox)ctrl).SelectedItem)); if (group != null && doctor != null) { DdtConsiliumGroupMember consiliumGroupMember = service.GetDdtConsiliumGroupMemberService().GetByDoctorAndGroupId(doctor.ObjectId, group.ObjectId); consiliumRelation.Member = consiliumGroupMember.ObjectId; service.GetDdtConsiliumRelationService().Save(consiliumRelation); } } foreach (String consiliumRelationId in consiliumRelationToRemove) { service.Delete(DdtConsiliumRelation.NAME, consiliumRelationId); } analysisTabControl1.save(consiliumId, DdtConsilium.NAME); SetConsiliumIdToTransfusion(); return(true); }