protected void getObtieneDetalleAcceso(string idAccesoHogar) { try { YouCom.DTO.AccesoHogar.AccesoHogarDTO myAccesoHogar = new YouCom.DTO.AccesoHogar.AccesoHogarDTO(); myAccesoHogar = YouCom.bll.AccesoHogar.AccesoHogarBLL.detalleAccesoHogar(decimal.Parse(idAccesoHogar)); LitFechaInicio.Text = myAccesoHogar.FechaInicio.ToShortDateString() + " " + myAccesoHogar.HoraInicio.ToString(); LitFechaTermino.Text = myAccesoHogar.FechaTermino.ToShortDateString() + " " + myAccesoHogar.HoraTermino.ToString(); LitNombre.Text = YouCom.Service.Generales.Formato.FormatoRut(myAccesoHogar.RutVisita) + " - " + myAccesoHogar.NombreVisita; LitEmail.Text = myAccesoHogar.EmailVisita; LitTipo.Text = myAccesoHogar.TheTipoVisitaDTO.NombreTipoVisita; LitActividad.Text = myAccesoHogar.TheFrecuenciaDTO.NombreFrecuencia; IList <YouCom.DTO.AccesoHogar.AccesoHogarDetalleDTO> collAccesoHogarDetalleDTO = new List <YouCom.DTO.AccesoHogar.AccesoHogarDetalleDTO>(); collAccesoHogarDetalleDTO = YouCom.bll.AccesoHogar.AccesoHogarDetalleBLL.getListadoAccesoHogarDetalleByAcceso(decimal.Parse(idAccesoHogar)); foreach (YouCom.DTO.AccesoHogar.AccesoHogarDetalleDTO detalle in collAccesoHogarDetalleDTO) { calendarFechas.SelectedDates.Add(detalle.Fecha); } this.SelView(this.mvwAutorizaciones.ActiveViewIndex + 2); } catch (Exception ex) { } }
protected void rptAutorizaciones_ItemCommand(object source, RepeaterCommandEventArgs e) { try { if (e.CommandName.Equals("Eliminar")) { HiddenField HdnIdAccesoHogar = (HiddenField)e.Item.FindControl("HdnIdAccesoHogar"); YouCom.DTO.AccesoHogar.AccesoHogarDTO myAccesoHogarDTO = new YouCom.DTO.AccesoHogar.AccesoHogarDTO(); myAccesoHogarDTO.IdAccesoHogar = decimal.Parse(HdnIdAccesoHogar.Value); myAccesoHogarDTO.UsuarioModificacion = myUsuario.Rut; if (YouCom.bll.AccesoHogar.AccesoHogarBLL.Delete(myAccesoHogarDTO)) { if (!Page.ClientScript.IsClientScriptBlockRegistered("SET")) { string script = "alert('Autorización eliminada correctamente.');"; Page.ClientScript.RegisterStartupScript(this.GetType(), "SET", script, true); } } } if (e.CommandName.Equals("ListaNegra")) { HiddenField HdnIdAccesoHogar = (HiddenField)e.Item.FindControl("HdnIdAccesoHogar"); YouCom.DTO.AccesoHogar.AccesoHogarDTO theAccesoHogarDTO = new YouCom.DTO.AccesoHogar.AccesoHogarDTO(); YouCom.DTO.Propietario.FamiliaDTO theFamiliaDTO = new YouCom.DTO.Propietario.FamiliaDTO(); theFamiliaDTO = YouCom.bll.FamiliaBLL.detalleFamiliabyRut(myUsuario.Rut); theAccesoHogarDTO = YouCom.bll.AccesoHogar.AccesoHogarBLL.detalleAccesoHogar(decimal.Parse(HdnIdAccesoHogar.Value)); YouCom.DTO.ListaNegraDTO theListaNegraDTO = new YouCom.DTO.ListaNegraDTO(); theListaNegraDTO.RutListaNegra = YouCom.Service.Generales.Formato.LimpiarRut(theAccesoHogarDTO.RutVisita.ToUpper()); theListaNegraDTO.NombreListaNegra = theAccesoHogarDTO.NombreVisita.ToUpper(); theListaNegraDTO.ApellidoPaternoListaNegra = ""; theListaNegraDTO.ApellidoMaternoListaNegra = ""; theListaNegraDTO.MotivoListaNegra = ""; theListaNegraDTO.TheCondominioDTO = myUsuario.TheCondominioSeleccionDTO; theListaNegraDTO.TheComunidadDTO = myUsuario.TheComunidadSeleccionDTO; theListaNegraDTO.TheFamiliaDTO = theFamiliaDTO; theListaNegraDTO.UsuarioIngreso = myUsuario.Rut; bool respuesta = YouCom.bll.ListaNegraBLL.Insert(theListaNegraDTO); if (respuesta) { string script = "alert('Autorización agregada como lista negra correctamente.');"; Page.ClientScript.RegisterStartupScript(this.GetType(), "SET", script, true); } else { } } } catch (Exception ex) { } }
protected bool setEnviaIngresoHabitual() { CultureInfo ci = new CultureInfo("Es-Es"); bool retorno = false; bool salida = false; YouCom.DTO.AccesoHogar.AccesoHogarDTO theAccesoHogarDTO = new YouCom.DTO.AccesoHogar.AccesoHogarDTO(); theAccesoHogarDTO.Avisar = "S"; theAccesoHogarDTO.NombreVisita = this.TxtNombre.Text.ToUpper(); theAccesoHogarDTO.ApellidoPaternoVisita = this.TxtApellidoPaterno.Text.ToUpper(); theAccesoHogarDTO.ApellidoMaternoVisita = this.TxtApellidoMaterno.Text.ToUpper(); theAccesoHogarDTO.EmailVisita = this.TxtEmail.Text.ToUpper(); theAccesoHogarDTO.RutVisita = YouCom.Service.Formato.Formato.limpiarRut(this.TxtRut.Text); theAccesoHogarDTO.TheCasaDTO = myUsuario.TheFamiliaDTO.TheCasaDTO; theAccesoHogarDTO.TheCondominioDTO = myUsuario.TheCondominioSeleccionDTO; theAccesoHogarDTO.TheComunidadDTO = myUsuario.TheComunidadSeleccionDTO; YouCom.DTO.AccesoHogar.TipoVisitaDTO myTipoVisitaDTO = new YouCom.DTO.AccesoHogar.TipoVisitaDTO(); myTipoVisitaDTO.IdTipoVisita = decimal.Parse(this.ddlTipoVisita.SelectedValue); theAccesoHogarDTO.TheTipoVisitaDTO = myTipoVisitaDTO; YouCom.DTO.AccesoHogar.FrecuenciaDTO myFrecuenciaDTO = new YouCom.DTO.AccesoHogar.FrecuenciaDTO(); myFrecuenciaDTO.IdFrecuencia = 2; theAccesoHogarDTO.TheFrecuenciaDTO = myFrecuenciaDTO; YouCom.DTO.Propietario.FamiliaDTO myFamiliaDTO = new YouCom.DTO.Propietario.FamiliaDTO(); myFamiliaDTO = YouCom.bll.FamiliaBLL.detalleFamiliabyRut(myUsuario.Rut); theAccesoHogarDTO.TheFamiliaDTO = myFamiliaDTO; theAccesoHogarDTO.FechaInicio = Convert.ToDateTime(this.TxtFechaInicio.Text); theAccesoHogarDTO.FechaTermino = Convert.ToDateTime(this.TxtFechaTermino.Text); theAccesoHogarDTO.HoraInicio = ddlHoraInicio.SelectedValue + ":" + ddlMinutoInicio.SelectedValue; theAccesoHogarDTO.HoraTermino = ddlHoraTermino.SelectedValue + ":" + ddlMinutoTermino.SelectedValue; theAccesoHogarDTO.UsuarioIngreso = myUsuario.Rut; retorno = YouCom.bll.AccesoHogar.AccesoHogarBLL.Insert(theAccesoHogarDTO); if (retorno) { DateTime Desde = Convert.ToDateTime(this.TxtFechaInicio.Text); DateTime Hasta = Convert.ToDateTime(this.TxtFechaTermino.Text); System.TimeSpan diffResultFecha = Desde - Hasta; if (diffResultFecha.Days > 0) { string script = "alert('La fecha desde debe ser menor que la fecha hasta!!!.');"; script += "parent.location = '" + retorno1 + "';"; Page.ClientScript.RegisterStartupScript(this.GetType(), "SET", script, true); } else { System.TimeSpan diffResultFechaCarga = Hasta - Desde; IList <YouCom.DTO.TrxHorasFechasDTO> ITrxHorasFechas = new List <YouCom.DTO.TrxHorasFechasDTO>(); ITrxHorasFechas = YouCom.Service.Generales.General.getGeneraFechas(Desde, diffResultFechaCarga.Days + 1, true, false); foreach (YouCom.DTO.TrxHorasFechasDTO fecha in ITrxHorasFechas) { foreach (ListItem semana in this.rblSemana.Items) { if (semana.Selected) { if (ci.DateTimeFormat.GetDayName(fecha.FechaHora.DayOfWeek).ToUpper() == semana.Text.ToUpper()) { YouCom.DTO.AccesoHogar.AccesoHogarDetalleDTO acceso_detalle = new YouCom.DTO.AccesoHogar.AccesoHogarDetalleDTO(); acceso_detalle.Fecha = fecha.FechaHora; acceso_detalle.UsuarioIngreso = myUsuario.Rut; YouCom.DTO.AccesoHogar.AccesoHogarDTO myAccesoHogarDTO = new YouCom.DTO.AccesoHogar.AccesoHogarDTO(); myAccesoHogarDTO.IdAccesoHogar = theAccesoHogarDTO.IdAccesoHogar; acceso_detalle.TheAccesoHogarDTO = myAccesoHogarDTO; YouCom.bll.AccesoHogar.AccesoHogarDetalleBLL.Insert(acceso_detalle); } } } } } } return(retorno); return(retorno); }