public List <PropuestaDTO> Get([FromUri] int userId, [FromUri] string query) { var Propuestas = ProposalService.BusquedaPropuestasAjenasPorParametro(query, userId, true); List <PropuestaDTO> dto = new List <PropuestaDTO>(); foreach (var item in Propuestas) { PropuestaDTO p = new PropuestaDTO(); p.ID = item.IdPropuesta.ToString(); p.Foto = item.Foto; p.Nombre = item.Nombre; p.NombreUsuario = item.Usuarios.Nombre; p.ApellidoUsuario = item.Usuarios.Apellido; p.EmailUsuario = item.Usuarios.Email; p.FechaCreacion = item.FechaCreacion.ToString(); p.Descripcion = item.Descripcion; p.Valoracion = item.Valoracion.ToString(); p.Referencias = new List <ReferenciaDTO>(); foreach (var referencia in item.PropuestasReferencias) { ReferenciaDTO r = new ReferenciaDTO(); r.Nombre = referencia.Nombre; r.Telefono = referencia.Telefono; p.Referencias.Add(r); } dto.Add(p); } return(dto); }
protected void rptPropuestaInactivo_OnItemCommand(object sender, RepeaterCommandEventArgs e) { if (e.CommandName == "Activar") { HiddenField hdnPropuestaId = new HiddenField(); hdnPropuestaId = (HiddenField)e.Item.FindControl("hdnPropuestaId"); PropuestaDTO thePropuestaDTO = new PropuestaDTO(); thePropuestaDTO.IdPropuesta = decimal.Parse(hdnPropuestaId.Value); thePropuestaDTO.UsuarioModificacion = myUsuario.Rut; bool respuesta = YouCom.bll.PropuestaBLL.ActivaPropuesta(thePropuestaDTO); if (respuesta) { cargarPropuestaInactivo(); if (!Page.ClientScript.IsClientScriptBlockRegistered("SET")) { string script = "alert('Propuesta activado correctamente.');"; Page.ClientScript.RegisterStartupScript(this.GetType(), "SET", script, true); } } else { } } }
protected void btnGrabar_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"); PropuestaDTO thePropuestaDTO = new PropuestaDTO(); thePropuestaDTO.NombrePropuesta = this.txtPropuestaNombre.Text.ToUpper(); thePropuestaDTO.DescripcionPropuesta = this.txtPropuestaDescripcion.Text.ToUpper(); thePropuestaDTO.FechaPropuesta = DateTime.ParseExact(this.FechaIngreso.Text + " " + DateTime.Now.ToString("HH:mm"), "dd/MM/yyyy HH:mm", System.Globalization.CultureInfo.InvariantCulture); thePropuestaDTO.DireccionPropuesta = this.txtDireccion.Text.ToUpper(); YouCom.DTO.Seguridad.CondominioDTO myCondominioDTO = new YouCom.DTO.Seguridad.CondominioDTO(); myCondominioDTO.IdCondominio = decimal.Parse(ddlCondominio.SelectedValue); thePropuestaDTO.TheCondominioDTO = myCondominioDTO; YouCom.DTO.Seguridad.ComunidadDTO myComunidadDTO = new YouCom.DTO.Seguridad.ComunidadDTO(); myComunidadDTO.IdComunidad = decimal.Parse(ddlComunidad.SelectedValue); thePropuestaDTO.TheComunidadDTO = myComunidadDTO; YouCom.DTO.PropuestaEstadoDTO myPropuestaEstadoDTO = new YouCom.DTO.PropuestaEstadoDTO(); myPropuestaEstadoDTO.IdPropuestaEstado = decimal.Parse(this.ddlEstado.SelectedValue); thePropuestaDTO.ThePropuestaEstadoDTO = myPropuestaEstadoDTO; YouCom.DTO.Propietario.FamiliaDTO myFamiliaDTO = new YouCom.DTO.Propietario.FamiliaDTO(); myFamiliaDTO.IdFamilia = decimal.Parse(ddlFamilia.SelectedValue); thePropuestaDTO.TheFamiliaDTO = myFamiliaDTO; thePropuestaDTO.UsuarioIngreso = myUsuario.Rut; bool respuesta = YouCom.bll.PropuestaBLL.Insert(thePropuestaDTO); if (respuesta) { this.txtPropuestaNombre.Text = string.Empty; this.txtPropuestaDescripcion.Text = string.Empty; this.txtDireccion.Text = string.Empty; this.FechaIngreso.Text = string.Empty; ddlCondominio.ClearSelection(); ddlComunidad.ClearSelection(); ddlFamilia.ClearSelection(); string script = "alert('Propuesta ingresada correctamente.');"; Page.ClientScript.RegisterStartupScript(this.GetType(), "SET", script, true); cargarPropuesta(); } else { } }
public static bool ValidaEliminacionPropuesta(PropuestaDTO thePropuestaDTO) { bool respuesta = facade.Propuesta.ValidaEliminacionPropuesta(thePropuestaDTO); return(respuesta); }
public static bool ActivaPropuesta(PropuestaDTO thePropuestaDTO) { bool respuesta = YouCom.DAL.PropuestaDAL.ActivaPropuesta(thePropuestaDTO); return(respuesta); }
protected void rptVotacionPropuesta_OnItemCommand(object sender, RepeaterCommandEventArgs 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"); if (e.CommandName == "Editar") { HiddenField hdnVotacionPropuestaId = new HiddenField(); hdnVotacionPropuestaId = (HiddenField)e.Item.FindControl("hdnVotacionPropuestaId"); YouCom.DTO.Propuesta.PropuestaDTO myPropuestaDTO = new PropuestaDTO(); YouCom.DTO.Propuesta.VotacionPropuestaDTO theVotacionPropuestaDTO = new YouCom.DTO.Propuesta.VotacionPropuestaDTO(); theVotacionPropuestaDTO = YouCom.bll.VotacionPropuestaBLL.detalleVotacionPropuesta(decimal.Parse(hdnVotacionPropuestaId.Value)); myPropuestaDTO = YouCom.bll.PropuestaBLL.detallePropuesta(theVotacionPropuestaDTO.ThePropuestaDTO.IdPropuesta); this.hdnVotacionPropuestaId.Value = theVotacionPropuestaDTO.IdVotacionPropuesta.ToString(); this.txtVotacionPropuestaNombre.Text = theVotacionPropuestaDTO.ThePropuestaDTO.NombrePropuesta; this.txtVotacionPropuestaDescripcion.Text = theVotacionPropuestaDTO.ThePropuestaDTO.DescripcionPropuesta; this.FechaTermino.Text = theVotacionPropuestaDTO.FechaTerminoVotacionPropuesta.ToShortDateString(); this.FechaIngreso.Text = theVotacionPropuestaDTO.FechaInicioVotacionPropuesta.ToShortDateString(); ddlCondominio.SelectedIndex = ddlCondominio.Items.IndexOf(ddlCondominio.Items.FindByValue(theVotacionPropuestaDTO.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(theVotacionPropuestaDTO.TheComunidadDTO.IdComunidad.ToString())); YouCom.DTO.Propietario.FamiliaDTO myFamiliaDTO = new YouCom.DTO.Propietario.FamiliaDTO(); myFamiliaDTO = YouCom.bll.FamiliaBLL.detalleFamilia(myPropuestaDTO.TheFamiliaDTO.IdFamilia); ddlCasa.DataSource = YouCom.bll.CasaBLL.getListadoCasaByComunidad(decimal.Parse(ddlComunidad.SelectedValue)); ddlCasa.DataTextField = "NombreCasa"; ddlCasa.DataValueField = "IdCasa"; ddlCasa.DataBind(); ddlCasa.Items.Insert(0, new ListItem("Seleccione Casa", string.Empty)); ddlCasa.SelectedIndex = ddlCasa.Items.IndexOf(ddlCasa.Items.FindByValue(myFamiliaDTO.TheCasaDTO.IdCasa.ToString())); ddlFamilia.DataSource = YouCom.bll.FamiliaBLL.getListadoFamiliaByCasa(decimal.Parse(ddlCasa.SelectedValue)); ddlFamilia.DataTextField = "NombreCompleto"; ddlFamilia.DataValueField = "IdFamilia"; ddlFamilia.DataBind(); ddlFamilia.Items.Insert(0, new ListItem("Seleccione Familia", string.Empty)); ddlFamilia.SelectedIndex = ddlFamilia.Items.IndexOf(ddlFamilia.Items.FindByValue(myPropuestaDTO.TheFamiliaDTO.IdFamilia.ToString())); ddlEstado.SelectedIndex = ddlEstado.Items.IndexOf(ddlEstado.Items.FindByValue(theVotacionPropuestaDTO.TheVotacionPropuestaEstadoDTO.IdVotacionPropuestaEstado.ToString())); this.HdnPropuestaId.Value = theVotacionPropuestaDTO.ThePropuestaDTO.IdPropuesta.ToString(); IList <VotacionPropuestaRespuestaDTO> theVotacionPropuestaRespuestaDTO = new List <VotacionPropuestaRespuestaDTO>(); theVotacionPropuestaRespuestaDTO = YouCom.bll.VotacionPropuestaRespuestaBLL.getListadoVotacionPropuestaRespuestaByVotacion(decimal.Parse(hdnVotacionPropuestaId.Value)); LitCantidadSi.Text = theVotacionPropuestaRespuestaDTO.Where(x => x.EleccionVotacion == "SI").Count().ToString(); LitCantidadNo.Text = theVotacionPropuestaRespuestaDTO.Where(x => x.EleccionVotacion == "NO").Count().ToString(); btnGrabar.Visible = false; btnEditar.Visible = true; } if (e.CommandName == "Eliminar") { HiddenField hdnVotacionPropuestaId = new HiddenField(); hdnVotacionPropuestaId = (HiddenField)e.Item.FindControl("hdnVotacionPropuestaId"); VotacionPropuestaDTO theVotacionPropuestaDTO = new VotacionPropuestaDTO(); theVotacionPropuestaDTO.IdVotacionPropuesta = decimal.Parse(hdnVotacionPropuestaId.Value); theVotacionPropuestaDTO.UsuarioModificacion = myUsuario.Rut; bool respuesta = YouCom.bll.VotacionPropuestaBLL.Delete(theVotacionPropuestaDTO); if (respuesta) { cargarVotacionPropuesta(); if (!Page.ClientScript.IsClientScriptBlockRegistered("SET")) { string script = "alert('VotacionPropuesta Eliminado correctamente.');"; Page.ClientScript.RegisterStartupScript(this.GetType(), "SET", script, true); } } else { } } if (e.CommandName == "Votaciones") { HiddenField hdnVotacionPropuestaId = new HiddenField(); hdnVotacionPropuestaId = (HiddenField)e.Item.FindControl("hdnVotacionPropuestaId"); pnlAdministracionVotacionPropuesta.Visible = false; pnlVotaciones.Visible = true; IList <VotacionPropuestaRespuestaDTO> theVotacionPropuestaRespuestaDTO = new List <VotacionPropuestaRespuestaDTO>(); theVotacionPropuestaRespuestaDTO = YouCom.bll.VotacionPropuestaRespuestaBLL.getListadoVotacionPropuestaRespuestaByVotacion(decimal.Parse(hdnVotacionPropuestaId.Value)); rptVotaciones.DataSource = theVotacionPropuestaRespuestaDTO; rptVotaciones.DataBind(); } }
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; PropuestaDTO thePropuestaDTO = new PropuestaDTO(); thePropuestaDTO.IdPropuesta = decimal.Parse(this.hdnPropuestaId.Value); thePropuestaDTO.NombrePropuesta = this.txtPropuestaNombre.Text.ToUpper(); thePropuestaDTO.DescripcionPropuesta = this.txtPropuestaDescripcion.Text.ToUpper(); thePropuestaDTO.FechaPropuesta = DateTime.ParseExact(this.FechaIngreso.Text + " " + DateTime.Now.ToString("HH:mm"), "dd/MM/yyyy HH:mm", System.Globalization.CultureInfo.InvariantCulture); thePropuestaDTO.DireccionPropuesta = this.txtDireccion.Text.ToUpper(); YouCom.DTO.Seguridad.CondominioDTO myCondominioDTO = new YouCom.DTO.Seguridad.CondominioDTO(); myCondominioDTO.IdCondominio = decimal.Parse(ddlCondominio.SelectedValue); thePropuestaDTO.TheCondominioDTO = myCondominioDTO; YouCom.DTO.Seguridad.ComunidadDTO myComunidadDTO = new YouCom.DTO.Seguridad.ComunidadDTO(); myComunidadDTO.IdComunidad = decimal.Parse(ddlComunidad.SelectedValue); thePropuestaDTO.TheComunidadDTO = myComunidadDTO; YouCom.DTO.PropuestaEstadoDTO myPropuestaEstadoDTO = new YouCom.DTO.PropuestaEstadoDTO(); myPropuestaEstadoDTO.IdPropuestaEstado = decimal.Parse(this.ddlEstado.SelectedValue); thePropuestaDTO.ThePropuestaEstadoDTO = myPropuestaEstadoDTO; thePropuestaDTO.MotivoEstado = txtMotivoEstado.Text; YouCom.DTO.Propietario.FamiliaDTO myFamiliaDTO = new YouCom.DTO.Propietario.FamiliaDTO(); myFamiliaDTO.IdFamilia = decimal.Parse(ddlFamilia.SelectedValue); thePropuestaDTO.TheFamiliaDTO = myFamiliaDTO; thePropuestaDTO.UsuarioModificacion = myUsuario.Rut; bool respuesta = YouCom.bll.PropuestaBLL.Update(thePropuestaDTO); if (respuesta) { if (ddlEstado.SelectedValue == "3") { VotacionPropuestaDTO theVotacionPropuestaDTO = new VotacionPropuestaDTO(); theVotacionPropuestaDTO.FechaInicioVotacionPropuesta = DateTime.Now; theVotacionPropuestaDTO.FechaTerminoVotacionPropuesta = DateTime.Now.AddDays(30); myCondominioDTO.IdCondominio = decimal.Parse(ddlCondominio.SelectedValue); theVotacionPropuestaDTO.TheCondominioDTO = myCondominioDTO; 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; theVotacionPropuestaDTO.ThePropuestaDTO = thePropuestaDTO; theVotacionPropuestaDTO.UsuarioIngreso = myUsuario.Rut; bool respuesta_votacion = YouCom.bll.VotacionPropuestaBLL.Insert(theVotacionPropuestaDTO); if (respuesta_votacion) { cargarPropuesta(); this.txtPropuestaNombre.Text = string.Empty; this.txtPropuestaDescripcion.Text = string.Empty; this.txtDireccion.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 propuesta correctamente.');"; Page.ClientScript.RegisterStartupScript(this.GetType(), "SET", script, true); } } } else { cargarPropuesta(); this.txtPropuestaNombre.Text = string.Empty; this.txtPropuestaDescripcion.Text = string.Empty; this.txtDireccion.Text = string.Empty; this.FechaIngreso.Text = string.Empty; ddlCondominio.ClearSelection(); ddlComunidad.ClearSelection(); ddlFamilia.ClearSelection(); if (!Page.ClientScript.IsClientScriptBlockRegistered("SET")) { string script = "alert('Propuesta editado correctamente.');"; Page.ClientScript.RegisterStartupScript(this.GetType(), "SET", script, true); } } } else { } }