public static bool ActivaVacaciones(YouCom.DTO.VacacionesDTO theVacacionesDTO) { bool retorno = false; YouCom.Service.BD.SQLHelper wobjSQLHelper = new YouCom.Service.BD.SQLHelper(); wobjSQLHelper.SetParametro("@usuarioIngreso", SqlDbType.VarChar, 50, theVacacionesDTO.UsuarioModificacion); wobjSQLHelper.SetParametro("@pIdVacaciones", SqlDbType.VarChar, 20, theVacacionesDTO.IdVacaciones); try { //==================================================================================== switch (wobjSQLHelper.EjecutarNQ("Activa_Vacaciones", "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.VacacionesDTO> getListadoVacaciones() { IList <YouCom.DTO.VacacionesDTO> IVacaciones = new List <YouCom.DTO.VacacionesDTO>(); DataTable pobjDataTable = new DataTable(); if (YouCom.DAL.VacacionesDAL.getListadoVacaciones(ref pobjDataTable)) { foreach (DataRow wobjDataRow in pobjDataTable.Rows) { YouCom.DTO.VacacionesDTO tipo_Visita = new YouCom.DTO.VacacionesDTO(); tipo_Visita.IdVacaciones = decimal.Parse(wobjDataRow["IdVacaciones"].ToString()); tipo_Visita.IdCasa = decimal.Parse(wobjDataRow["IdCasa"].ToString()); tipo_Visita.IdParentesco = decimal.Parse(wobjDataRow["IdParentesco"].ToString()); tipo_Visita.FechaInicio = DateTime.Parse(wobjDataRow["FechaInicio"].ToString()); tipo_Visita.FechaTermino = DateTime.Parse(wobjDataRow["FechaTermino"].ToString()); tipo_Visita.DestinoVacaciones = wobjDataRow["motivo"].ToString(); tipo_Visita.TelefonoContacto = wobjDataRow["telefonoContacto"].ToString(); tipo_Visita.NombreContacto = wobjDataRow["nombreContacto"].ToString(); tipo_Visita.Comentario = wobjDataRow["comentarioVacaciones"].ToString(); tipo_Visita.UsuarioIngreso = wobjDataRow["usuario_ingreso"].ToString(); tipo_Visita.FechaIngreso = wobjDataRow["fecha_ingreso"].ToString(); tipo_Visita.UsuarioModificacion = wobjDataRow["usuario_modificacion"].ToString(); tipo_Visita.FechaModificacion = wobjDataRow["fecha_modificacion"].ToString(); tipo_Visita.Estado = wobjDataRow["estado"].ToString(); IVacaciones.Add(tipo_Visita); } } return(IVacaciones); }
public static bool Update(YouCom.DTO.VacacionesDTO myVacacionesDTO) { bool retorno = false; YouCom.Service.BD.SQLHelper wobjSQLHelper = new YouCom.Service.BD.SQLHelper(); try { //Seteo Parámetros. //==================================================================================== wobjSQLHelper.SetParametro("@pIdVacaciones", SqlDbType.Decimal, -1, myVacacionesDTO.IdVacaciones); wobjSQLHelper.SetParametro("@pIdCasa", SqlDbType.Decimal, -1, myVacacionesDTO.TheCasaDTO.IdCasa); wobjSQLHelper.SetParametro("@pIdCondominio", SqlDbType.Decimal, -1, myVacacionesDTO.TheCondominioDTO.IdCondominio); wobjSQLHelper.SetParametro("@pIdComunidad", SqlDbType.Decimal, -1, myVacacionesDTO.TheComunidadDTO.IdComunidad); wobjSQLHelper.SetParametro("@pIdParentesco", SqlDbType.Decimal, -1, myVacacionesDTO.TheParentescoDTO.IdParentesco); wobjSQLHelper.SetParametro("@pFechaInicio", SqlDbType.DateTime, -1, myVacacionesDTO.FechaInicio); wobjSQLHelper.SetParametro("@pFechaTermino", SqlDbType.DateTime, -1, myVacacionesDTO.FechaTermino); wobjSQLHelper.SetParametro("@pMotivo", SqlDbType.VarChar, 500, myVacacionesDTO.DestinoVacaciones); wobjSQLHelper.SetParametro("@pTelefonoContacto", SqlDbType.VarChar, 20, myVacacionesDTO.TelefonoContacto); wobjSQLHelper.SetParametro("@pNombreContacto", SqlDbType.VarChar, 200, myVacacionesDTO.NombreContacto); wobjSQLHelper.SetParametro("@pUsuarioModificacion", SqlDbType.VarChar, 20, myVacacionesDTO.UsuarioModificacion); //==================================================================================== //Ejecuto SP. //==================================================================================== switch (wobjSQLHelper.EjecutarNQ("UPD_Vacaciones", "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.VacacionesDTO> getListadoVacaciones() { IList <YouCom.DTO.VacacionesDTO> IVacaciones = new List <YouCom.DTO.VacacionesDTO>(); DataTable pobjDataTable = new DataTable(); if (YouCom.DAL.VacacionesDAL.getListadoVacaciones(ref pobjDataTable)) { foreach (DataRow wobjDataRow in pobjDataTable.Rows) { YouCom.DTO.VacacionesDTO vacaciones = new YouCom.DTO.VacacionesDTO(); vacaciones.IdVacaciones = decimal.Parse(wobjDataRow["IdVacaciones"].ToString()); YouCom.DTO.Seguridad.CondominioDTO myCondominioDTO = new YouCom.DTO.Seguridad.CondominioDTO(); myCondominioDTO.IdCondominio = decimal.Parse(wobjDataRow["idCondominio"].ToString()); vacaciones.TheCondominioDTO = myCondominioDTO; YouCom.DTO.Seguridad.ComunidadDTO myComunidadDTO = new YouCom.DTO.Seguridad.ComunidadDTO(); myComunidadDTO.IdComunidad = decimal.Parse(wobjDataRow["idComunidad"].ToString()); vacaciones.TheComunidadDTO = myComunidadDTO; YouCom.DTO.Propietario.CasaDTO myCasaDTO = new YouCom.DTO.Propietario.CasaDTO(); myCasaDTO.IdCasa = decimal.Parse(wobjDataRow["idCasa"].ToString()); vacaciones.TheCasaDTO = myCasaDTO; YouCom.DTO.Propietario.ParentescoDTO myParentescoDTO = new YouCom.DTO.Propietario.ParentescoDTO(); myParentescoDTO.IdParentesco = decimal.Parse(wobjDataRow["idParentesco"].ToString()); vacaciones.TheParentescoDTO = myParentescoDTO; vacaciones.FechaInicio = DateTime.Parse(wobjDataRow["FechaInicio"].ToString()); vacaciones.FechaTermino = DateTime.Parse(wobjDataRow["FechaTermino"].ToString()); vacaciones.DestinoVacaciones = wobjDataRow["motivo"].ToString(); vacaciones.TelefonoContacto = wobjDataRow["telefonoContacto"].ToString(); vacaciones.NombreContacto = wobjDataRow["nombreContacto"].ToString(); vacaciones.UsuarioIngreso = wobjDataRow["usuario_ingreso"].ToString(); vacaciones.FechaIngreso = wobjDataRow["fecha_ingreso"].ToString(); vacaciones.UsuarioModificacion = wobjDataRow["usuario_modificacion"].ToString(); vacaciones.FechaModificacion = wobjDataRow["fecha_modificacion"].ToString(); vacaciones.Estado = wobjDataRow["estado"].ToString(); IVacaciones.Add(vacaciones); } } return(IVacaciones); }
public static bool ValidaEliminacionVacaciones(YouCom.DTO.VacacionesDTO theVacacionesDTO) { DataTable pobjDataTable = new DataTable(); bool retorno = false; if (YouCom.DAL.VacacionesDAL.ValidaEliminacionVacaciones(theVacacionesDTO, ref pobjDataTable)) { foreach (DataRow wobjDataRow in pobjDataTable.Rows) { retorno = true; } } return(retorno); }
public static bool Delete(YouCom.DTO.VacacionesDTO myVacacionesDTO) { bool retorno = false; YouCom.Service.BD.SQLHelper wobjSQLHelper = new YouCom.Service.BD.SQLHelper(); try { //Seteo Parámetros. //==================================================================================== wobjSQLHelper.SetParametro("@pIdVacaciones", SqlDbType.Decimal, -1, myVacacionesDTO.IdVacaciones); wobjSQLHelper.SetParametro("@pUsuarioModificacion", SqlDbType.VarChar, 20, myVacacionesDTO.UsuarioModificacion); //==================================================================================== //Ejecuto SP. //==================================================================================== switch (wobjSQLHelper.EjecutarNQ("DEL_Vacaciones", "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); }