protected void rptAutorizaciones_ItemDataBound(object sender, RepeaterItemEventArgs e) { try { if (e.Item.ItemIndex > -1) { if (!string.IsNullOrEmpty(((YouCom.DTO.AccesoHogar.AccesoHogarDTO)e.Item.DataItem).IdAccesoHogar.ToString())) { Literal myLitNombreActividad = new Literal(); Literal myLitFrecuencia = new Literal(); myLitNombreActividad = (Literal)e.Item.FindControl("LitNombreActividad"); myLitFrecuencia = (Literal)e.Item.FindControl("LitFrecuencia"); YouCom.DTO.AccesoHogar.TipoVisitaDTO myTipoVisitaDTO = new YouCom.DTO.AccesoHogar.TipoVisitaDTO(); YouCom.DTO.AccesoHogar.FrecuenciaDTO myFrecuenciaDTO = new YouCom.DTO.AccesoHogar.FrecuenciaDTO(); myTipoVisitaDTO = YouCom.bll.AccesoHogar.TipoVisitaBLL.detalleTipoVisita(((YouCom.DTO.AccesoHogar.AccesoHogarDTO)e.Item.DataItem).TheTipoVisitaDTO.IdTipoVisita); myFrecuenciaDTO = YouCom.bll.AccesoHogar.FrecuenciaBLL.detalleFrecuencia(((YouCom.DTO.AccesoHogar.AccesoHogarDTO)e.Item.DataItem).TheFrecuenciaDTO.IdFrecuencia); myLitNombreActividad.Text = myTipoVisitaDTO.NombreTipoVisita.ToString(); myLitFrecuencia.Text = myFrecuenciaDTO.NombreFrecuencia.ToString(); } } } 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); }
protected void rptTipoVisita_OnItemCommand(object sender, RepeaterCommandEventArgs e) { UserControl wucCondominio = (UserControl)Page.Master.FindControl("ContentPlaceHolder1").FindControl("wucCondominio1"); DropDownList ddlCondominio = (DropDownList)wucCondominio.FindControl("ddlCondominio"); DropDownList ddlComunidad = (DropDownList)wucCondominio.FindControl("ddlComunidad"); if (e.CommandName == "Editar") { HiddenField hdnIdTipoVisita = new HiddenField(); hdnIdTipoVisita = (HiddenField)e.Item.FindControl("hdnIdTipoVisita"); YouCom.DTO.AccesoHogar.TipoVisitaDTO theTipoVisitaDTO = new YouCom.DTO.AccesoHogar.TipoVisitaDTO(); theTipoVisitaDTO = YouCom.bll.AccesoHogar.TipoVisitaBLL.detalleTipoVisita(decimal.Parse(hdnIdTipoVisita.Value)); txtNombre.Text = theTipoVisitaDTO.NombreTipoVisita; this.hdnIdTipoVisita.Value = theTipoVisitaDTO.IdTipoVisita.ToString(); ddlCondominio.SelectedIndex = ddlCondominio.Items.IndexOf(ddlCondominio.Items.FindByValue(theTipoVisitaDTO.TheCondominioDTO.IdCondominio.ToString())); ddlComunidad.DataSource = YouCom.bll.ComunidadBLL.getListadoComunidadByCondominio(decimal.Parse(ddlCondominio.SelectedValue)); ddlComunidad.DataTextField = "NombreComunidad"; ddlComunidad.DataValueField = "IdComunidad"; ddlComunidad.DataBind(); ddlComunidad.Items.Insert(0, new ListItem("Seleccione Comunidad", string.Empty)); ddlComunidad.SelectedIndex = ddlComunidad.Items.IndexOf(ddlComunidad.Items.FindByValue(theTipoVisitaDTO.TheComunidadDTO.IdComunidad.ToString())); btnGrabar.Visible = false; btnEditar.Visible = true; } if (e.CommandName == "Eliminar") { HiddenField hdnTipoSistema = new HiddenField(); hdnTipoSistema = (HiddenField)e.Item.FindControl("HdnTipoSistema"); HiddenField hdnDescripcion = new HiddenField(); hdnDescripcion = (HiddenField)e.Item.FindControl("hdnDescripcion"); TipoVisitaDTO theTipoVisitaDTO = new TipoVisitaDTO(); theTipoVisitaDTO.IdTipoVisita = decimal.Parse(hdnTipoSistema.Value); theTipoVisitaDTO.UsuarioModificacion = myUsuario.Rut; bool validacionIntegridad = YouCom.bll.AccesoHogar.TipoVisitaBLL.ValidaEliminacionTipoVisita(theTipoVisitaDTO); if (validacionIntegridad) { string script = "alert(' No es posible eliminar un TipoVisita con aviso asociado.');"; Page.ClientScript.RegisterStartupScript(this.GetType(), "SET", script, true); return; } else { bool respuesta = YouCom.bll.AccesoHogar.TipoVisitaBLL.Delete(theTipoVisitaDTO); if (respuesta) { cargarTipoVisita(); if (!Page.ClientScript.IsClientScriptBlockRegistered("SET")) { string script = "alert('Casa Eliminada correctamente.');"; Page.ClientScript.RegisterStartupScript(this.GetType(), "SET", script, true); } } else { } } } }