// GET: Admin/Delete/5 public ActionResult Delete(int id) { try { /*SessionInitialize(); * AdminCAD adminCAD = new AdminCAD(session); * AdminCEN adminCEN = new AdminCEN(adminCAD); * AdminEN adminEN = adminCEN.ReadOID(id); * AdminViewModel art = new AssemblerAdmin().ConvertENToModelUI(adminEN); * SessionClose(); * * new AdminCEN().Destroy(id); * * * return RedirectToAction("Index");*/ SessionInitialize(); AdminCAD adminCAD = new AdminCAD(session); AdminCEN adminCEN = new AdminCEN(adminCAD); AdminEN adminEN = adminCEN.ReadOID(id); AdminViewModel adminVM = new AssemblerAdmin().ConvertENToModelUI(adminEN); SessionClose(); return(View(adminVM)); } catch { return(View()); } //return View(); }
public string New_(string p_nombre, string p_apellidos, String p_contrasenya, string p_email, string p_direccion, string p_tarjeta, string p_imagen) { AdminEN adminEN = null; string oid; //Initialized AdminEN adminEN = new AdminEN(); adminEN.Nombre = p_nombre; adminEN.Apellidos = p_apellidos; adminEN.Contrasenya = Utils.Util.GetEncondeMD5(p_contrasenya); adminEN.Email = p_email; adminEN.Direccion = p_direccion; adminEN.Tarjeta = p_tarjeta; adminEN.Imagen = p_imagen; //Call to AdminCAD oid = _IAdminCAD.New_(adminEN); return(oid); }
public void BorrarAdmin(int usuarioID ) { try { SessionInitializeTransaction(); AdminEN adminEN = (AdminEN)session.Load(typeof(AdminEN), usuarioID); session.Delete(adminEN); SessionCommit(); } catch (Exception ex) { SessionRollBack(); if (ex is BookReViewGenNHibernate.Exceptions.ModelException) { throw ex; } throw new BookReViewGenNHibernate.Exceptions.DataLayerException("Error in AdminCAD.", ex); } finally { SessionClose(); } }
public int New_(string p_nombre, string p_apellidos, int p_edad, Nullable <DateTime> p_fecha_nac, string p_dni, String p_contraseña, string p_n_usuario, DSM1GenNHibernate.EN.DSM1.CarritoEN p_carrito) { AdminEN adminEN = null; int oid; //Initialized AdminEN adminEN = new AdminEN(); adminEN.Nombre = p_nombre; adminEN.Apellidos = p_apellidos; adminEN.Edad = p_edad; adminEN.Fecha_nac = p_fecha_nac; adminEN.Dni = p_dni; adminEN.Contraseña = Utils.Util.GetEncondeMD5(p_contraseña); adminEN.N_usuario = p_n_usuario; adminEN.Carrito = p_carrito; //Call to AdminCAD oid = _IAdminCAD.New_(adminEN); return(oid); }
public int New_(int p_usuario, string p_nombre, int p_ID) { AdminEN adminEN = null; int oid; //Initialized AdminEN adminEN = new AdminEN(); if (p_usuario != -1) { // El argumento p_usuario -> Property usuario es oid = false // Lista de oids ID adminEN.Usuario = new WhateverGenNHibernate.EN.Whatever.UsuarioEN(); adminEN.Usuario.ID = p_usuario; } adminEN.Nombre = p_nombre; adminEN.ID = p_ID; //Call to AdminCAD oid = _IAdminCAD.New_(adminEN); return(oid); }
public string New_(string p_email, string p_nombre, string p_apellidos, string p_nick, String p_contrasenya, Nullable <DateTime> p_fecha_nac, DSMGitGenNHibernate.Enumerated.DSMGit.RolEnum p_rol, string p_imagen, string p_descripcion) { AdminEN adminEN = null; string oid; //Initialized AdminEN adminEN = new AdminEN(); adminEN.Email = p_email; adminEN.Nombre = p_nombre; adminEN.Apellidos = p_apellidos; adminEN.Nick = p_nick; adminEN.Contrasenya = Utils.Util.GetEncondeMD5(p_contrasenya); adminEN.Fecha_nac = p_fecha_nac; adminEN.Rol = p_rol; adminEN.Imagen = p_imagen; adminEN.Descripcion = p_descripcion; //Call to AdminCAD oid = _IAdminCAD.New_(adminEN); return(oid); }
// GET: Admin/Delete/5 public ActionResult Delete(int id) { try { // TODO: Add delete logic here //int idCategoria = -1; SessionInitialize(); AdminCAD adminCAD = new AdminCAD(session); AdminCEN adminCEN = new AdminCEN(adminCAD); AdminEN adminEN = adminCEN.ReadOID(id); AdminViewModel art = new AssemblerAdmin().ConvertENToModelUI(adminEN); //idCategoria = art.IdCategoria; SessionClose(); new AdminCEN().Destroy(id); //return RedirectToAction("PorCategoria", new { id = idCategoria }); return(RedirectToAction("Index")); } catch { return(View()); } //return View(); }
public int NewAdmin(AdminEN admin) { try { SessionInitializeTransaction(); session.Save(admin); SessionCommit(); } catch (Exception ex) { SessionRollBack(); if (ex is PickadosGenNHibernate.Exceptions.ModelException) { throw ex; } throw new PickadosGenNHibernate.Exceptions.DataLayerException("Error in AdminCAD.", ex); } finally { SessionClose(); } return(admin.Id); }
public Usuario ConvertENToModelUI(AdminEN en) { Usuario art = new Usuario(); //art.id = en.; art.Nombre = en.Nombre; art.Apellidos = en.Apellidos; art.Password = en.Contrasenya; art.Email = en.Email; art.Direccion = en.Direccion; art.Tarjeta = en.Tarjeta; art.Imagen = en.Imagen; if (en.Lista != null) { art.siguiendo = en.Lista.ElementAt(0).Id; art.favorito = en.Lista.ElementAt(1).Id; art.visto = en.Lista.ElementAt(2).Id; } if (en.Carrito != null) { art.carrito = en.Carrito.Id; } return(art); }
//Sin e: GetID //Con e: AdminEN public AdminEN GetID(int ID ) { AdminEN adminEN = null; try { SessionInitializeTransaction(); adminEN = (AdminEN)session.Get(typeof(AdminEN), ID); SessionCommit(); } catch (Exception ex) { SessionRollBack(); if (ex is WhateverGenNHibernate.Exceptions.ModelException) { throw ex; } throw new WhateverGenNHibernate.Exceptions.DataLayerException("Error in AdminCAD.", ex); } finally { SessionClose(); } return(adminEN); }
public void Modify(AdminEN admin) { try { SessionInitializeTransaction(); AdminEN adminEN = (AdminEN)session.Load(typeof(AdminEN), admin.ID); adminEN.Nombre = admin.Nombre; session.Update(adminEN); SessionCommit(); } catch (Exception ex) { SessionRollBack(); if (ex is WhateverGenNHibernate.Exceptions.ModelException) { throw ex; } throw new WhateverGenNHibernate.Exceptions.DataLayerException("Error in AdminCAD.", ex); } finally { SessionClose(); } }
public int New_(AdminEN admin) { try { SessionInitializeTransaction(); if (admin.Usuario != null) { // Argumento OID y no colección. admin.Usuario = (WhateverGenNHibernate.EN.Whatever.UsuarioEN)session.Load(typeof(WhateverGenNHibernate.EN.Whatever.UsuarioEN), admin.Usuario.ID); admin.Usuario.Admin = admin; } session.Save(admin); SessionCommit(); } catch (Exception ex) { SessionRollBack(); if (ex is WhateverGenNHibernate.Exceptions.ModelException) { throw ex; } throw new WhateverGenNHibernate.Exceptions.DataLayerException("Error in AdminCAD.", ex); } finally { SessionClose(); } return(admin.ID); }
public void Modify(AdminEN admin) { try { SessionInitializeTransaction(); AdminEN adminEN = (AdminEN)session.Load(typeof(AdminEN), admin.Id); adminEN.Email = admin.Email; adminEN.Pass = admin.Pass; adminEN.Fecha_inscripcion = admin.Fecha_inscripcion; session.Update(adminEN); SessionCommit(); } catch (Exception ex) { SessionRollBack(); if (ex is LePapeoGenNHibernate.Exceptions.ModelException) { throw ex; } throw new LePapeoGenNHibernate.Exceptions.DataLayerException("Error in AdminCAD.", ex); } finally { SessionClose(); } }
public AdminEN ReadOIDDefault(string email ) { AdminEN adminEN = null; try { SessionInitializeTransaction(); adminEN = (AdminEN)session.Get(typeof(AdminEN), email); SessionCommit(); } catch (Exception ex) { SessionRollBack(); if (ex is DSMGitGenNHibernate.Exceptions.ModelException) { throw ex; } throw new DSMGitGenNHibernate.Exceptions.DataLayerException("Error in AdminCAD.", ex); } finally { SessionClose(); } return(adminEN); }
public int New_(string p_nombre, string p_alias, Nullable <DateTime> p_fechaRegistro, String p_password, string p_email, bool p_suscrito, int p_idioma, string p_imagen) { AdminEN adminEN = null; int oid; //Initialized AdminEN adminEN = new AdminEN(); adminEN.Nombre = p_nombre; adminEN.Alias = p_alias; adminEN.FechaRegistro = p_fechaRegistro; adminEN.Password = Utils.Util.GetEncondeMD5(p_password); adminEN.Email = p_email; adminEN.Suscrito = p_suscrito; if (p_idioma != -1) { // El argumento p_idioma -> Property idioma es oid = false // Lista de oids id adminEN.Idioma = new OscarsitosGenNHibernate.EN.Oscarsitos.IdiomaEN(); adminEN.Idioma.Id = p_idioma; } adminEN.Imagen = p_imagen; //Call to AdminCAD oid = _IAdminCAD.New_(adminEN); return(oid); }
public string New_(AdminEN admin) { try { SessionInitializeTransaction(); session.Save(admin); SessionCommit(); } catch (Exception ex) { SessionRollBack(); if (ex is DSMGitGenNHibernate.Exceptions.ModelException) { throw ex; } throw new DSMGitGenNHibernate.Exceptions.DataLayerException("Error in AdminCAD.", ex); } finally { SessionClose(); } return(admin.Email); }
public void ModificarAdmin(AdminEN admin) { try { SesssionInitializeTransaction(); AdminEN adminEN = (AdminEN)session.Load(typeof(AdminEN), admin.IdAdmin); adminEN.Email = admin.Email; adminEN.Passwd = admin.Passwd; adminEN.Nombre = admin.Nombre; session.Update(adminEN); SessionCommit(); } catch (Exception ex) { SessionRollBack(); if (ex is ModelException) { throw ex; } throw new DataLayerException("Error in AdminCAD.", ex); } finally { SessionClose(); } }
public void Destroy(string Usr) { try { SessionInitializeTransaction(); AdminEN adminEN = (AdminEN)session.Load(typeof(AdminEN), Usr); session.Delete(adminEN); SessionCommit(); } catch (Exception ex) { SessionRollBack(); if (ex is RetappGenNHibernate.Exceptions.ModelException) { throw ex; } throw new RetappGenNHibernate.Exceptions.DataLayerException("Error in AdminCAD.", ex); } finally { SessionClose(); } }
public int New_(AdminEN admin) { try { SessionInitializeTransaction(); if (admin.Carrito != null) { // p_carrito admin.Carrito.Registrado = admin; session.Save(admin.Carrito); } session.Save(admin); SessionCommit(); } catch (Exception ex) { SessionRollBack(); if (ex is DSM1GenNHibernate.Exceptions.ModelException) { throw ex; } throw new DSM1GenNHibernate.Exceptions.DataLayerException("Error in AdminCAD.", ex); } finally { SessionClose(); } return(admin.Id); }
public AdminEN ReadOIDDefault(int idAdmin) { AdminEN adminEN = null; try { SesssionInitializeTransaction(); adminEN = (AdminEN)session.Load(typeof(AdminEN), idAdmin ); SessionCommit(); } catch (Exception ex) { SessionRollBack(); if (ex is ModelException) { throw ex; } throw new DataLayerException("Error in AdminCAD.", ex); } finally { SessionClose(); } return(adminEN); }
public int CrearAdmin(AdminEN admin) { try { SesssionInitializeTransaction(); session.Save(admin); SessionCommit(); } catch (Exception ex) { SessionRollBack(); if (ex is ModelException) { throw ex; } throw new DataLayerException("Error in AdminCAD.", ex); } finally { SessionClose(); } return(admin.IdAdmin); }
public void EliminarAdmin(int idAdmin) { try { SesssionInitializeTransaction(); AdminEN adminEN = (AdminEN)session.Load(typeof(AdminEN), idAdmin ); session.Delete(adminEN); SessionCommit(); } catch (Exception ex) { SessionRollBack(); if (ex is ModelException) { throw ex; } throw new DataLayerException("Error in AdminCAD.", ex); } finally { SessionClose(); } }
public int New_(AdminEN admin) { try { SessionInitializeTransaction(); if (admin.Idioma != null) { // Argumento OID y no colección. admin.Idioma = (OscarsitosGenNHibernate.EN.Oscarsitos.IdiomaEN)session.Load(typeof(OscarsitosGenNHibernate.EN.Oscarsitos.IdiomaEN), admin.Idioma.Id); admin.Idioma.Conectado .Add(admin); } session.Save(admin); SessionCommit(); } catch (Exception ex) { SessionRollBack(); if (ex is OscarsitosGenNHibernate.Exceptions.ModelException) { throw ex; } throw new OscarsitosGenNHibernate.Exceptions.DataLayerException("Error in AdminCAD.", ex); } finally { SessionClose(); } return(admin.Id); }
// Modify default (Update all attributes of the class) public void ModifyDefault(AdminEN admin) { try { SessionInitializeTransaction(); AdminEN adminEN = (AdminEN)session.Load(typeof(AdminEN), admin.Email); session.Update(adminEN); SessionCommit(); } catch (Exception ex) { SessionRollBack(); if (ex is DSMGitGenNHibernate.Exceptions.ModelException) { throw ex; } throw new DSMGitGenNHibernate.Exceptions.DataLayerException("Error in AdminCAD.", ex); } finally { SessionClose(); } }
public AdminEN ReadOID(string Email ) { AdminEN adminEN = null; adminEN = _IAdminCAD.ReadOID(Email); return(adminEN); }
public AdminEN ReadOID(int usuarioID ) { AdminEN adminEN = null; adminEN = _IAdminCAD.ReadOID(usuarioID); return(adminEN); }
public AdminEN ReadOID(int id ) { AdminEN adminEN = null; adminEN = _IAdminCAD.ReadOID(id); return(adminEN); }
public AdminEN GetID(int ID ) { AdminEN adminEN = null; adminEN = _IAdminCAD.GetID(ID); return(adminEN); }
public AdminEN DamePorID(int idAdmin) { AdminEN adminEN = null; adminEN = _IAdminCAD.DamePorID( idAdmin ); return(adminEN); }
public void Modify(int p_Admin_OID) { AdminEN adminEN = null; //Initialized AdminEN adminEN = new AdminEN(); adminEN.Id = p_Admin_OID; //Call to AdminCAD _IAdminCAD.Modify(adminEN); }