public List <Object> Listar(Object VO) { Dtt = null; try { Dtt = new DataTable(); Encabezado(); cmdComando.CommandText = "sp_Listar_Perfiles"; cmdComando.ExecuteNonQuery(); daAdapter = new SqlDataAdapter(cmdComando); daAdapter.Fill(Dtt); List <Object> lstPerfiles = new List <Object>(); for (int i = 0; i < Dtt.Rows.Count; i++) { VO_Perfiles perfil = new VO_Perfiles(); perfil.Id = int.Parse(Dtt.Rows[i][0].ToString()); perfil.NombreTipo = Dtt.Rows[i][1].ToString(); perfil.Descripcion = Dtt.Rows[i][2].ToString(); lstPerfiles.Add(perfil); } return(lstPerfiles); } catch (Exception e) { System.Windows.Forms.MessageBox.Show("Error: " + e); return(null); } finally { cnnConexion.Cerrar(); cmdComando.Dispose(); } }
public bool Insertar(Object VO) { Perfil = (VO_Perfiles)VO; try { Encabezado(); cmdComando.CommandText = "sp_Inserta_TipoRepresentante"; cmdComando.Parameters.AddWithValue("@Nombre", Perfil.NombreTipo); cmdComando.Parameters.AddWithValue("@Descripcion", Perfil.Descripcion); cmdComando.ExecuteNonQuery(); return(true); } catch (Exception e) { System.Windows.Forms.MessageBox.Show("Error: " + e); return(false); } finally { cnnConexion.Cerrar(); cmdComando.Dispose(); } }
public bool Eliminar(Object VO) { Perfil = (VO_Perfiles)VO; try { Encabezado(); cmdComando.CommandText = "sp_EliminarPerfil"; cmdComando.Parameters.AddWithValue("@Id", Perfil.Id); cmdComando.ExecuteNonQuery(); return(true); } catch (Exception e) { System.Windows.Forms.MessageBox.Show("Error: " + e); return(false); } finally { cnnConexion.Cerrar(); cmdComando.Dispose(); } }
public List <object> Listar(object VO) { VO_Perfiles Perfil = (VO_Perfiles)VO; Dtt = null; try { Dtt = new DataTable(); Encabezado(); cmdComando.CommandText = "sp_ListarPerfilReglas"; cmdComando.Parameters.AddWithValue("@idPerfil", Perfil.Id); cmdComando.ExecuteNonQuery(); daAdapter = new SqlDataAdapter(cmdComando); daAdapter.Fill(Dtt); List <Object> lstPerfiles = new List <Object>(); for (int i = 0; i < Dtt.Rows.Count; i++) { VO_PerfilReglas perfilReglas = new VO_PerfilReglas(); perfilReglas.Selected = (bool)Dtt.Rows[i][0]; perfilReglas.id = int.Parse(Dtt.Rows[i][1].ToString()); perfilReglas.Regla = Dtt.Rows[i][2].ToString(); lstPerfiles.Add(perfilReglas); } return(lstPerfiles); } catch (Exception e) { System.Windows.Forms.MessageBox.Show("Error: " + e); return(null); } finally { cnnConexion.Cerrar(); cmdComando.Dispose(); } }