public Boolean Guardar(clsPerfil Info, ref int IdPerfil) { try { using (TECAv8Entities Context = new TECAv8Entities()) { var contact = Perfil.CreatePerfil(0); var address = new Perfil(); address.IdEstado = Info.IdEstado; address.Descripcion = Info.Descripcion; address.IdPerfil = IdPerfil = GetId(); contact = address; Context.Perfil.AddObject(contact); Context.SaveChanges(); } return true; } catch (Exception) { return false; } }
public Boolean Guardar(List<Permiso> Lst, int IdPerfil , int IdModulo) { try { using (TECAv8Entities entity = new TECAv8Entities()) { int entiero = entity.ExecuteStoreCommand("Delete from Seguridad.Permiso where IdPerfil = "+IdPerfil +"and IdModulo = "+IdModulo); } int secuencia = 1; foreach (Permiso item in Lst) { using (TECAv8Entities entity = new TECAv8Entities()) { string query = "select isnull(MAX(IdPermiso)+1,1) from Seguridad.Permiso where IdPerfil=" + IdPerfil; item.IdPermiso = entity.ExecuteStoreQuery<int>(query).ToList().First(); secuencia++; entity.AddToPermiso(item); entity.SaveChanges(); } } return true; } catch (Exception) { return false; } }
public Boolean Guardar(List <Permiso> Lst, int IdPerfil, int IdModulo) { try { using (TECAv8Entities entity = new TECAv8Entities()) { int entiero = entity.ExecuteStoreCommand("Delete from Seguridad.Permiso where IdPerfil = " + IdPerfil + "and IdModulo = " + IdModulo); } int secuencia = 1; foreach (Permiso item in Lst) { using (TECAv8Entities entity = new TECAv8Entities()) { string query = "select isnull(MAX(IdPermiso)+1,1) from Seguridad.Permiso where IdPerfil=" + IdPerfil; item.IdPermiso = entity.ExecuteStoreQuery <int>(query).ToList().First(); secuencia++; entity.AddToPermiso(item); entity.SaveChanges(); } } return(true); } catch (Exception) { return(false); } }
public bool Modificar(clsEmpresa e) { try { using (TECAv8Entities ent = new TECAv8Entities()) { //busca por PK el primero que encuentre lo coge var x = (from a in ent.Empresa where a.IdEmpresa == e.idEmpresa select a).First(); x.RazonSocial = e.razonSocial; x.NombreComercial = e.nombreComercial; x.Ruc = e.ruc; x.Direccion = e.direccion; // x.IdImagen = e.idImagen; // x.Logo = e.logo; // x.Fondo = e.fondo; // x.FechaInicioSistema = e.fechaInicioSistema; x.Logotipo = e.logotipo; x.Correo = e.correo; x.SitioWeb = e.sitioWeb; x.Sector = e.sector; x.Descripcion = e.descripcion; x.IdEstado = e.idEstado; ent.SaveChanges(); } return(true); } catch (Exception ex) { Console.WriteLine("Error: " + ex); return(false); } }
//eliminado fisico.. no usar solo seguridad public void Eliminar(clsEmpresa e) { using (TECAv8Entities ent = new TECAv8Entities()) { //busca por PK el primero que encuentre lo coge var x = (from a in ent.Empresa where a.IdEmpresa == e.idEmpresa select a).First(); ent.DeleteObject(x);//elimina el registro ent.SaveChanges(); } }
public static bool Eliminar(clsUsuario u) { try { TECAv8Entities ent = new TECAv8Entities(); var x = (from a in ent.Usuario where a.IdUsuario == u.IdUsuario select a).First(); ent.DeleteObject(x); ent.SaveChanges(); return true; } catch (Exception) { return false; throw; } }
public static bool CambiarClave(clsUsuario u, string nuevaClave) { try { TECAv8Entities ent = new TECAv8Entities(); var x = (from a in ent.Usuario where a.NombreUsuario == u.NombreUsuario && a.Contrasena == u.Contrasena select a).First(); x.Contrasena = nuevaClave; ent.SaveChanges(); return true; } catch (Exception) { return false; throw; } }
public static bool CambiarClave(clsUsuario u, string nuevaClave) { try { TECAv8Entities ent = new TECAv8Entities(); var x = (from a in ent.Usuario where a.NombreUsuario == u.NombreUsuario && a.Contrasena == u.Contrasena select a).First(); x.Contrasena = nuevaClave; ent.SaveChanges(); return(true); } catch (Exception) { return(false); throw; } }
public static bool Eliminar(clsUsuario u) { try { TECAv8Entities ent = new TECAv8Entities(); var x = (from a in ent.Usuario where a.IdUsuario == u.IdUsuario select a).First(); ent.DeleteObject(x); ent.SaveChanges(); return(true); } catch (Exception) { return(false); throw; } }
//eliminado fisico.. no usar solo seguridad public bool Eliminar(clsEmpresa e) { try { using (TECAv8Entities ent = new TECAv8Entities()) { //busca por PK el primero que encuentre lo coge var x = (from a in ent.Empresa where a.IdEmpresa == e.idEmpresa select a).First(); ent.DeleteObject(x);//elimina el registro ent.SaveChanges(); } return(true); } catch (Exception ex) { Console.WriteLine("Eliminar Error: " + ex); return(false); } }
public bool ModificaruSUARIO(Usuario u) { try { TECAv8Entities ent = new TECAv8Entities(); var x = (from a in ent.Usuario where a.IdUsuario == u.IdUsuario select a).First(); x.NombreUsuario = u.NombreUsuario; x.Contrasena = u.Contrasena; x.IdEstado = u.IdEstado; x.IdPerfil = u.IdPerfil; ent.SaveChanges(); return(true); } catch (Exception) { return(false); } }
public bool Modificar(clsImagen e) { try { using (TECAv8Entities ent = new TECAv8Entities()) { //busca por PK el primero que encuentre lo coge var x = (from a in ent.Imagen where a.IdImagen == e.IdImagen select a).First(); x.Descripcion = e.Descripcion; x.Imagen1 = e.Imagen; ent.SaveChanges(); } return(true); } catch (Exception ex) { Console.WriteLine("Error: " + ex); return(false); } }
public bool eliminar(clsImagen ima) { try { using (TECAv8Entities ent = new TECAv8Entities()) { //hago un where por el primarykey codigo var x = (from q in ent.Imagen where q.IdImagen == ima.IdImagen select q).First(); //eliminar es muy parecido //elimina el registro que me trajo el select ent.DeleteObject(x); ent.SaveChanges(); } return(true); } catch (Exception) { return(false); } }
public bool ModificaruSUARIO(Usuario u) { try { TECAv8Entities ent = new TECAv8Entities(); var x = (from a in ent.Usuario where a.IdUsuario == u.IdUsuario select a).First(); x.NombreUsuario = u.NombreUsuario; x.Contrasena = u.Contrasena; x.IdEstado = u.IdEstado; x.IdPerfil = u.IdPerfil; ent.SaveChanges(); return true; } catch (Exception) { return false; } }
public static bool GuardarEmpresa(clsUsuarioPorEmpresa uxp) { try { TECAv8Entities ent = new TECAv8Entities(); UsuarioPorEmpresa usuarioempresa = new UsuarioPorEmpresa() { IdUsuario = uxp.IdUsuario, IdEmpresa = uxp.IdEmpresa }; ent.AddToUsuarioPorEmpresa(usuarioempresa); ent.SaveChanges(); return true; } catch (Exception ex) { System.Windows.Forms.MessageBox.Show("Error!" + ex); return false; } }
public static bool GuardarEmpresa(clsUsuarioPorEmpresa uxp) { try { TECAv8Entities ent = new TECAv8Entities(); UsuarioPorEmpresa usuarioempresa = new UsuarioPorEmpresa() { IdUsuario = uxp.IdUsuario, IdEmpresa = uxp.IdEmpresa, Descripcion = uxp.Descripcion, }; ent.AddToUsuarioPorEmpresa(usuarioempresa); ent.SaveChanges(); return(true); } catch (Exception ex) { // System.Windows.Forms.MessageBox.Show("Error!" + ex); return(false); } }
public bool eliminar(clsImagen ima) { try { using (TECAv8Entities ent = new TECAv8Entities()) { //hago un where por el primarykey codigo var x = (from q in ent.Imagen where q.IdImagen == ima.IdImagen select q).First(); //eliminar es muy parecido //elimina el registro que me trajo el select ent.DeleteObject(x); ent.SaveChanges(); } return true; } catch (Exception) { return false; } }
public Boolean GuardarImagen(clsImagen info) { try { using (TECAv8Entities ent = new TECAv8Entities()) { Imagen img = new Imagen() { IdImagen = info.IdImagen, Descripcion = info.Descripcion, Imagen1 = info.Imagen, }; ent.AddToImagen(img); ent.SaveChanges(); } return(true); } catch (Exception) { return(false); } }
public void Guardar(clsHorario Info) { using (TECAv8Entities Context = new TECAv8Entities()) { var contact = Horario.CreateHorario(0, 0, 0, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true); var Address = new Horario(); Address.IdHorario = GetId(); Address.IdPerfil = Info.IdPerfil; Address.dia = Info.dia; Address.H00 = Info.H00; Address.H01 = Info.H01; Address.H02 = Info.H02; Address.H03 = Info.H03; Address.H04 = Info.H04; Address.H05 = Info.H05; Address.H06 = Info.H06; Address.H07 = Info.H07; Address.H08 = Info.H08; Address.H09 = Info.H09; Address.H10 = Info.H10; Address.H11 = Info.H11; Address.H12 = Info.H12; Address.H13 = Info.H13; Address.H14 = Info.H14; Address.H15 = Info.H15; Address.H16 = Info.H16; Address.H17 = Info.H17; Address.H18 = Info.H18; Address.H19 = Info.H19; Address.H20 = Info.H20; Address.H21 = Info.H21; Address.H22 = Info.H22; Address.H23 = Info.H23; contact = Address; Context.Horario.AddObject(contact); Context.SaveChanges(); } }
public bool Guardar(clsEmpresa e) { try { int id = getIdSiguiente(); e.idEmpresa = id; using (TECAv8Entities ent = new TECAv8Entities()) { //se instancia el entity para poder usar los nombres de las tablas Empresa empresa = new Empresa() { IdEmpresa = e.idEmpresa, RazonSocial = e.razonSocial, NombreComercial = e.nombreComercial, Ruc = e.ruc, Direccion = e.direccion, //IdImagen = e.idImagen, //Logo = e.logo, //Fondo = e.fondo, Logotipo = e.logotipo, //FechaInicioSistema = e.fechaInicioSistema, Correo = e.correo, SitioWeb = e.sitioWeb, Sector = e.sector, Descripcion = e.descripcion, IdEstado = e.idEstado }; //ent.AddObject("Empresa", empresa); ent.AddToEmpresa(empresa); ent.SaveChanges(); } return(true); } catch (Exception ex) { Console.WriteLine("Error al guardar: " + ex); return(false); } }
public int Guardar(string descripcion) {//se recomienda no usar try { int id = getIdSiguiente(); using (TECAv8Entities ent = new TECAv8Entities()) { Estado estado = new Estado() { IdEstado = id, Descripcion = descripcion }; ent.AddToEstado(estado); ent.SaveChanges(); return(id);//devuelve el id de ese estado guardado } } catch (Exception e) { Console.WriteLine("Error: " + e); return(0); } }
public Boolean GuardarImagen(clsImagen info) { try { using (TECAv8Entities ent = new TECAv8Entities()) { Imagen img = new Imagen() { IdImagen = info.IdImagen, Descripcion = info.Descripcion, Imagen1 = info.Imagen, }; ent.AddToImagen(img); ent.SaveChanges(); } return true; } catch (Exception) { return false; } }
public static bool Guardar(clsUsuario u) { try { TECAv8Entities ent = new TECAv8Entities(); Usuario usuario = new Usuario() { IdUsuario = u.IdUsuario, NombreUsuario = u.NombreUsuario, Contrasena = u.Contrasena, IdEstado = u.IdEstado, IdImagen = u.IdImagen, IdPerfil = u.IdPerfil }; ent.AddToUsuario(usuario); ent.SaveChanges(); return true; } catch (Exception ex) { System.Windows.Forms.MessageBox.Show("Error!" + ex); return false; } }
//recibe un objeto estado, busca segun descripcion, si NO existe lo guarda //al final retorna un objeto estado con el idEstado y descripcion deseados public clsEstado GuardarNuevoEstado(clsEstado oEstadoEntrante) { clsEstado oEstadoSaliente = new clsEstado(); try { int x = getIdSegunDescripcion(oEstadoEntrante.descripcion); if (x == 0) { int id = getIdSiguiente(); using (TECAv8Entities ent = new TECAv8Entities()) { Estado estado = new Estado() { IdEstado = oEstadoEntrante.idEstado, Descripcion = oEstadoEntrante.descripcion }; ent.AddToEstado(estado); ent.SaveChanges(); oEstadoSaliente = oEstadoEntrante; return(oEstadoSaliente);//devuelve el id de ese estado guardado } } else { oEstadoEntrante.idEstado = getIdSegunDescripcion(oEstadoEntrante.descripcion); oEstadoSaliente = oEstadoEntrante; return(oEstadoSaliente); } } catch (Exception e) { Console.WriteLine("Error: " + e); return(oEstadoSaliente); } }
public bool GuardarIS(int iduser, DateTime fechaIS) { try { int id = getIdSiguiente(); using (TECAv8Entities ent=new TECAv8Entities()) { Historial historial = new Historial() { IdHistorial = id, IdUsuario = iduser, FechaInicioSesion = fechaIS }; ent.AddToHistorial(historial); ent.SaveChanges(); } return true; } catch (Exception ex) { Console.WriteLine("Error: " + ex); return false; } }
public Boolean Guardar(clsPerfil Info, ref int IdPerfil) { try { using (TECAv8Entities Context = new TECAv8Entities()) { var contact = Perfil.CreatePerfil(0); var address = new Perfil(); address.IdEstado = Info.IdEstado; address.Descripcion = Info.Descripcion; address.IdPerfil = IdPerfil = GetId(); contact = address; Context.Perfil.AddObject(contact); Context.SaveChanges(); } return(true); } catch (Exception) { return(false); } }
public static bool Guardar(clsUsuario u) { try { TECAv8Entities ent = new TECAv8Entities(); Usuario usuario = new Usuario() { IdUsuario = u.IdUsuario, NombreUsuario = u.NombreUsuario, Contrasena = u.Contrasena, IdEstado = u.IdEstado, IdImagen = u.IdImagen, IdPerfil = u.IdPerfil }; ent.AddToUsuario(usuario); ent.SaveChanges(); return(true); } catch (Exception ex) { System.Windows.Forms.MessageBox.Show("Error!" + ex); return(false); } }
//recibe un objeto estado, busca segun descripcion, si NO existe lo guarda //al final retorna un objeto estado con el idEstado y descripcion deseados public clsEstado GuardarNuevoEstado(clsEstado oEstadoEntrante) { clsEstado oEstadoSaliente = new clsEstado(); try { int x = getIdSegunDescripcion(oEstadoEntrante.descripcion); if (x == 0) { int id = getIdSiguiente(); using (TECAv8Entities ent = new TECAv8Entities()) { Estado estado = new Estado() { IdEstado = oEstadoEntrante.idEstado, Descripcion = oEstadoEntrante.descripcion }; ent.AddToEstado(estado); ent.SaveChanges(); oEstadoSaliente = oEstadoEntrante; return oEstadoSaliente;//devuelve el id de ese estado guardado } } else { oEstadoEntrante.idEstado = getIdSegunDescripcion(oEstadoEntrante.descripcion); oEstadoSaliente = oEstadoEntrante; return oEstadoSaliente; } } catch (Exception e) { Console.WriteLine("Error: " + e); return oEstadoSaliente; } }
public clsEstado GuardarSimple(clsEstado oEntrante) { clsEstado oSaliente = new clsEstado(); try { oSaliente = Consultar(oEntrante); if (oSaliente.idEstado == 0) { int id = getIdSiguiente(); using (TECAv8Entities ent = new TECAv8Entities()) { Estado estado = new Estado() { IdEstado = id, Descripcion = oEntrante.descripcion }; ent.AddToEstado(estado); ent.SaveChanges(); oSaliente.idEstado = id; oSaliente.descripcion = oEntrante.descripcion; return oSaliente;//devuelve el id de ese estado guardado } } else { oSaliente = oEntrante; return oSaliente; } } catch (Exception e) { Console.WriteLine("Error: " + e); return oSaliente; } }
public int Guardar(string descripcion) { //se recomienda no usar try { int id = getIdSiguiente(); using (TECAv8Entities ent = new TECAv8Entities()) { Estado estado = new Estado() { IdEstado = id, Descripcion = descripcion }; ent.AddToEstado(estado); ent.SaveChanges(); return id;//devuelve el id de ese estado guardado } } catch (Exception e) { Console.WriteLine("Error: " + e); return 0; } }
public bool Modificar(clsImagen e) { try { using (TECAv8Entities ent = new TECAv8Entities()) { //busca por PK el primero que encuentre lo coge var x = (from a in ent.Imagen where a.IdImagen == e.IdImagen select a).First(); x.Descripcion = e.Descripcion; x.Imagen1 = e.Imagen; ent.SaveChanges(); } return true; } catch (Exception ex) { Console.WriteLine("Error: " + ex); return false; } }
public bool Modificar(clsEmpresa e) { try { using (TECAv8Entities ent = new TECAv8Entities()) { //busca por PK el primero que encuentre lo coge var x = (from a in ent.Empresa where a.IdEmpresa == e.idEmpresa select a).First(); x.RazonSocial = e.razonSocial; x.NombreComercial = e.nombreComercial; x.Ruc = e.ruc; x.Direccion = e.direccion; // x.IdImagen = e.idImagen; // x.Logo = e.logo; // x.Fondo = e.fondo; // x.FechaInicioSistema = e.fechaInicioSistema; x.Correo = e.correo; x.SitioWeb = e.sitioWeb; x.Descripcion = e.descripcion; x.IdEstado = e.idEstado; ent.SaveChanges(); } return true; } catch (Exception ex) { Console.WriteLine("Error: " +ex); return false; } }
public bool Guardar(clsEmpresa e) { try { int id = getIdSiguiente(); e.idEmpresa = id; using (TECAv8Entities ent = new TECAv8Entities()) { //se instancia el entity para poder usar los nombres de las tablas Empresa empresa = new Empresa() { IdEmpresa = e.idEmpresa, RazonSocial = e.razonSocial, NombreComercial = e.nombreComercial, Ruc = e.ruc, Direccion = e.direccion, //IdImagen = e.idImagen, //Logo = e.logo, //Fondo = e.fondo, Logotipo=e.logotipo, //FechaInicioSistema = e.fechaInicioSistema, Correo = e.correo, SitioWeb = e.sitioWeb, Descripcion = e.descripcion, IdEstado = e.idEstado }; //ent.AddObject("Empresa", empresa); ent.AddToEmpresa(empresa); ent.SaveChanges(); } return true; } catch (Exception ex) { Console.WriteLine("Error al guardar: " +ex); return false; } }
//eliminado fisico.. no usar solo seguridad public bool Eliminar(clsEmpresa e) { try { using (TECAv8Entities ent = new TECAv8Entities()) { //busca por PK el primero que encuentre lo coge var x = (from a in ent.Empresa where a.IdEmpresa == e.idEmpresa select a).First(); ent.DeleteObject(x);//elimina el registro ent.SaveChanges(); } return true; } catch (Exception ex) { Console.WriteLine("Eliminar Error: " + ex); return false; } }