public static IList <YouCom.DTO.ComunidadDTO> getListadoComunidad() { IList <YouCom.DTO.ComunidadDTO> IComunidad = new List <YouCom.DTO.ComunidadDTO>(); DataTable pobjDataTable = new DataTable(); if (YouCom.DAL.ComunidadDAL.getListadoComunidad(ref pobjDataTable)) { foreach (DataRow wobjDataRow in pobjDataTable.Rows) { YouCom.DTO.ComunidadDTO comunidad = new YouCom.DTO.ComunidadDTO(); comunidad.IdComunidad = decimal.Parse(wobjDataRow["IdComercio"].ToString()); comunidad.IdCondominio = decimal.Parse(wobjDataRow["idCondominio"].ToString()); comunidad.RutComunidad = wobjDataRow["rutComunidad"].ToString(); comunidad.NombreComunidad = wobjDataRow["nombreComunidad"].ToString(); comunidad.DireccionComunidad = wobjDataRow["direccionComunidad"].ToString(); comunidad.TelefonoComunidad = wobjDataRow["telefonoComunidad"].ToString(); comunidad.CorreoComunidad = wobjDataRow["correoComunidad"].ToString(); comunidad.UsuarioIngreso = wobjDataRow["usuario_ingreso"].ToString(); comunidad.FechaIngreso = wobjDataRow["fecha_ingreso"].ToString(); comunidad.UsuarioModificacion = wobjDataRow["usuario_modificacion"].ToString(); comunidad.FechaModificacion = wobjDataRow["fecha_modificacion"].ToString(); comunidad.Estado = wobjDataRow["estado"].ToString(); IComunidad.Add(comunidad); } } return(IComunidad); }
public static bool ActivaComunidad(YouCom.DTO.ComunidadDTO theComunidadDTO) { bool retorno = false; YouCom.Service.BD.SQLHelper wobjSQLHelper = new YouCom.Service.BD.SQLHelper(); wobjSQLHelper.SetParametro("@usuarioIngreso", SqlDbType.VarChar, 50, theComunidadDTO.UsuarioModificacion); wobjSQLHelper.SetParametro("@pIdComercio", SqlDbType.VarChar, 20, theComunidadDTO.IdComunidad); try { //==================================================================================== switch (wobjSQLHelper.EjecutarNQ("Activa_Comunidad", "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 bool ValidaEliminacionComunidad(YouCom.DTO.ComunidadDTO theComunidadDTO, ref DataTable pobjDatatable) { bool retorno = false; YouCom.Service.BD.SQLHelper wobjSQLHelper = new YouCom.Service.BD.SQLHelper(); wobjSQLHelper.SetParametro("@idComunidad", SqlDbType.VarChar, 20, theComunidadDTO.IdComunidad); try { //==================================================================================== if (wobjSQLHelper.Ejecutar("validaEliminacionComunidad", "YouCom", pobjDatatable) <= 0) { retorno = false; } else { retorno = true; } } catch (Exception eobjException) { throw eobjException; } return(retorno); }
public static bool ValidaEliminacionComunidad(YouCom.DTO.ComunidadDTO theComunidadDTO) { DataTable pobjDataTable = new DataTable(); bool retorno = false; if (YouCom.DAL.ComunidadDAL.ValidaEliminacionComunidad(theComunidadDTO, ref pobjDataTable)) { foreach (DataRow wobjDataRow in pobjDataTable.Rows) { retorno = true; } } return(retorno); }
public static bool Update(YouCom.DTO.ComunidadDTO myComunidadDTO) { bool retorno = false; YouCom.Service.BD.SQLHelper wobjSQLHelper = new YouCom.Service.BD.SQLHelper(); try { //Seteo Parámetros. //==================================================================================== wobjSQLHelper.SetParametro("@pIdComunidad", SqlDbType.Decimal, -1, myComunidadDTO.IdComunidad); wobjSQLHelper.SetParametro("@pIdCondominio", SqlDbType.Decimal, -1, myComunidadDTO.IdCondominio); wobjSQLHelper.SetParametro("@pNombreComunidad", SqlDbType.VarChar, 500, myComunidadDTO.NombreComunidad); wobjSQLHelper.SetParametro("@pDireccionComunidad", SqlDbType.VarChar, 200, myComunidadDTO.DireccionComunidad); wobjSQLHelper.SetParametro("@pUsuarioModificacion", SqlDbType.VarChar, 20, myComunidadDTO.UsuarioModificacion); //==================================================================================== //Ejecuto SP. //==================================================================================== switch (wobjSQLHelper.EjecutarNQ("UPD_Comunidad", "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); }