Пример #1
0
    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);
    }