Exemplo n.º 1
0
        public static IList <YouCom.DTO.Mensajeria.EleccionMensajePorteriaDTO> getListadoEleccionMensajePorteria()
        {
            IList <YouCom.DTO.Mensajeria.EleccionMensajePorteriaDTO> IEleccionMensajePorteria = new List <YouCom.DTO.Mensajeria.EleccionMensajePorteriaDTO>();

            DataTable pobjDataTable = new DataTable();

            if (YouCom.Mensajeria.DAL.EleccionMensajePorteriaDAL.getListadoEleccionMensajePorteria(ref pobjDataTable))
            {
                foreach (DataRow wobjDataRow in pobjDataTable.Rows)
                {
                    YouCom.DTO.Mensajeria.EleccionMensajePorteriaDTO eleccion_mensaje_porteria = new YouCom.DTO.Mensajeria.EleccionMensajePorteriaDTO();

                    eleccion_mensaje_porteria.IdEleccionMensajePorteria = decimal.Parse(wobjDataRow["IdEleccionMensajePorteria"].ToString());

                    YouCom.DTO.Mensajeria.MensajePorteriaDTO myMensajePorteriaDTO = new YouCom.DTO.Mensajeria.MensajePorteriaDTO();
                    myMensajePorteriaDTO.IdMensajePorteria          = decimal.Parse(wobjDataRow["idMensajePorteria"].ToString());
                    eleccion_mensaje_porteria.TheMensajePorteriaDTO = myMensajePorteriaDTO;

                    YouCom.DTO.Propietario.FamiliaDTO myFamiliaDTO = new YouCom.DTO.Propietario.FamiliaDTO();
                    myFamiliaDTO.IdFamilia = decimal.Parse(wobjDataRow["idFamilia"].ToString());
                    eleccion_mensaje_porteria.TheFamiliaDTO = myFamiliaDTO;

                    eleccion_mensaje_porteria.EleccionMensajePorteriaFecha   = DateTime.Parse(wobjDataRow["EleccionMensajePorteriaFecha"].ToString());
                    eleccion_mensaje_porteria.EleccionMensajePorteriaMeGusta = wobjDataRow["EleccionMensajePorteriaMeGusta"].ToString();

                    IEleccionMensajePorteria.Add(eleccion_mensaje_porteria);
                }
            }

            return(IEleccionMensajePorteria);
        }
        public static bool Insert(YouCom.DTO.Mensajeria.EleccionMensajePorteriaDTO myEleccionMensajePorteriaDTO)
        {
            bool retorno = false;

            YouCom.Service.BD.SQLHelper wobjSQLHelper = new YouCom.Service.BD.SQLHelper();

            try
            {
                //Seteo Parámetros.
                //====================================================================================
                wobjSQLHelper.SetParametro("@pIdMensajePorteria", SqlDbType.Decimal, -1, myEleccionMensajePorteriaDTO.TheMensajePorteriaDTO.IdMensajePorteria);
                wobjSQLHelper.SetParametro("@pIdFamilia", SqlDbType.Decimal, -1, myEleccionMensajePorteriaDTO.TheFamiliaDTO.IdFamilia);
                wobjSQLHelper.SetParametro("@pEleccionMensajePorteriaMeGusta", SqlDbType.VarChar, 20, myEleccionMensajePorteriaDTO.EleccionMensajePorteriaMeGusta);
                wobjSQLHelper.SetParametro("@pEleccionMensajePorteriaFecha", SqlDbType.DateTime, -1, myEleccionMensajePorteriaDTO.EleccionMensajePorteriaFecha);
                //====================================================================================

                //Ejecuto SP.
                //====================================================================================
                switch (wobjSQLHelper.EjecutarNQ("INS_EleccionMensajePorteria", "YouCom"))
                {
                case 0:
                    throw new Exception("No se pudo grabar.");

                case -1:
                    throw new Exception("Hubo un error.");

                case -2:
                    throw new Exception("Hubo un error.");
                }
                //====================================================================================

                retorno = true;
            }

            #region Catch

            catch (Exception eobjException)
            {
                throw eobjException;
            }
            #endregion

            return(retorno);
        }