protected bool setEnviaIniciativa() { bool retorno = false; YouCom.DTO.Propuesta.PropuestaDTO thePropuestaDTO = new YouCom.DTO.Propuesta.PropuestaDTO(); YouCom.DTO.PropuestaEstadoDTO myPropuestaEstadoDTO = new YouCom.DTO.PropuestaEstadoDTO(); myPropuestaEstadoDTO.IdPropuestaEstado = 1; thePropuestaDTO.ThePropuestaEstadoDTO = myPropuestaEstadoDTO; thePropuestaDTO.NombrePropuesta = TxtNombreIniciativa.Text; thePropuestaDTO.DescripcionPropuesta = this.TxtDescripcion.Text; thePropuestaDTO.DireccionPropuesta = this.TxtDireccion.Text; thePropuestaDTO.FechaPropuesta = DateTime.Now; thePropuestaDTO.TheComunidadDTO = myUsuario.TheComunidadSeleccionDTO; thePropuestaDTO.TheCondominioDTO = myUsuario.TheCondominioSeleccionDTO; YouCom.DTO.Propietario.FamiliaDTO myFamiliaDTO = new YouCom.DTO.Propietario.FamiliaDTO(); myFamiliaDTO = YouCom.bll.FamiliaBLL.detalleFamiliabyRut(myUsuario.Rut); thePropuestaDTO.TheFamiliaDTO = myFamiliaDTO; thePropuestaDTO.UsuarioIngreso = myUsuario.Rut; retorno = YouCom.bll.PropuestaBLL.Insert(thePropuestaDTO); return(retorno); }
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 { } }
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 { } }