Example #1
0
        public List <DatoResumen> GetResumen(DatoResumenFilter oFilter)
        {
            using (VotoDataAccess oVotoDataAccess = new VotoDataAccess())
            {
                DataSet ds = oVotoDataAccess.GetResumen(oFilter);

                if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
                {
                    return(DatoResumen.GetFromDS(ds));
                }

                return(null);
            }
        }
Example #2
0
        public DataSet GetResumen(DatoResumenFilter oDatoResumenFilter)
        {
            // Creo la conexión y la transacción
            SqlConnection oConn = new SqlConnection(ConfigurationManager.ConnectionStrings["CONEXION"].ConnectionString);

            oConn.Open();
            SqlTransaction oTran = oConn.BeginTransaction();

            DataSet ds = new DataSet();

            try
            {
                using (SqlDataAdapter adapter = new SqlDataAdapter())
                {
                    using (SqlCommand oComm = new SqlCommand())
                    {
                        oComm.Connection  = (oTran != null) ? oTran.Connection : oConn;
                        oComm.Transaction = oTran;

                        oComm.CommandType = CommandType.StoredProcedure;
                        oComm.CommandText = ObjectName + "_GetResumen";

                        oComm.Parameters.Add(new SqlParameter("@IdCompania", SqlDbType.Int, 0, ParameterDirection.Input, true, 0, 0, null, DataRowVersion.Original, oDatoResumenFilter.IdCompania));
                        oComm.Parameters.Add(new SqlParameter("@FechaAlta", SqlDbType.DateTime, 0, ParameterDirection.Input, true, 0, 0, null, DataRowVersion.Original, oDatoResumenFilter.FechaAlta));

                        adapter.SelectCommand = oComm;
                        adapter.Fill(ds);
                    }
                }
            }
            catch (Exception e)
            {
                oTran.Rollback();
                throw e;
            }
            finally
            {
                oConn.Close();
                oTran.Dispose();
            }

            return(ds);
        }