public bool B_CreateMetrica(E_Metrica pObjMetrica) { if (String.IsNullOrEmpty(pObjMetrica.Metrica)) { throw new Exception("El campo de texto de metrica está vacío, por favor intente de nuevo."); } objMetrica = new D_Metrica(); return(objMetrica.InsertM_Metrica(pObjMetrica)); }
public void B_DeleteMetrica(E_Metrica e_Metrica) { try { objMetrica = new D_Metrica(); objMetrica.DeleteMetrica(e_Metrica); } catch (Exception ex) { throw ex; } }
public void B_UpdateMetrica(E_Metrica B_Metrica) { if (String.IsNullOrEmpty(B_Metrica.Metrica)) { throw new Exception("El campo de texto de métrica está vacío, por favor intente de nuevo."); } try { objMetrica = new D_Metrica(); objMetrica.UpdateMetrica(B_Metrica); } catch (Exception ex) { throw ex; } }
public bool InsertM_Metrica(E_Metrica ObjMetrica) { connectionBD = new D_ConnectionBD(); string command = "insert into Metrica (Metrica, IdObjetivo) values (@Metrica, @IdObjetivo)"; cmd = new SqlCommand(command, connectionBD.OpenConnection()); cmd.CommandType = CommandType.Text; cmd.Parameters.AddWithValue("@Metrica", ObjMetrica.Metrica); cmd.Parameters.AddWithValue("@IdObjetivo", ObjMetrica.IdObjective); try { return(connectionBD.EIDB(cmd)); } catch (Exception ex) { throw new Exception("Error al insertar los datos en la base de datos", ex); } }
public void DeleteMetrica(E_Metrica metrica) { string command = "delete from Metrica where IdMetrica = @IdMetrica"; try { connectionBD = new D_ConnectionBD(); cmd = new SqlCommand(command, connectionBD.OpenConnection()); cmd.CommandType = CommandType.Text; cmd.Parameters.Add(new SqlParameter("@IdMetrica", metrica.IdMetrica)); cmd.CommandTimeout = 0; cmd.ExecuteNonQuery(); } catch (Exception ex) { throw ex; } finally { cmd.Connection = connectionBD.CloseConnection(); cmd.Dispose(); } }
public void UpdateMetrica(E_Metrica metrica) { connectionBD = new D_ConnectionBD(); cmd = new SqlCommand("UpdateMetrica", connectionBD.OpenConnection()); try { cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add(new SqlParameter("@IdMetrica", metrica.IdMetrica)); cmd.Parameters.Add(new SqlParameter("@Metrica", metrica.Metrica)); cmd.Parameters.Add(new SqlParameter("@IdObjetivo", metrica.IdObjective)); cmd.CommandTimeout = 0; cmd.ExecuteNonQuery(); } catch (Exception ex) { throw ex; } finally { cmd.Connection = connectionBD.CloseConnection(); cmd.Dispose(); } }
public List <E_Metrica> QueryMetricasDg(int IdObjective) { List <E_Metrica> returnedlist = null; try { SqlDataReader datareader; connectionBD = new D_ConnectionBD(); cmd = new SqlCommand("QueryMetricas", connectionBD.OpenConnection()); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@IdObjetivo", IdObjective); cmd.CommandTimeout = 0; datareader = cmd.ExecuteReader(); returnedlist = new List <E_Metrica>(); while (datareader.Read()) { E_Metrica objMeDg = new E_Metrica(); objMeDg.IdObjective = datareader.GetInt32(0); objMeDg.Perspective = datareader.GetString(1); objMeDg.Objective = datareader.GetString(2); objMeDg.IdMetrica = datareader.GetInt32(3); objMeDg.Metrica = datareader.GetString(4); returnedlist.Add(objMeDg); } } catch (Exception ex) { throw ex; } finally { cmd.Connection = connectionBD.CloseConnection(); cmd.Dispose(); } return(returnedlist); }