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"); 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.Insert(theVotacionPropuestaDTO); if (respuesta) { 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(); string script = "alert('VotacionPropuesta ingresada correctamente.');"; Page.ClientScript.RegisterStartupScript(this.GetType(), "SET", script, true); cargarVotacionPropuesta(); } else { } }
protected void rptVotacion_ItemCommand(object source, RepeaterCommandEventArgs e) { try { if (e.CommandName.Equals("Detalle")) { HiddenField HdnIdPropuesta = (HiddenField)e.Item.FindControl("hdnIdPropuesta"); HiddenField HdnIdVotacionPropuesta = (HiddenField)e.Item.FindControl("hdnIdVotacionPropuesta"); YouCom.DTO.Propuesta.PropuestaDTO myPropuestaDTO = new YouCom.DTO.Propuesta.PropuestaDTO(); myPropuestaDTO = YouCom.bll.PropuestaBLL.detallePropuesta(decimal.Parse(HdnIdPropuesta.Value)); LitPropuestaNombre.Text = myPropuestaDTO.NombrePropuesta; LitPropuestaDecripcion.Text = myPropuestaDTO.DescripcionPropuesta; LitPropuestaFecha.Text = myPropuestaDTO.FechaPropuesta.ToShortDateString(); LitNombreFamilia.Text = myPropuestaDTO.TheFamiliaDTO.NombreCompleto; this.hdnVotacionPropuestaId.Value = HdnIdVotacionPropuesta.Value; YouCom.DTO.Propietario.FamiliaDTO myFamiliaDTO = new YouCom.DTO.Propietario.FamiliaDTO(); myFamiliaDTO = YouCom.bll.FamiliaBLL.detalleFamiliabyRut(myUsuario.Rut); YouCom.DTO.Propuesta.VotacionPropuestaRespuestaDTO myVotacionPropuestaRespuestaDTO = new YouCom.DTO.Propuesta.VotacionPropuestaRespuestaDTO(); myVotacionPropuestaRespuestaDTO = YouCom.bll.VotacionPropuestaRespuestaBLL.detalleVotacionPropuestaRespuesta(decimal.Parse(this.hdnVotacionPropuestaId.Value), myFamiliaDTO.IdFamilia); if (!string.IsNullOrEmpty(myVotacionPropuestaRespuestaDTO.EleccionVotacion)) { rdbSeleccion.SelectedIndex = rdbSeleccion.Items.IndexOf(rdbSeleccion.Items.FindByValue(myVotacionPropuestaRespuestaDTO.EleccionVotacion.ToString())); } if (!string.IsNullOrEmpty(rdbSeleccion.SelectedValue)) { rdbSeleccion.Enabled = false; BtnEnviar.Enabled = false; } else { rdbSeleccion.Enabled = true; BtnEnviar.Enabled = true; } this.SelView(this.mvwVotacion.ActiveViewIndex + 1); } } catch (Exception ex) { } }
protected void btnEditar_Click(object sender, EventArgs e) { UserControl wucCondominio = (UserControl)Page.Master.FindControl("ContentPlaceHolder1").FindControl("wucCondominio1"); DropDownList ddlCondominio = (DropDownList)wucCondominio.FindControl("ddlCondominio"); DropDownList ddlComunidad = (DropDownList)wucCondominio.FindControl("ddlComunidad"); btnEditar.Visible = false; btnGrabar.Visible = true; ProyectoDTO theProyectoDTO = new ProyectoDTO(); theProyectoDTO.IdProyecto = decimal.Parse(this.hdnProyectoId.Value); theProyectoDTO.NombreProyecto = this.txtProyectoNombre.Text.ToUpper(); theProyectoDTO.DescripcionProyecto = this.txtProyectoDescripcion.Text.ToUpper(); theProyectoDTO.FechaInicioProyecto = DateTime.ParseExact(this.FechaInicio.Text + " " + DateTime.Now.ToString("HH:mm"), "dd/MM/yyyy HH:mm", System.Globalization.CultureInfo.InvariantCulture); theProyectoDTO.FechaTerminoProyecto = DateTime.ParseExact(this.FechaTermino.Text + " " + DateTime.Now.ToString("HH:mm"), "dd/MM/yyyy HH:mm", System.Globalization.CultureInfo.InvariantCulture); theProyectoDTO.FechaEntregaProyecto = DateTime.ParseExact(this.FechaEntrega.Text + " " + DateTime.Now.ToString("HH:mm"), "dd/MM/yyyy HH:mm", System.Globalization.CultureInfo.InvariantCulture); theProyectoDTO.DireccionProyecto = this.txtDireccion.Text.ToUpper(); theProyectoDTO.PresupuestoProyecto = decimal.Parse(this.txtPresupuestoProyecto.Text); YouCom.DTO.Seguridad.CondominioDTO myCondominioDTO = new YouCom.DTO.Seguridad.CondominioDTO(); myCondominioDTO.IdCondominio = decimal.Parse(ddlCondominio.SelectedValue); theProyectoDTO.TheCondominioDTO = myCondominioDTO; YouCom.DTO.Seguridad.ComunidadDTO myComunidadDTO = new YouCom.DTO.Seguridad.ComunidadDTO(); myComunidadDTO.IdComunidad = decimal.Parse(ddlComunidad.SelectedValue); theProyectoDTO.TheComunidadDTO = myComunidadDTO; YouCom.DTO.ProyectoEstadoDTO myProyectoEstadoDTO = new YouCom.DTO.ProyectoEstadoDTO(); myProyectoEstadoDTO.IdProyectoEstado = decimal.Parse(this.ddlEstado.SelectedValue); theProyectoDTO.TheProyectoEstadoDTO = myProyectoEstadoDTO; YouCom.DTO.EmpresaContratistaDTO myEmpresaContratistaDTO = new YouCom.DTO.EmpresaContratistaDTO(); myEmpresaContratistaDTO.IdEmpresaContratista = decimal.Parse(this.ddlEmpresaContratista.SelectedValue); theProyectoDTO.TheEmpresaContratistaDTO = myEmpresaContratistaDTO; YouCom.DTO.Propuesta.PropuestaDTO myPropuestaDTO = new YouCom.DTO.Propuesta.PropuestaDTO(); myPropuestaDTO.IdPropuesta = decimal.Parse(this.hdnPropuestaId.Value); theProyectoDTO.ThePropuestaDTO = myPropuestaDTO; theProyectoDTO.UsuarioModificacion = myUsuario.Rut; bool respuesta = YouCom.bll.ProyectoBLL.Update(theProyectoDTO); if (respuesta) { cargarProyecto(); this.txtProyectoNombre.Text = string.Empty; this.txtProyectoDescripcion.Text = string.Empty; this.txtDireccion.Text = string.Empty; this.FechaInicio.Text = string.Empty; this.FechaTermino.Text = string.Empty; this.FechaEntrega.Text = string.Empty; this.txtPresupuestoProyecto.Text = string.Empty; ddlCondominio.ClearSelection(); ddlComunidad.ClearSelection(); this.ddlEmpresaContratista.ClearSelection(); if (!Page.ClientScript.IsClientScriptBlockRegistered("SET")) { string script = "alert('Proyecto editado 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 { } }
protected void rptPropuesta_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 hdnPropuestaId = new HiddenField(); hdnPropuestaId = (HiddenField)e.Item.FindControl("hdnPropuestaId"); YouCom.DTO.Propuesta.PropuestaDTO thePropuestaDTO = new YouCom.DTO.Propuesta.PropuestaDTO(); thePropuestaDTO = YouCom.bll.PropuestaBLL.detallePropuesta(decimal.Parse(hdnPropuestaId.Value)); this.hdnPropuestaId.Value = thePropuestaDTO.IdPropuesta.ToString(); this.txtPropuestaNombre.Text = thePropuestaDTO.NombrePropuesta; this.txtPropuestaDescripcion.Text = thePropuestaDTO.DescripcionPropuesta; this.txtDireccion.Text = thePropuestaDTO.DireccionPropuesta; this.FechaIngreso.Text = thePropuestaDTO.FechaPropuesta.ToShortDateString(); ddlCondominio.SelectedIndex = ddlCondominio.Items.IndexOf(ddlCondominio.Items.FindByValue(thePropuestaDTO.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(thePropuestaDTO.TheComunidadDTO.IdComunidad.ToString())); YouCom.DTO.Propietario.FamiliaDTO myFamiliaDTO = new YouCom.DTO.Propietario.FamiliaDTO(); myFamiliaDTO = YouCom.bll.FamiliaBLL.detalleFamilia(thePropuestaDTO.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(thePropuestaDTO.TheFamiliaDTO.IdFamilia.ToString())); ddlEstado.SelectedIndex = ddlEstado.Items.IndexOf(ddlEstado.Items.FindByValue(thePropuestaDTO.ThePropuestaEstadoDTO.IdPropuestaEstado.ToString())); btnGrabar.Visible = false; btnEditar.Visible = true; } if (e.CommandName == "Eliminar") { 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.Delete(thePropuestaDTO); if (respuesta) { cargarPropuesta(); if (!Page.ClientScript.IsClientScriptBlockRegistered("SET")) { string script = "alert('Propuesta Eliminado correctamente.');"; Page.ClientScript.RegisterStartupScript(this.GetType(), "SET", script, true); } } else { } } }