public static IList <YouCom.DTO.ComercioDTO> getListadoComercio() { IList <YouCom.DTO.ComercioDTO> IComercio = new List <YouCom.DTO.ComercioDTO>(); DataTable pobjDataTable = new DataTable(); if (YouCom.DAL.ComercioDAL.getListadoComercio(ref pobjDataTable)) { foreach (DataRow wobjDataRow in pobjDataTable.Rows) { YouCom.DTO.ComercioDTO comercio = new YouCom.DTO.ComercioDTO(); comercio.IdComercio = decimal.Parse(wobjDataRow["IdComercio"].ToString()); comercio.IdCategoria = decimal.Parse(wobjDataRow["idCategoria"].ToString()); comercio.IdCondominio = decimal.Parse(wobjDataRow["idCondominio"].ToString()); comercio.NombreComercio = wobjDataRow["nombreComercio"].ToString(); comercio.LogoComercio = wobjDataRow["logoComercio"].ToString(); comercio.DireccionComercio = wobjDataRow["direccionComercio"].ToString(); comercio.TelefonoComercio = wobjDataRow["telefonoComercio"].ToString(); comercio.UrlComercio = string.IsNullOrEmpty(wobjDataRow["urlComercio"].ToString()) ? string.Empty : wobjDataRow["urlComercio"].ToString(); comercio.UsuarioIngreso = wobjDataRow["usuario_ingreso"].ToString(); comercio.FechaIngreso = wobjDataRow["fecha_ingreso"].ToString(); comercio.UsuarioModificacion = wobjDataRow["usuario_modificacion"].ToString(); comercio.FechaModificacion = wobjDataRow["fecha_modificacion"].ToString(); comercio.Estado = wobjDataRow["estado"].ToString(); IComercio.Add(comercio); } } return(IComercio); }
public static bool ValidaEliminacionComercio(YouCom.DTO.ComercioDTO theComercioDTO, ref DataTable pobjDatatable) { bool retorno = false; YouCom.Service.BD.SQLHelper wobjSQLHelper = new YouCom.Service.BD.SQLHelper(); wobjSQLHelper.SetParametro("@idComercio", SqlDbType.VarChar, 20, theComercioDTO.IdComercio); try { //==================================================================================== if (wobjSQLHelper.Ejecutar("validaEliminacionComercio", "YouCom", pobjDatatable) <= 0) { retorno = false; } else { retorno = true; } } catch (Exception eobjException) { throw eobjException; } return(retorno); }
public static bool ActivaComercio(YouCom.DTO.ComercioDTO theComercioDTO) { bool retorno = false; YouCom.Service.BD.SQLHelper wobjSQLHelper = new YouCom.Service.BD.SQLHelper(); wobjSQLHelper.SetParametro("@usuarioIngreso", SqlDbType.VarChar, 50, theComercioDTO.UsuarioModificacion); wobjSQLHelper.SetParametro("@pIdComercio", SqlDbType.VarChar, 20, theComercioDTO.IdComercio); try { //==================================================================================== switch (wobjSQLHelper.EjecutarNQ("Activa_Comercio", "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 Update(YouCom.DTO.ComercioDTO myComercioDTO) { bool retorno = false; YouCom.Service.BD.SQLHelper wobjSQLHelper = new YouCom.Service.BD.SQLHelper(); try { //Seteo Parámetros. //==================================================================================== wobjSQLHelper.SetParametro("@pIdComercio", SqlDbType.Decimal, -1, myComercioDTO.IdComercio); wobjSQLHelper.SetParametro("@pIdCondominio", SqlDbType.Decimal, -1, myComercioDTO.TheCondominioDTO.IdCondominio); wobjSQLHelper.SetParametro("@pIdComunidad", SqlDbType.Decimal, -1, myComercioDTO.TheComunidadDTO.IdComunidad); wobjSQLHelper.SetParametro("@pIdCategoria", SqlDbType.Decimal, -1, myComercioDTO.TheCategoriaDTO.IdCategoria); wobjSQLHelper.SetParametro("@pNombreComercio", SqlDbType.VarChar, 500, myComercioDTO.NombreComercio); wobjSQLHelper.SetParametro("@pDireccionComercio", SqlDbType.VarChar, 500, myComercioDTO.DireccionComercio); wobjSQLHelper.SetParametro("@pTelefonoComercio", SqlDbType.VarChar, 20, myComercioDTO.TelefonoComercio); wobjSQLHelper.SetParametro("@pUrlComercio", SqlDbType.VarChar, 200, myComercioDTO.UrlComercio); wobjSQLHelper.SetParametro("@pEmailComercio", SqlDbType.VarChar, 200, myComercioDTO.EmailComercio); wobjSQLHelper.SetParametro("@pLogoComercio", SqlDbType.VarChar, 200, !string.IsNullOrEmpty(myComercioDTO.LogoComercio) ? myComercioDTO.LogoComercio : System.Data.SqlTypes.SqlString.Null); wobjSQLHelper.SetParametro("@pUsuarioModificacion", SqlDbType.VarChar, 20, myComercioDTO.UsuarioModificacion); //==================================================================================== //Ejecuto SP. //==================================================================================== switch (wobjSQLHelper.EjecutarNQ("UPD_Comercio", "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 bool ValidaEliminacionComercio(YouCom.DTO.ComercioDTO theComercioDTO) { DataTable pobjDataTable = new DataTable(); bool retorno = false; if (YouCom.DAL.ComercioDAL.ValidaEliminacionComercio(theComercioDTO, ref pobjDataTable)) { foreach (DataRow wobjDataRow in pobjDataTable.Rows) { retorno = true; } } return(retorno); }
public static bool Delete(YouCom.DTO.ComercioDTO myComercioDTO) { bool retorno = false; YouCom.Service.BD.SQLHelper wobjSQLHelper = new YouCom.Service.BD.SQLHelper(); try { //Seteo Parámetros. //==================================================================================== wobjSQLHelper.SetParametro("@pIdComercio", SqlDbType.Decimal, -1, myComercioDTO.IdComercio); wobjSQLHelper.SetParametro("@pUsuarioModificacion", SqlDbType.VarChar, 20, myComercioDTO.UsuarioModificacion); //==================================================================================== //Ejecuto SP. //==================================================================================== switch (wobjSQLHelper.EjecutarNQ("DEL_Comercio", "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); }