示例#1
0
        //Metodo Insertar
        public string Insertar(Cargacuota dCargacuota)
        {
            string          rpta     = "";
            MySqlConnection Conexion = Clases.Database.obtenerConexion(true);

            try
            {
                //Codigo
                if (Conexion.State != ConnectionState.Open)
                {
                    Conexion.Open();
                }
                //Establecer Comando
                MySqlCommand SqlCmd = new MySqlCommand();
                SqlCmd.Connection  = Conexion;
                SqlCmd.CommandText = "sp_Agregar_cargacuota";
                SqlCmd.CommandType = CommandType.StoredProcedure;
                //Aqui Parametros
                //                  p_id, p_cargacuota_fecliquidacion, p_cargacuota_fecvto, p_cargacuota_cta,
                //                  p_cargacuota_capital, p_cargacuota_interes, p_cargacuota_estado, p_cargacuota_total,
                //                  p_numero_contrato, p_Manual
                SqlCmd.Parameters.AddWithValue("@p_id", dCargacuota.Id);
                SqlCmd.Parameters.AddWithValue("@p_cargacuota_fecliquidacion", dCargacuota.Cargacuota_fecliquidacion);
                SqlCmd.Parameters.AddWithValue("@p_cargacuota_fecvto", dCargacuota.Cargacuota_fecvto);
                SqlCmd.Parameters.AddWithValue("@p_cargacuota_cta", dCargacuota.Cargacuota_cta);
                SqlCmd.Parameters.AddWithValue("@p_cargacuota_capital", dCargacuota.Cargacuota_capital);
                SqlCmd.Parameters.AddWithValue("@p_cargacuota_interes", dCargacuota.Cargacuota_interes);
                SqlCmd.Parameters.AddWithValue("@p_cargacuota_estado", dCargacuota.Cargacuota_estado);
                SqlCmd.Parameters.AddWithValue("@p_cargacuota_total", dCargacuota.Cargacuota_total);
                SqlCmd.Parameters.AddWithValue("@p_numero_contrato", dCargacuota.Numero_contrato);
                //Ejecutar comando
                rpta = SqlCmd.ExecuteNonQuery() == 1 ? "OK" : "No se agrego el Registro";
            }
            catch (System.Exception ex)
            {
                rpta = ex.Message;
            }
            finally
            {
                if (Conexion.State == ConnectionState.Open)
                {
                    Conexion.Close();
                }
            }
            return(rpta);
        }
示例#2
0
        //Metodo Mostrar
        //public DataTable Mostrar()
        //{

        //}

        //Metodo Buscar
        public DataTable BuscarCuota(Cargacuota dCargacuota)
        {
            DataTable       DtResultado = new DataTable("CargaCuota");
            MySqlConnection Conexion    = Clases.Database.obtenerConexion(true);

            try
            {
                //Codigo
                if (Conexion.State != ConnectionState.Open)
                {
                    Conexion.Open();
                }
                //Establecer Comando
                MySqlCommand SqlCmd = new MySqlCommand();
                SqlCmd.Connection  = Conexion;
                SqlCmd.CommandText = "sp_cargacuota_Por_Codigo";
                SqlCmd.CommandType = CommandType.StoredProcedure;
                //Aqui Parametros
                SqlCmd.Parameters.AddWithValue("@p_id", dCargacuota.Id);
                SqlCmd.Parameters.AddWithValue("@p_cargacuota_cta", dCargacuota.Cargacuota_cta);
                SqlCmd.Parameters.AddWithValue("@p_numero_contrato", dCargacuota.Numero_contrato);
                //Ejecutar comando
                MySqlDataAdapter SqlDat = new MySqlDataAdapter(SqlCmd);
                SqlDat.Fill(DtResultado);
            }
            catch (System.Exception ex)
            {
                DtResultado = null;
            }
            finally
            {
                if (Conexion.State == ConnectionState.Open)
                {
                    Conexion.Close();
                }
            }
            return(DtResultado);
        }
示例#3
0
        //Metodo Eliminar
        public string Eliminar(Cargacuota dCargacuota)
        {
            string          rpta     = "";
            MySqlConnection Conexion = Clases.Database.obtenerConexion(true);

            try
            {
                //Codigo
                if (Conexion.State != ConnectionState.Open)
                {
                    Conexion.Open();
                }
                //Establecer Comando
                MySqlCommand SqlCmd = new MySqlCommand();
                SqlCmd.Connection  = Conexion;
                SqlCmd.CommandText = "sp_Borrar_cargacuota";
                SqlCmd.CommandType = CommandType.StoredProcedure;
                //Aqui Parametros
                SqlCmd.Parameters.AddWithValue("@p_id", dCargacuota.Id);
                SqlCmd.Parameters.AddWithValue("@p_cargacuota_cta", dCargacuota.Cargacuota_cta);
                SqlCmd.Parameters.AddWithValue("@p_numero_contrato", dCargacuota.Numero_contrato);
                //Ejecutar comando
                rpta = SqlCmd.ExecuteNonQuery() == 1 ? "OK" : "No se eliminó el Registro";
            }
            catch (System.Exception ex)
            {
                rpta = ex.Message;
            }
            finally
            {
                if (Conexion.State == ConnectionState.Open)
                {
                    Conexion.Close();
                }
            }
            return(rpta);
        }