public static bool ActivaNoticia(YouCom.DTO.NoticiaDTO theNoticiaDTO) { bool retorno = false; YouCom.Service.BD.SQLHelper wobjSQLHelper = new YouCom.Service.BD.SQLHelper(); wobjSQLHelper.SetParametro("@usuarioIngreso", SqlDbType.VarChar, 50, theNoticiaDTO.UsuarioModificacion); wobjSQLHelper.SetParametro("@pIdNoticia", SqlDbType.VarChar, 20, theNoticiaDTO.NoticiaId); try { //==================================================================================== switch (wobjSQLHelper.EjecutarNQ("Activa_Noticia", "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; } catch (Exception eobjException) { throw eobjException; } return(retorno); }
public static IList <YouCom.DTO.Mensajeria.EleccionNoticiaDTO> getListadoEleccionNoticia() { IList <YouCom.DTO.Mensajeria.EleccionNoticiaDTO> IEleccionNoticia = new List <YouCom.DTO.Mensajeria.EleccionNoticiaDTO>(); DataTable pobjDataTable = new DataTable(); if (YouCom.Mensajeria.DAL.EleccionNoticiaDAL.getListadoEleccionNoticia(ref pobjDataTable)) { foreach (DataRow wobjDataRow in pobjDataTable.Rows) { YouCom.DTO.Mensajeria.EleccionNoticiaDTO eleccion_noticia = new YouCom.DTO.Mensajeria.EleccionNoticiaDTO(); eleccion_noticia.IdEleccionNoticia = decimal.Parse(wobjDataRow["IdEleccionNoticia"].ToString()); YouCom.DTO.NoticiaDTO myNoticiaDTO = new YouCom.DTO.NoticiaDTO(); myNoticiaDTO.NoticiaId = decimal.Parse(wobjDataRow["idNoticia"].ToString()); eleccion_noticia.TheNoticiaDTO = myNoticiaDTO; YouCom.DTO.Propietario.FamiliaDTO myFamiliaDTO = new YouCom.DTO.Propietario.FamiliaDTO(); myFamiliaDTO.IdFamilia = decimal.Parse(wobjDataRow["idFamilia"].ToString()); eleccion_noticia.TheFamiliaDTO = myFamiliaDTO; eleccion_noticia.EleccionNoticiaFecha = DateTime.Parse(wobjDataRow["eleccionNoticiaFecha"].ToString()); eleccion_noticia.EleccionNoticiaMeGusta = wobjDataRow["eleccionNoticiaMeGusta"].ToString(); IEleccionNoticia.Add(eleccion_noticia); } } return(IEleccionNoticia); }
public static bool Update(YouCom.DTO.NoticiaDTO myNoticiaDTO) { bool retorno = false; YouCom.Service.BD.SQLHelper wobjSQLHelper = new YouCom.Service.BD.SQLHelper(); try { //Seteo Parámetros. //==================================================================================== wobjSQLHelper.SetParametro("@pNoticiaId", SqlDbType.Decimal, -1, myNoticiaDTO.NoticiaId); wobjSQLHelper.SetParametro("@pIdCondominio", SqlDbType.Decimal, -1, myNoticiaDTO.TheCondominioDTO.IdCondominio); wobjSQLHelper.SetParametro("@pIdComunidad", SqlDbType.Decimal, -1, myNoticiaDTO.TheComunidadDTO.IdComunidad); wobjSQLHelper.SetParametro("@pIdCategoria", SqlDbType.Decimal, -1, myNoticiaDTO.TheCategoriaDTO.IdCategoria); wobjSQLHelper.SetParametro("@pNoticiaTitulo", SqlDbType.VarChar, 200, myNoticiaDTO.NotiTitulo); wobjSQLHelper.SetParametro("@pNoticiaResumen", SqlDbType.VarChar, 500, myNoticiaDTO.NotiResumen); wobjSQLHelper.SetParametro("@pNoticiaDetalle", SqlDbType.Text, -1, myNoticiaDTO.NotiDetalle); wobjSQLHelper.SetParametro("@pNoticiaPublicacion", SqlDbType.DateTime, -1, myNoticiaDTO.NotiPublicacion); wobjSQLHelper.SetParametro("@pNoticiaInicio", SqlDbType.DateTime, -1, myNoticiaDTO.NotiInicio); wobjSQLHelper.SetParametro("@pNoticiaExpira", SqlDbType.Char, 1, myNoticiaDTO.NotiExpira); wobjSQLHelper.SetParametro("@pNoticiaExpiracion", SqlDbType.DateTime, -1, myNoticiaDTO.NotiExpiracion); wobjSQLHelper.SetParametro("@pNoticiaAutor", SqlDbType.VarChar, 200, myNoticiaDTO.NotiAutor); wobjSQLHelper.SetParametro("@pNoticiaImagen", SqlDbType.VarChar, 200, !string.IsNullOrEmpty(myNoticiaDTO.NotiImagen) ? myNoticiaDTO.NotiImagen : System.Data.SqlTypes.SqlString.Null); wobjSQLHelper.SetParametro("@pUsuarioModificacion", SqlDbType.VarChar, 20, myNoticiaDTO.UsuarioModificacion); //==================================================================================== //Ejecuto SP. //==================================================================================== switch (wobjSQLHelper.EjecutarNQ("UPD_Noticia", "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); }
public static IList <YouCom.DTO.NoticiaDTO> getListadoNoticia() { IList <YouCom.DTO.NoticiaDTO> INoticia = new List <YouCom.DTO.NoticiaDTO>(); DataTable pobjDataTable = new DataTable(); if (YouCom.DAL.NoticiaDAL.getListadoNoticia(ref pobjDataTable)) { foreach (DataRow wobjDataRow in pobjDataTable.Rows) { YouCom.DTO.NoticiaDTO noticia = new YouCom.DTO.NoticiaDTO(); noticia.NoticiaId = decimal.Parse(wobjDataRow["noticia_id"].ToString()); YouCom.DTO.Seguridad.CondominioDTO myCondominioDTO = new YouCom.DTO.Seguridad.CondominioDTO(); myCondominioDTO.IdCondominio = decimal.Parse(wobjDataRow["idCondominio"].ToString()); noticia.TheCondominioDTO = myCondominioDTO; YouCom.DTO.Seguridad.ComunidadDTO myComunidadDTO = new YouCom.DTO.Seguridad.ComunidadDTO(); myComunidadDTO.IdComunidad = decimal.Parse(wobjDataRow["idComunidad"].ToString()); noticia.TheComunidadDTO = myComunidadDTO; noticia.NotiTitulo = wobjDataRow["noticia_titulo"].ToString(); noticia.NotiResumen = wobjDataRow["noticia_resumen"].ToString(); noticia.NotiDetalle = wobjDataRow["noticia_detalle"].ToString(); YouCom.DTO.CategoriaDTO myCategoriaDTO = new YouCom.DTO.CategoriaDTO(); myCategoriaDTO.IdCategoria = decimal.Parse(wobjDataRow["idCategoria"].ToString()); noticia.TheCategoriaDTO = myCategoriaDTO; noticia.NotiPublicacion = Convert.ToDateTime(wobjDataRow["noticia_publicacion"].ToString()); noticia.NotiInicio = Convert.ToDateTime(wobjDataRow["noticia_inicio"].ToString()); noticia.NotiExpira = wobjDataRow["noticia_expira"].ToString(); noticia.NotiExpiracion = Convert.ToDateTime(wobjDataRow["noticia_expiracion"].ToString()); noticia.NotiAutor = wobjDataRow["noticia_autor"].ToString(); noticia.NotiImagen = wobjDataRow["noticia_imagen"].ToString(); noticia.UsuarioIngreso = wobjDataRow["usuario_ingreso"].ToString(); noticia.FechaIngreso = wobjDataRow["fecha_ingreso"].ToString(); noticia.UsuarioModificacion = wobjDataRow["usuario_modificacion"].ToString(); noticia.FechaModificacion = wobjDataRow["fecha_modificacion"].ToString(); noticia.Estado = wobjDataRow["estado"].ToString(); INoticia.Add(noticia); } } return(INoticia); }
public static bool ValidaEliminacionNoticia(YouCom.DTO.NoticiaDTO theNoticiaDTO) { DataTable pobjDataTable = new DataTable(); bool retorno = false; if (YouCom.DAL.NoticiaDAL.ValidaEliminacionNoticia(theNoticiaDTO, ref pobjDataTable)) { foreach (DataRow wobjDataRow in pobjDataTable.Rows) { retorno = true; } } return(retorno); }
public static bool Delete(YouCom.DTO.NoticiaDTO theNoticiaDTO) { bool retorno = false; YouCom.Service.BD.SQLHelper wobjSQLHelper = new YouCom.Service.BD.SQLHelper(); try { //Seteo Parámetros. //==================================================================================== wobjSQLHelper.SetParametro("@pNoticiaId", SqlDbType.Decimal, -1, theNoticiaDTO.NoticiaId); wobjSQLHelper.SetParametro("@pUsuarioModificacion", SqlDbType.VarChar, 20, theNoticiaDTO.UsuarioModificacion); //==================================================================================== //Ejecuto SP. //==================================================================================== switch (wobjSQLHelper.EjecutarNQ("DEL_Noticia", "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); }