Ejemplo n.º 1
0
        public int ConsultarGastoExcedido(PresupuestoBE oPresupuestoBE)
        {
            int Excedido;

            try
            {

                SqlConnection cn = new SqlConnection(cad);
                SqlCommand cmd = new SqlCommand("SP_CONSULTARGASTOEXCEDIDO", cn);
                cmd.Parameters.Add("@CENTROGESTORID", SqlDbType.Int).Value = oPresupuestoBE.CENTROGESTORID;
                cmd.Parameters.Add("@PARTIDAID", SqlDbType.Int).Value = oPresupuestoBE.PARTIDAID;
                cmd.Parameters.Add("@ANHO", SqlDbType.Int).Value = oPresupuestoBE.ANHO;
                cmd.Parameters.Add("@MES", SqlDbType.Char, 2).Value = oPresupuestoBE.MES;
                cmd.Parameters.Add("@MONTO", SqlDbType.Decimal).Value = oPresupuestoBE.MONTO;
                cmd.Parameters.Add("@EXCEDIDO", SqlDbType.Int).Direction = ParameterDirection.Output;

                cmd.CommandType = CommandType.StoredProcedure;
                cn.Open();
                cmd.ExecuteNonQuery();
                Excedido = (int)cmd.Parameters["@EXCEDIDO"].Value;
                cn.Close();
            }
            catch (Exception)
            {

                throw;
            }
            return Excedido;
        }
Ejemplo n.º 2
0
        public List<PresupuestoBE> ConsultarPresupuestoDispo(int CentroGestorId,int anho,string mes)
        {
            List<PresupuestoBE> lista = new List<PresupuestoBE>();
               PresupuestoBE oPresupuestoBE;
               try
               {

               SqlConnection cn = new SqlConnection(cad);
               SqlCommand cmd = new SqlCommand("SP_CONSULTARPRESUPUESTODISPON", cn);
               cmd.Parameters.Add("@CENTROGESTORID", SqlDbType.Int).Value = CentroGestorId;
                cmd.Parameters.Add("@ANHO",SqlDbType.Int).Value=anho;
                cmd.Parameters.Add("@MES",SqlDbType.Char,2).Value=mes;

               SqlDataReader dr;
               cmd.CommandType = CommandType.StoredProcedure;
               cn.Open();
               dr = cmd.ExecuteReader();
               while (dr.Read())
               {
                   oPresupuestoBE = new PresupuestoBE();
                   oPresupuestoBE.PARTIDA = (string)dr["PARTIDA"];
                   oPresupuestoBE.MONTO = double.Parse(dr["MONTO"].ToString());
                   oPresupuestoBE.MONTODISPONIBLE = double.Parse(dr["MONTODISPONIBLE"].ToString());
                   lista.Add(oPresupuestoBE);

               }
               cn.Close();
               }
               catch (Exception)
               {

               throw;
               }
               return lista;
        }
Ejemplo n.º 3
0
        public int RegistrarGasto(PresupuestoBE oPresupuestoBE)
        {
            int EsRegistrado = 0;
            try
            {

                SqlConnection cn = new SqlConnection(cad);
                SqlCommand cmd = new SqlCommand("SP_REGISTRARDETPRESUPUESTO", cn);
                cmd.Parameters.Add("@CENTROGESTORID", SqlDbType.Int).Value = oPresupuestoBE.CENTROGESTORID;
                cmd.Parameters.Add("@PARTIDAID", SqlDbType.Int).Value = oPresupuestoBE.PARTIDAID;
                cmd.Parameters.Add("@ANHO", SqlDbType.Int).Value = oPresupuestoBE.ANHO;
                cmd.Parameters.Add("@MES", SqlDbType.Char, 2).Value = oPresupuestoBE.MES;
                cmd.Parameters.Add("@MONTO", SqlDbType.Decimal).Value = oPresupuestoBE.MONTO;
                cmd.Parameters.Add("@ESREGISTRADO", SqlDbType.Int).Direction = ParameterDirection.Output;

                cmd.CommandType = CommandType.StoredProcedure;
                cn.Open();
                cmd.ExecuteNonQuery();
                EsRegistrado = (int)cmd.Parameters["@ESREGISTRADO"].Value;
                cn.Close();
            }
            catch (Exception)
            {

                throw;
            }
            return EsRegistrado;
        }
Ejemplo n.º 4
0
        public List<PresupuestoBE> ListarGastos(PresupuestoBE oPresupuestoBE)
        {
            List<PresupuestoBE> lista = new List<PresupuestoBE>();
            PresupuestoBE oPresupuestoBE2;
            try
            {

                SqlConnection cn = new SqlConnection(cad);
                SqlCommand cmd = new SqlCommand("SP_LISTARDETPRESUPUESTO", cn);
                cmd.Parameters.Add("@CENTROGESTORID", SqlDbType.Int).Value = oPresupuestoBE.CENTROGESTORID;
                cmd.Parameters.Add("@PARTIDAID", SqlDbType.Int).Value = oPresupuestoBE.PARTIDAID;
                cmd.Parameters.Add("@ANHO", SqlDbType.Int).Value = oPresupuestoBE.ANHO;
                cmd.Parameters.Add("@MES", SqlDbType.Char, 2).Value = oPresupuestoBE.MES;

                SqlDataReader dr;
                cmd.CommandType = CommandType.StoredProcedure;
                cn.Open();
                dr = cmd.ExecuteReader();
                while (dr.Read())
                {
                    oPresupuestoBE2 = new PresupuestoBE();
                    oPresupuestoBE2.DETPRESUPUESTO = (int)dr["DETPRESUPUESTO"];
                    oPresupuestoBE2.ANHO = (int)dr["ANHO"];
                    oPresupuestoBE2.MES = (string)dr["MES"];
                    oPresupuestoBE2.CENTROGESTOR = (string)dr["CENTROGESTOR"];
                    oPresupuestoBE2.PARTIDA = (string)dr["PARTIDA"];
                    oPresupuestoBE2.MONTO = double.Parse(dr["MONTO"].ToString());
                    lista.Add(oPresupuestoBE2);

                }
                cn.Close();
            }
            catch (Exception)
            {

                throw;
            }
            return lista;
        }
Ejemplo n.º 5
0
 public int RegistrarGasto(PresupuestoBE oPresupuestoBE)
 {
     return oGastoDA.RegistrarGasto(oPresupuestoBE);
 }
Ejemplo n.º 6
0
 public List<PresupuestoBE> ListarGastos(PresupuestoBE oPresupuestoBE)
 {
     return oGastoDA.ListarGastos(oPresupuestoBE);
 }
Ejemplo n.º 7
0
 public int ConsultarGastoExcedido(PresupuestoBE oPresupuestoBE)
 {
     return oGastoDA.ConsultarGastoExcedido(oPresupuestoBE);
 }