// Modify default (Update all attributes of the class) public void ModifyDefault(SpecialtyEN specialty) { try { SessionInitializeTransaction(); SpecialtyEN specialtyEN = (SpecialtyEN)session.Load(typeof(SpecialtyEN), specialty.Identifier); specialtyEN.Code = specialty.Code; specialtyEN.Display = specialty.Display; session.Update(specialtyEN); SessionCommit(); } catch (Exception ex) { SessionRollBack(); if (ex is ChroniGenNHibernate.Exceptions.ModelException) { throw ex; } throw new ChroniGenNHibernate.Exceptions.DataLayerException("Error in SpecialtyCAD.", ex); } finally { SessionClose(); } }
public void Destroy(int identifier ) { try { SessionInitializeTransaction(); SpecialtyEN specialtyEN = (SpecialtyEN)session.Load(typeof(SpecialtyEN), identifier); session.Delete(specialtyEN); SessionCommit(); } catch (Exception ex) { SessionRollBack(); if (ex is ChroniGenNHibernate.Exceptions.ModelException) { throw ex; } throw new ChroniGenNHibernate.Exceptions.DataLayerException("Error in SpecialtyCAD.", ex); } finally { SessionClose(); } }
public SpecialtyEN ReadOIDDefault(int identifier ) { SpecialtyEN specialtyEN = null; try { SessionInitializeTransaction(); specialtyEN = (SpecialtyEN)session.Get(typeof(SpecialtyEN), identifier); SessionCommit(); } catch (Exception ex) { SessionRollBack(); if (ex is ChroniGenNHibernate.Exceptions.ModelException) { throw ex; } throw new ChroniGenNHibernate.Exceptions.DataLayerException("Error in SpecialtyCAD.", ex); } finally { SessionClose(); } return(specialtyEN); }
public int New_(SpecialtyEN specialty) { try { SessionInitializeTransaction(); session.Save(specialty); SessionCommit(); } catch (Exception ex) { SessionRollBack(); if (ex is ChroniGenNHibernate.Exceptions.ModelException) { throw ex; } throw new ChroniGenNHibernate.Exceptions.DataLayerException("Error in SpecialtyCAD.", ex); } finally { SessionClose(); } return(specialty.Identifier); }
// GET: DashBoard/Especialidad/Details/5 public ActionResult Details(int id = 0) { SessionInitialize(); string resultado = ""; SpecialtyCAD cadLoc = new SpecialtyCAD(); SpecialtyCEN cen = new SpecialtyCEN(cadLoc); SpecialtyEN locEN = cen.ReadOID(id); Dictionary <string, string> res = new Dictionary <string, string>(); if (locEN != null) { resultado = "<ul><li><strong>Id: </strong>" + locEN.Identifier + "</li><li><strong>Código: </strong>" + locEN.Code + "</li><li><strong>Nombre: </strong>" + locEN.Display + "</ul>"; res.Add("titulo", Resources.textos.detailsModal); } else { resultado = "<p>" + Resources.textos.errorDataModal + " " + id.ToString() + "</p>"; res.Add("titulo", Resources.textos.modalTitulo); } res.Add("contenido", resultado); SessionClose(); return(Json(res)); }
// GET: DashBoard/Especialidad/Delete/5 public ActionResult Delete(int id) { ViewBag.menu = "Specialities"; SessionInitialize(); SpecialtyCAD cadPos = new SpecialtyCAD(); SpecialtyCEN cen = new SpecialtyCEN(cadPos); cen.Destroy(id); SpecialtyEN pos = cen.ReadOID(id); SessionClose(); if (pos == null) { TempData["resultado"] = Resources.textos.deleteOK; TempData["ok"] = "success"; } else { TempData["resultado"] = Resources.textos.errorKO; TempData["ok"] = "danger"; } return(RedirectToAction("Index")); }
public ActionResult Edit(int id, FormCollection collection) { ViewBag.menu = "Specialities"; SpecialtyCAD cadPos = new SpecialtyCAD(); SpecialtyCEN cen = new SpecialtyCEN(cadPos); SpecialtyEN positionEN = null; try { positionEN = cen.ReadOID(id); positionEN.Display = collection["Nombre"].ToString(); cen.Modify(positionEN.Identifier, positionEN.Code, positionEN.Display); TempData["resultado"] = Resources.textos.editOK; TempData["ok"] = "success"; return(RedirectToAction("Index")); } catch (Exception ex) { positionEN = cen.ReadOID(id); ViewBag.error = ex.Message; return(View(positionEN)); } }
public Especialidad ConvertENToModelUI(SpecialtyEN en) { Especialidad pos = new Especialidad(); pos.id = en.Identifier; pos.nombre = en.Display; return(pos); }
public SpecialtyEN ReadOID(int identifier ) { SpecialtyEN specialtyEN = null; specialtyEN = _ISpecialtyCAD.ReadOID(identifier); return(specialtyEN); }
public void Modify(int p_Specialty_OID, string p_code, string p_display) { SpecialtyEN specialtyEN = null; //Initialized SpecialtyEN specialtyEN = new SpecialtyEN(); specialtyEN.Identifier = p_Specialty_OID; specialtyEN.Code = p_code; specialtyEN.Display = p_display; //Call to SpecialtyCAD _ISpecialtyCAD.Modify(specialtyEN); }
public int New_(string p_code, string p_display) { SpecialtyEN specialtyEN = null; int oid; //Initialized SpecialtyEN specialtyEN = new SpecialtyEN(); specialtyEN.Code = p_code; specialtyEN.Display = p_display; //Call to SpecialtyCAD oid = _ISpecialtyCAD.New_(specialtyEN); return(oid); }
// GET: DashBoard/Practitioners/Details/5 public ActionResult Details(int id) { SessionInitialize(); string resultado = ""; string specialidad = ""; PractitionerCAD cadLoc = new PractitionerCAD(); PractitionerCEN cen = new PractitionerCEN(cadLoc); SpecialtyCAD speCad = new SpecialtyCAD(); SpecialtyCEN speCen = new SpecialtyCEN(speCad); PractitionerEN locEN = cen.ReadOID(id); if (locEN.Specialty != null && locEN.Specialty.Identifier > 0) { SpecialtyEN specEN = speCen.ReadOID(locEN.Specialty.Identifier); specialidad = specEN.Display; } else { specialidad = Resources.textos.modelEmpty; } Dictionary <string, string> res = new Dictionary <string, string>(); if (locEN != null) { resultado = "<ul><li><strong>Id: </strong>" + locEN.Identifier + "</li><li><strong>Nombre: </strong>" + locEN.Name + "</li><li><strong>Teléfono: </strong>" + locEN.Phone + "</li><li><strong>Email: </strong>" + locEN.Email + "</li> <li><strong>Especialidad: </strong>" + specialidad + "</li> <li><strong>Dirección: </strong>" + locEN.Address + "</li></ul>"; res.Add("titulo", Resources.textos.detailsModal); } else { resultado = "<p>" + Resources.textos.errorDataModal + " " + id.ToString() + "</p>"; res.Add("titulo", Resources.textos.modalTitulo); } res.Add("contenido", resultado); SessionClose(); return(Json(res)); }
// GET: DashBoard/Practitioners/Create public ActionResult Create() { ViewBag.menu = "Practitioners"; SpecialtyCAD speCad = new SpecialtyCAD(); SpecialtyCEN speCen = new SpecialtyCEN(speCad); SpecialtyEN speEn = new SpecialtyEN(); speEn.Identifier = 0; speEn.Display = "Ninguna especialidad"; IList <SpecialtyEN> especialidadesBD = speCen.ReadAll(0, -1); especialidadesBD.Insert(0, speEn); var especialidades = especialidadesBD.OrderBy(p => p.Identifier); ViewBag.especialidades = new SelectList(especialidades, "identifier", "display"); return(View()); }
// GET: DashBoard/Especialidad/Edit/5 public ActionResult Edit(int id) { ViewBag.menu = "Specialities"; SpecialtyEN locationEN = null; Especialidad loc = null; try { SessionInitialize(); SpecialtyCAD cadPos = new SpecialtyCAD(); SpecialtyCEN cen = new SpecialtyCEN(cadPos); locationEN = cen.ReadOID(id); loc = new AssemblerEspecialidad().ConvertENToModelUI(locationEN); SessionClose(); } catch (Exception ex) { ViewBag.error = "Error: " + ex.Message; } return(View(loc)); }
// GET: DashBoard/Practitioners/Edit/5 public ActionResult Edit(int id) { ViewBag.menu = "Practitioners"; PractitionerEN locationEN = null; Practitioner loc = null; try { SessionInitialize(); PractitionerCAD cadPos = new PractitionerCAD(); PractitionerCEN cen = new PractitionerCEN(cadPos); SpecialtyCAD speCad = new SpecialtyCAD(); SpecialtyCEN speCen = new SpecialtyCEN(speCad); SpecialtyEN speEn = new SpecialtyEN(); locationEN = cen.ReadOID(id); loc = new AssemblerPractitioner().ConvertENToModelUI(locationEN); speEn.Identifier = 0; speEn.Display = Administracion.Resources.textos.errorKO; IList <SpecialtyEN> especialidadesBD = speCen.ReadAll(0, -1); especialidadesBD.Insert(0, speEn); var especialidades = especialidadesBD.OrderBy(p => p.Identifier); ViewBag.especialidades = new SelectList(especialidades, "identifier", "display", loc.Especialidad); SessionClose(); } catch (Exception ex) { ViewBag.error = "Error" + ex.Message; } return(View(loc)); }