public static bool Actualizar(Contrato_Servicio p) { SqlConnection conn = new SqlConnection(dbConnectionString); bool correcto = true; try { if (conn.State == ConnectionState.Closed) { conn.Open(); SqlCommand cmd = new SqlCommand("exec pa_EditarCONTRATO_SERVICIO" + "@ID_CONTRATO, " + "@Cedula_Cliente, " + "@ID_PLAN_MEGAS, " + "@ID_INSTALACION", conn); cmd.Parameters.AddWithValue("@ID_CONTRATO", p.IdContrato); cmd.Parameters.AddWithValue("@Cedula_Cliente", p.CedulaCliente); cmd.Parameters.AddWithValue("@ID_PLAN_MEGAS", p.IdPlanMegas); cmd.Parameters.AddWithValue("@ID_INSTALACION", p.IdInstalacion); cmd.ExecuteNonQuery(); } } catch (Exception) { correcto = false; } finally { conn.Close(); } return(correcto); }
public static Contrato_Servicio VerContratoServicioCedula(string cedula) { SqlConnection conn = new SqlConnection(dbConnectionString); Contrato_Servicio contrato_Servicio = null; try { if (conn.State == ConnectionState.Closed) { conn.Open(); SqlDataReader dr; SqlCommand cmd = new SqlCommand("exec pa_MostrarContratoServicioCedula " + "@Cedula_Cliente", conn); cmd.Parameters.AddWithValue("@Cedula_Cliente", cedula); dr = cmd.ExecuteReader(); while (dr.Read()) { contrato_Servicio = new Contrato_Servicio { IdContrato = dr.GetInt32(0), CedulaCliente = dr.GetString(1), IdPlanMegas = dr.GetInt32(2), IdInstalacion = dr.GetInt32(3) }; } dr.Close(); } } catch (Exception) { } finally { conn.Close(); } return(contrato_Servicio); }