public bool actualizarRegistro(eAUDITORIA oeAUDITORIA) { using (SqlConnection cnn = new SqlConnection(ConfigurationManager.ConnectionStrings["CadenaPrincipal"].ToString())) { string sp = "pa_crud_AUDITORIA_actualizarRegistro"; SqlCommand cmd = new SqlCommand(sp, cnn); cmd.CommandType = CommandType.StoredProcedure; cnn.Open(); cmd.Parameters.Add(new SqlParameter("@AUDITID", oeAUDITORIA.AuditID)); //variable tipo:int cmd.Parameters.Add(new SqlParameter("@TYPE", oeAUDITORIA.Type)); //variable tipo:string cmd.Parameters.Add(new SqlParameter("@TABLENAME", oeAUDITORIA.TableName)); //variable tipo:string cmd.Parameters.Add(new SqlParameter("@PRIMARYKEYFIELD", oeAUDITORIA.PrimaryKeyField)); //variable tipo:string cmd.Parameters.Add(new SqlParameter("@PRIMARYKEYVALUE", oeAUDITORIA.PrimaryKeyValue)); //variable tipo:string cmd.Parameters.Add(new SqlParameter("@FIELDNAME", oeAUDITORIA.FieldName)); //variable tipo:string cmd.Parameters.Add(new SqlParameter("@OLDVALUE", (object)oeAUDITORIA.OldValue ?? DBNull.Value)); //variable tipo:string cmd.Parameters.Add(new SqlParameter("@NEWVALUE", oeAUDITORIA.NewValue)); //variable tipo:string cmd.Parameters.Add(new SqlParameter("@UPDATEDATE", oeAUDITORIA.UpdateDate)); //variable tipo:DateTime cmd.Parameters.Add(new SqlParameter("@USUARIOAPP", oeAUDITORIA.UsuarioApp)); //variable tipo:string cmd.Parameters.Add(new SqlParameter("@SERVIDOR", oeAUDITORIA.Servidor)); //variable tipo:string cmd.Parameters.Add(new SqlParameter("@USERNAME", oeAUDITORIA.UserName)); //variable tipo:string cmd.Parameters.Add(new SqlParameter("@ESTACION", oeAUDITORIA.Estacion)); //variable tipo:string return(cmd.ExecuteNonQuery() > 0); } }
public bool eliminarRegistro(eAUDITORIA oeAUDITORIA) { using (SqlConnection cnn = new SqlConnection(ConfigurationManager.ConnectionStrings["CadenaPrincipal"].ToString())) { string sp = "pa_crud_AUDITORIA_eliminarRegistro"; SqlCommand cmd = new SqlCommand(sp, cnn); cmd.CommandType = CommandType.StoredProcedure; cnn.Open(); cmd.Parameters.Add(new SqlParameter("@AUDITID", oeAUDITORIA.AuditID)); return(cmd.ExecuteNonQuery() > 0); } }
public DataTable obtenerRegistro(eAUDITORIA oeAUDITORIA) { using (SqlConnection cnn = new SqlConnection(ConfigurationManager.ConnectionStrings["CadenaPrincipal"].ToString())) { string sp = "pa_crud_AUDITORIA_obtenerRegistro"; SqlCommand cmd = new SqlCommand(sp, cnn); cmd.CommandType = CommandType.StoredProcedure; SqlDataAdapter dad = new SqlDataAdapter(cmd); dad.SelectCommand.Parameters.Add(new SqlParameter("@AUDITID", oeAUDITORIA.AuditID)); DataTable dt = new DataTable(); dad.Fill(dt); return(dt); } }