private void AddTeeth(OdontogramVM o, Teeth teeth) { TeethVM teethVM = new TeethVM { Id_Teeth = teeth.Id_Teeth, Id_Odontogram = teeth.Id_Odontogram, UpperCervical = teeth.UpperCervical, Vestibular = teeth.Vestibular, Oclusal = teeth.Oclusal, Palatino = teeth.Palatino, Distal = teeth.Distal, Mesial = teeth.Mesial, LowerServical = teeth.LowerServical, General = teeth.General }; if (_UpperMap.ContainsKey(teeth.Id_Teeth)) { o.upperTeeth[_UpperMap[teeth.Id_Teeth]] = teethVM; } if (_UpperTemporalMap.ContainsKey(teeth.Id_Teeth)) { o.upperTemporalTeeth[_UpperTemporalMap[teeth.Id_Teeth]] = teethVM; } if (_LowerTemporalMap.ContainsKey(teeth.Id_Teeth)) { o.lowerTemporalTeeth[_LowerTemporalMap[teeth.Id_Teeth]] = teethVM; } if (_LowerMap.ContainsKey(teeth.Id_Teeth)) { o.lowerTeeth[_LowerMap[teeth.Id_Teeth]] = teethVM; } }
public OdontogramVM GetOdontogram(int id_patient, bool first) { OdontogramVM odontogramVM = null; try { Odontogram odontogram = _udt.Odontogram.Where(x => x.Id_patient == id_patient && x.first == first).FirstOrDefault(); if (odontogram != null) { odontogramVM = new OdontogramVM( ); odontogramVM.upperTeeth = new TeethVM[16]; odontogramVM.upperTemporalTeeth = new TeethVM[10]; odontogramVM.lowerTemporalTeeth = new TeethVM[10]; odontogramVM.lowerTeeth = new TeethVM[16]; foreach (Teeth teeth in odontogram.Teeth) { AddTeeth(odontogramVM, teeth); } odontogramVM.actions = GetOdontogramActions( ); odontogramVM.treatment = GetOdontogramTreatments( ); } } catch (Exception ex) { throw new ValidationException(ex.Message); } return(odontogramVM); }
public JsonResult GetOdontogram( ) { //Odontogram o = new Odontogram( ); DentalService.DentalService client = new DentalService.DentalService( ); OdontogramVM o = client.GetOdontogram(1, true); //foreach ( OdontogramActionVM v in d.GetOdontogramActions() ) { // Debug.Write( v.Code ); //} //Odontogram o = new Odontogram( ); return(Json(o, JsonRequestBehavior.AllowGet)); }