197 lines
7.2 KiB
C#
197 lines
7.2 KiB
C#
using System;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using System.Data;
|
|
using System.Data.Common;
|
|
|
|
using AyAEL.PPP;
|
|
using AyADAL;
|
|
|
|
namespace AyABL.PPP
|
|
{
|
|
public class DistribucionPartidaBL : AyABL
|
|
{
|
|
|
|
#region Constructores
|
|
|
|
public DistribucionPartidaBL()
|
|
{
|
|
objDistribucionPartidaEL = new DistribucionPartidaEL();
|
|
this.NombreTabla = Modulos.t_ppp_.ToString() + Tablas.distribucionpartida.ToString();
|
|
this.NombreConeccionBD = BASESDEDATOS.FOPI.ToString();
|
|
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Atributos
|
|
|
|
public DistribucionPartidaEL objDistribucionPartidaEL { get; set; }
|
|
|
|
#endregion
|
|
|
|
#region Metodos
|
|
|
|
/// <summary>
|
|
/// Inluye los datos del DistribucionPartida
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
|
|
public bool insertarDistribucionPartida()
|
|
{
|
|
bool blnEjecutado = false;
|
|
|
|
this.CamposTabla = Concepto.ANIO.ToString() + Tablas.distribucionpartida.ToString().ToUpper() + ", " +
|
|
Concepto.MONTO.ToString() + Tablas.distribucionpartida.ToString().ToUpper() + ", " +
|
|
Constraints.FK.ToString() + Tablas.partidapresupuestaria.ToString().ToUpper() + ", " +
|
|
Constraints.FK.ToString() + Tablas.proyecto.ToString().ToUpper();
|
|
|
|
this.ValoresCampos = new object[]{objDistribucionPartidaEL.Anio,
|
|
objDistribucionPartidaEL.Monto,
|
|
objDistribucionPartidaEL.PartidaPresupuestaria,
|
|
objDistribucionPartidaEL.Proyecto
|
|
};
|
|
|
|
baseDAL.Insertar(this.NombreTabla, this.CamposTabla, this.ValoresCampos, this.NombreConeccionBD);
|
|
|
|
blnEjecutado = true;
|
|
|
|
return blnEjecutado;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Actualiza el dato del DistribucionPartida
|
|
/// </summary>
|
|
|
|
public bool actualizarDistribucionPartida()
|
|
{
|
|
ArrayList arlCondiciones = new ArrayList();
|
|
bool blnEjecutado = false;
|
|
|
|
if (objDistribucionPartidaEL.PK != 0)
|
|
{
|
|
arlCondiciones.Add(this.buscarPorPK(objDistribucionPartidaEL.PK, Tablas.distribucionpartida, operadorLogico.AND));
|
|
}
|
|
|
|
this.CamposTabla = Concepto.ANIO.ToString() + Tablas.distribucionpartida.ToString().ToUpper() + ", " +
|
|
Concepto.MONTO.ToString() + Tablas.distribucionpartida.ToString().ToUpper() + ", " +
|
|
Constraints.FK.ToString() + Tablas.partidapresupuestaria.ToString().ToUpper() + ", " +
|
|
Constraints.FK.ToString() + Tablas.proyecto.ToString().ToUpper();
|
|
|
|
this.ValoresCampos = new object[]{objDistribucionPartidaEL.Anio,
|
|
objDistribucionPartidaEL.Monto,
|
|
objDistribucionPartidaEL.PartidaPresupuestaria,
|
|
objDistribucionPartidaEL.Proyecto
|
|
};
|
|
|
|
baseDAL.Actualizar(this.NombreTabla, this.CamposTabla, this.ValoresCampos, this.NombreConeccionBD, arlCondiciones);
|
|
|
|
blnEjecutado = true;
|
|
|
|
return blnEjecutado;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Actualiza el estado del DistribucionPartida
|
|
/// </summary>
|
|
|
|
public bool actualizaEstadoDistribucionPartida()
|
|
{
|
|
ArrayList arlCondiciones = new ArrayList();
|
|
bool blnEjecutado = false;
|
|
|
|
if (objDistribucionPartidaEL.PK != 0)
|
|
{
|
|
arlCondiciones.Add(this.buscarPorPK(objDistribucionPartidaEL.PK, Tablas.distribucionpartida, operadorLogico.AND));
|
|
}
|
|
|
|
this.CamposTabla = Concepto.ASTATE.ToString() + Tablas.distribucionpartida.ToString();
|
|
|
|
this.ValoresCampos = new object[] { objDistribucionPartidaEL.ASTATE };
|
|
|
|
baseDAL.Actualizar(this.NombreTabla, this.CamposTabla, this.ValoresCampos, this.NombreConeccionBD, arlCondiciones);
|
|
|
|
blnEjecutado = true;
|
|
|
|
return blnEjecutado;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Lista la distribucion de partidas en forma tabular
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
|
|
public DataSet getDistribucionPartida()
|
|
{
|
|
DbProviderFactory factory = DbProviderFactories.GetFactory("System.Data.SqlClient");
|
|
DbParameter[] dbpParametros = new DbParameter[1];
|
|
|
|
for (int i = 0; i < dbpParametros.Length; i++)
|
|
{
|
|
dbpParametros[i] = factory.CreateParameter();
|
|
}
|
|
|
|
//Parametros PK Proyecto
|
|
dbpParametros[0].ParameterName = "@P_PKPROYECTO";
|
|
dbpParametros[0].Value = objDistribucionPartidaEL.Proyecto;
|
|
dbpParametros[0].DbType = DbType.String;
|
|
|
|
DataSet dsPartidas = baseDAL.dsProcedimientoAlmacenado(Procedimiento.PA_PARTIDASPIVOT.ToString(), dbpParametros, NombreConeccionBD);
|
|
|
|
return dsPartidas;
|
|
}
|
|
|
|
public DataSet getTotalPartida()
|
|
{
|
|
DbProviderFactory factory = DbProviderFactories.GetFactory("System.Data.SqlClient");
|
|
DbParameter[] dbpParametros = new DbParameter[1];
|
|
|
|
for (int i = 0; i < dbpParametros.Length; i++)
|
|
{
|
|
dbpParametros[i] = factory.CreateParameter();
|
|
}
|
|
|
|
//Parametros PK Proyecto
|
|
dbpParametros[0].ParameterName = "@P_PKPROYECTO";
|
|
dbpParametros[0].Value = objDistribucionPartidaEL.Proyecto;
|
|
dbpParametros[0].DbType = DbType.String;
|
|
|
|
DataSet dsPartidas = baseDAL.dsProcedimientoAlmacenado(Procedimiento.PA_TOTALESPARTIDAS.ToString(), dbpParametros, NombreConeccionBD);
|
|
|
|
return dsPartidas;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Lista la distribucion de partidas en detalladamente
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
|
|
public DataSet getDetalle()
|
|
{
|
|
ArrayList arlCondiciones = new ArrayList();
|
|
|
|
if (this.objDistribucionPartidaEL.PK != 0)
|
|
{
|
|
arlCondiciones.Add(buscarPorPK(objDistribucionPartidaEL.PK, Tablas.distribucionpartida, operadorLogico.AND));
|
|
}
|
|
|
|
if (this.objDistribucionPartidaEL.Proyecto != 0)
|
|
{
|
|
arlCondiciones.Add(buscarPorFK(objDistribucionPartidaEL.Proyecto, Tablas.proyecto, operadorLogico.AND));
|
|
}
|
|
|
|
NombreTabla = Vistas.v_detalledistribucionpartida.ToString();
|
|
|
|
DataSet dsPartidas = baseDAL.EjecutarConsulta(this.NombreTabla, this.CamposTabla, this.NombreConeccionBD, arlCondiciones, null, " ORDER BY INDICEPARTIDAPRESUPUESTARIA, ANIODISTRIBUCIONPARTIDA");
|
|
|
|
return dsPartidas;
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Condiciones de Busqueda
|
|
|
|
|
|
#endregion
|
|
}
|
|
}
|