示例#1
0
    protected void rptVotacion_ItemCommand(object source, RepeaterCommandEventArgs e)
    {
        try
        {
            if (e.CommandName.Equals("Detalle"))
            {
                HiddenField HdnIdProyecto = (HiddenField)e.Item.FindControl("hdnIdProyecto");

                YouCom.DTO.ProyectoDTO myProyectoDTO = new YouCom.DTO.ProyectoDTO();
                myProyectoDTO = YouCom.bll.ProyectoBLL.detalleProyecto(decimal.Parse(HdnIdProyecto.Value));

                LitProyectoNombre.Text     = myProyectoDTO.NombreProyecto;
                LitProyectoDecripcion.Text = myProyectoDTO.DescripcionProyecto;
                LitProyectoFecha.Text      = myProyectoDTO.FechaEntregaProyecto.ToShortDateString();
                LitNombreFamilia.Text      = myProyectoDTO.TheEmpresaContratistaDTO.RazonSocialEmpresaContratista;

                this.SelView(this.mvwProyecto.ActiveViewIndex + 1);
            }
        }
        catch (Exception ex)
        {
        }
    }
示例#2
0
    protected void rptProyecto_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 hdnProyectoId = new HiddenField();
            hdnProyectoId = (HiddenField)e.Item.FindControl("hdnProyectoId");

            YouCom.DTO.ProyectoDTO theProyectoDTO = new YouCom.DTO.ProyectoDTO();
            theProyectoDTO = YouCom.bll.ProyectoBLL.detalleProyecto(decimal.Parse(hdnProyectoId.Value));

            this.hdnProyectoId.Value         = theProyectoDTO.IdProyecto.ToString();
            this.txtProyectoNombre.Text      = theProyectoDTO.NombreProyecto;
            this.txtProyectoDescripcion.Text = theProyectoDTO.DescripcionProyecto;
            this.txtDireccion.Text           = theProyectoDTO.DireccionProyecto;

            this.FechaInicio.Text  = theProyectoDTO.FechaInicioProyecto.ToShortDateString();
            this.FechaTermino.Text = theProyectoDTO.FechaTerminoProyecto.ToShortDateString();
            this.FechaEntrega.Text = theProyectoDTO.FechaEntregaProyecto.ToShortDateString();

            this.txtPresupuestoProyecto.Text = theProyectoDTO.PresupuestoProyecto.ToString();

            ddlCondominio.SelectedIndex = ddlCondominio.Items.IndexOf(ddlCondominio.Items.FindByValue(theProyectoDTO.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(theProyectoDTO.TheComunidadDTO.IdComunidad.ToString()));

            ddlEmpresaContratista.SelectedIndex = ddlEmpresaContratista.Items.IndexOf(ddlEmpresaContratista.Items.FindByValue(theProyectoDTO.TheEmpresaContratistaDTO.IdEmpresaContratista.ToString()));

            ddlEstado.SelectedIndex = ddlEstado.Items.IndexOf(ddlEstado.Items.FindByValue(theProyectoDTO.TheProyectoEstadoDTO.IdProyectoEstado.ToString()));

            this.hdnPropuestaId.Value = theProyectoDTO.ThePropuestaDTO.IdPropuesta.ToString();

            btnGrabar.Visible = false;
            btnEditar.Visible = true;
        }
        if (e.CommandName == "Eliminar")
        {
            HiddenField hdnProyectoId = new HiddenField();
            hdnProyectoId = (HiddenField)e.Item.FindControl("hdnProyectoId");

            ProyectoDTO theProyectoDTO = new ProyectoDTO();
            theProyectoDTO.IdProyecto          = decimal.Parse(hdnProyectoId.Value);
            theProyectoDTO.UsuarioModificacion = myUsuario.Rut;

            bool respuesta = YouCom.bll.ProyectoBLL.Delete(theProyectoDTO);
            if (respuesta)
            {
                cargarProyecto();
                if (!Page.ClientScript.IsClientScriptBlockRegistered("SET"))
                {
                    string script = "alert('Proyecto Eliminado correctamente.');";
                    Page.ClientScript.RegisterStartupScript(this.GetType(), "SET", script, true);
                }
            }
            else
            {
            }
        }
    }
    protected void btnEditar_Click(object sender, EventArgs e)
    {
        UserControl  wucCondominio = (UserControl)Page.Master.FindControl("ContentPlaceHolder1").FindControl("wucCondominioCasaFamilia1");
        DropDownList ddlCondominio = (DropDownList)wucCondominio.FindControl("ddlCondominio");
        DropDownList ddlComunidad  = (DropDownList)wucCondominio.FindControl("ddlComunidad");
        DropDownList ddlCasa       = (DropDownList)wucCondominio.FindControl("ddlCasa");
        DropDownList ddlFamilia    = (DropDownList)wucCondominio.FindControl("ddlFamilia");

        btnEditar.Visible = false;
        btnGrabar.Visible = true;

        VotacionPropuestaDTO theVotacionPropuestaDTO = new VotacionPropuestaDTO();

        theVotacionPropuestaDTO.IdVotacionPropuesta           = decimal.Parse(this.hdnVotacionPropuestaId.Value);
        theVotacionPropuestaDTO.FechaInicioVotacionPropuesta  = DateTime.ParseExact(this.FechaIngreso.Text + " " + DateTime.Now.ToString("HH:mm"), "dd/MM/yyyy HH:mm", System.Globalization.CultureInfo.InvariantCulture);
        theVotacionPropuestaDTO.FechaTerminoVotacionPropuesta = DateTime.ParseExact(this.FechaTermino.Text + " " + DateTime.Now.ToString("HH:mm"), "dd/MM/yyyy HH:mm", System.Globalization.CultureInfo.InvariantCulture);

        YouCom.DTO.Seguridad.CondominioDTO myCondominioDTO = new YouCom.DTO.Seguridad.CondominioDTO();
        myCondominioDTO.IdCondominio             = decimal.Parse(ddlCondominio.SelectedValue);
        theVotacionPropuestaDTO.TheCondominioDTO = myCondominioDTO;

        YouCom.DTO.Seguridad.ComunidadDTO myComunidadDTO = new YouCom.DTO.Seguridad.ComunidadDTO();
        myComunidadDTO.IdComunidad = decimal.Parse(ddlComunidad.SelectedValue);
        theVotacionPropuestaDTO.TheComunidadDTO = myComunidadDTO;

        YouCom.DTO.Propuesta.VotacionPropuestaEstadoDTO myVotacionPropuestaEstadoDTO = new YouCom.DTO.Propuesta.VotacionPropuestaEstadoDTO();
        myVotacionPropuestaEstadoDTO.IdVotacionPropuestaEstado = decimal.Parse(this.ddlEstado.SelectedValue);
        theVotacionPropuestaDTO.TheVotacionPropuestaEstadoDTO  = myVotacionPropuestaEstadoDTO;

        YouCom.DTO.Propuesta.PropuestaDTO myPropuestaDTO = new YouCom.DTO.Propuesta.PropuestaDTO();
        myPropuestaDTO.IdPropuesta = decimal.Parse(this.HdnPropuestaId.Value);
        theVotacionPropuestaDTO.ThePropuestaDTO = myPropuestaDTO;

        theVotacionPropuestaDTO.MotivoEstado = txtMotivoEstado.Text;

        theVotacionPropuestaDTO.UsuarioModificacion = myUsuario.Rut;

        bool respuesta = YouCom.bll.VotacionPropuestaBLL.Update(theVotacionPropuestaDTO);

        if (respuesta)
        {
            if (ddlEstado.SelectedValue == "3")
            {
                YouCom.DTO.ProyectoDTO theProyectoDTO = new YouCom.DTO.ProyectoDTO();

                myPropuestaDTO = YouCom.bll.PropuestaBLL.detallePropuesta(myPropuestaDTO.IdPropuesta);

                theProyectoDTO.ThePropuestaDTO = myPropuestaDTO;

                theProyectoDTO.NombreProyecto       = myPropuestaDTO.NombrePropuesta;
                theProyectoDTO.DescripcionProyecto  = myPropuestaDTO.DescripcionPropuesta;
                theProyectoDTO.FechaInicioProyecto  = DateTime.Now;
                theProyectoDTO.FechaTerminoProyecto = DateTime.Now.AddDays(90);
                theProyectoDTO.FechaEntregaProyecto = DateTime.Now.AddDays(120);
                theProyectoDTO.PresupuestoProyecto  = 0;
                theProyectoDTO.DireccionProyecto    = myPropuestaDTO.DireccionPropuesta;

                YouCom.DTO.EmpresaContratistaDTO myEmpresaContratistaDTO = new YouCom.DTO.EmpresaContratistaDTO();
                myEmpresaContratistaDTO.IdEmpresaContratista = 1;
                theProyectoDTO.TheEmpresaContratistaDTO      = myEmpresaContratistaDTO;

                YouCom.DTO.ProyectoEstadoDTO myProyectoEstadoDTO = new YouCom.DTO.ProyectoEstadoDTO();
                myProyectoEstadoDTO.IdProyectoEstado = 1;
                theProyectoDTO.TheProyectoEstadoDTO  = myProyectoEstadoDTO;

                myCondominioDTO.IdCondominio    = decimal.Parse(ddlCondominio.SelectedValue);
                theProyectoDTO.TheCondominioDTO = myCondominioDTO;

                myComunidadDTO.IdComunidad     = decimal.Parse(ddlComunidad.SelectedValue);
                theProyectoDTO.TheComunidadDTO = myComunidadDTO;

                theProyectoDTO.UsuarioIngreso = myUsuario.Rut;

                bool respuesta_votacion = YouCom.bll.ProyectoBLL.Insert(theProyectoDTO);

                if (respuesta_votacion)
                {
                    cargarVotacionPropuesta();
                    this.txtVotacionPropuestaNombre.Text      = string.Empty;
                    this.txtVotacionPropuestaDescripcion.Text = string.Empty;
                    this.FechaTermino.Text = string.Empty;
                    this.FechaIngreso.Text = string.Empty;

                    ddlCondominio.ClearSelection();
                    ddlComunidad.ClearSelection();
                    ddlFamilia.ClearSelection();

                    if (!Page.ClientScript.IsClientScriptBlockRegistered("SET"))
                    {
                        string script = "alert('Se ha cambiado el estado de la Votacion Propuesta correctamente.');";
                        Page.ClientScript.RegisterStartupScript(this.GetType(), "SET", script, true);
                    }
                }
            }
            else
            {
                cargarVotacionPropuesta();
                this.txtVotacionPropuestaNombre.Text      = string.Empty;
                this.txtVotacionPropuestaDescripcion.Text = string.Empty;
                this.FechaTermino.Text = string.Empty;
                this.FechaIngreso.Text = string.Empty;

                ddlCondominio.ClearSelection();
                ddlComunidad.ClearSelection();
                ddlFamilia.ClearSelection();

                if (!Page.ClientScript.IsClientScriptBlockRegistered("SET"))
                {
                    string script = "alert('Votacion Propuesta editado correctamente.');";
                    Page.ClientScript.RegisterStartupScript(this.GetType(), "SET", script, true);
                }
            }
        }
        else
        {
        }
    }