/* public MenuItemsUsuarios MenuItemsUsuariosGetById(string Id) * { * try * { * DataSet ds = new DataSet(); * Conexion oConexion = new Conexion(); * OracleConnection cn = oConexion.getConexion(); * cn.Open(); * string sqlSelect = "select * from MenuItemsUsuarios " + * "where Men_CODIGO='" + Id + "' "; * cmd = new OracleCommand(sqlSelect, cn); * adapter = new OracleDataAdapter(cmd); * cmd.ExecuteNonQuery(); * adapter.Fill(ds); * DataTable dt; * dt = ds.Tables[0]; * MenuItemsUsuarios NewEnt = new MenuItemsUsuarios(); * if (dt.Rows.Count > 0) * { * DataRow dr = dt.Rows[0]; * NewEnt = CargarMenuItemsUsuarios(dr); * } * return NewEnt; * } * catch (Exception ex) * { * throw ex; * } * } */ public List <MenuItemsUsuarios> MenuItemsUsuariosGetAll() { List <MenuItemsUsuarios> lstMenuItemsUsuarios = new List <MenuItemsUsuarios>(); try { ds = new DataSet(); Conexion oConexion = new Conexion(); OracleConnection cn = oConexion.getConexion(); cn.Open(); string sqlSelect = "select * from Menu_Items_Usuarios "; cmd = new OracleCommand(sqlSelect, cn); adapter = new OracleDataAdapter(cmd); cmd.ExecuteNonQuery(); adapter.Fill(ds); DataTable dt = new DataTable(); dt = ds.Tables[0]; if (dt.Rows.Count > 0) { for (int i = 0; dt.Rows.Count > i; i++) { DataRow dr = dt.Rows[i]; MenuItemsUsuarios NewEnt = new MenuItemsUsuarios(); NewEnt = CargarMenuItemsUsuarios(dr); lstMenuItemsUsuarios.Add(NewEnt); } } return(lstMenuItemsUsuarios); } catch (Exception ex) { throw ex; } }
private MenuItemsUsuarios CargarMenuItemsUsuarios(DataRow dr) { try { MenuItemsUsuarios oObjeto = new MenuItemsUsuarios(); oObjeto.MniCodigo = dr["MNI_CODIGO"].ToString(); oObjeto.UsrNumero = int.Parse(dr["USR_NUMERO"].ToString()); oObjeto.RolCodigo = dr["ROL_CODIGO"].ToString(); oObjeto.MiuSoloLectura = dr["MIU_SOLO_LECTURA"].ToString(); return(oObjeto); } catch (Exception ex) { throw ex; } }
public bool MenuItemsUsuariosDelete(MenuItemsUsuarios oMen) { try { Conexion oConexion = new Conexion(); OracleConnection cn = oConexion.getConexion(); cn.Open(); ds = new DataSet(); cmd = new OracleCommand("DELETE Menu_Items_Usuarios " + "WHERE MNI_CODIGO='" + oMen.MniCodigo + "' and USR_NUMERO=" + oMen.UsrNumero + " and ROL_CODIGO='" + oMen.RolCodigo + "' and MIU_SOLO_LECTURA='" + oMen.MiuSoloLectura + "' ", cn); adapter = new OracleDataAdapter(cmd); response = cmd.ExecuteNonQuery(); cn.Close(); return(response > 0); } catch (Exception ex) { throw ex; } }
public int MenuItemsUsuariosAdd(MenuItemsUsuarios oMen) { try { Conexion oConexion = new Conexion(); OracleConnection cn = oConexion.getConexion(); cn.Open(); ds = new DataSet(); cmd = new OracleCommand("insert into Menu_Items_Usuarios(MNI_CODIGO, USR_NUMERO, ROL_CODIGO, MIU_SOLO_LECTURA) " + "values('" + oMen.MniCodigo + "'," + oMen.UsrNumero + ", '" + oMen.RolCodigo + "','" + oMen.MiuSoloLectura + "')", cn); adapter = new OracleDataAdapter(cmd); response = cmd.ExecuteNonQuery(); cn.Close(); return(response); } catch (Exception ex) { throw ex; } }