protected void rptForoComunidad_ItemCommand(object source, RepeaterCommandEventArgs e) { try { if (e.CommandName.Equals("Detalle")) { HiddenField myHidIdForo = (HiddenField)e.Item.FindControl("HidIdForoComunidad"); HdnIdForoComunidad.Value = myHidIdForo.Value; YouCom.DTO.Foro.ForoComunidadDTO myForoComunidadDTO = new YouCom.DTO.Foro.ForoComunidadDTO(); myForoComunidadDTO = YouCom.bll.ForoComunidadBLL.detalleForoComunidad(decimal.Parse(myHidIdForo.Value)); LitForoComunidadTitulo.Text = myForoComunidadDTO.TituloForoComunidad; LitForoComunidadDetalle.Text = myForoComunidadDTO.DescripcionForoComunidad; cargarComentarioForoComunidad(); this.SelView(this.mvwAviso.ActiveViewIndex + 1); } } catch (Exception ex) { } }
protected bool setEnviaForo() { bool retorno = false; YouCom.DTO.Foro.ForoComunidadDTO theForoComunidadDTO = new YouCom.DTO.Foro.ForoComunidadDTO(); theForoComunidadDTO.TituloForoComunidad = this.TxtTitulo.Text.ToUpper(); theForoComunidadDTO.DescripcionForoComunidad = this.TxtDescripcion.Text.ToUpper(); theForoComunidadDTO.FechaForoComunidad = DateTime.Now; theForoComunidadDTO.IdPadre = 0; theForoComunidadDTO.TheComunidadDTO = myUsuario.TheComunidadSeleccionDTO; theForoComunidadDTO.TheCondominioDTO = myUsuario.TheCondominioSeleccionDTO; YouCom.DTO.Propietario.FamiliaDTO myFamiliaDTO = new YouCom.DTO.Propietario.FamiliaDTO(); myFamiliaDTO = YouCom.bll.FamiliaBLL.detalleFamiliabyRut(myUsuario.Rut); theForoComunidadDTO.TheFamiliaDTO = myFamiliaDTO; YouCom.DTO.CategoriaDTO myCategoriaDTO = new YouCom.DTO.CategoriaDTO(); myCategoriaDTO.IdCategoria = decimal.Parse(ddlCategoria.SelectedValue); theForoComunidadDTO.TheCategoriaDTO = myCategoriaDTO; YouCom.DTO.Foro.ForoComunidadEstadoDTO myForoComunidadEstadoDTO = new YouCom.DTO.Foro.ForoComunidadEstadoDTO(); myForoComunidadEstadoDTO.IdForoComunidadEstado = 1; theForoComunidadDTO.TheForoComunidadEstadoDTO = myForoComunidadEstadoDTO; theForoComunidadDTO.UsuarioIngreso = myUsuario.Rut; bool respuesta = YouCom.bll.ForoComunidadBLL.Insert(theForoComunidadDTO); return(respuesta); }
protected void BtnEnviar_Click(object sender, EventArgs e) { try { if (Page.IsValid) { YouCom.DTO.Foro.ForoComunidadDTO theForoComunidadDTO = new YouCom.DTO.Foro.ForoComunidadDTO(); YouCom.DTO.Foro.ForoComunidadDTO myForoComunidadDTO = new YouCom.DTO.Foro.ForoComunidadDTO(); myForoComunidadDTO = YouCom.bll.ForoComunidadBLL.detalleForoComunidad(decimal.Parse(this.HdnIdForoComunidad.Value)); theForoComunidadDTO.TituloForoComunidad = myForoComunidadDTO.TituloForoComunidad; theForoComunidadDTO.DescripcionForoComunidad = this.TxtComentarios.Text.ToUpper(); theForoComunidadDTO.FechaForoComunidad = DateTime.Now; theForoComunidadDTO.IdPadre = myForoComunidadDTO.IdForoComunidad; theForoComunidadDTO.TheComunidadDTO = myUsuario.TheComunidadSeleccionDTO; theForoComunidadDTO.TheCondominioDTO = myUsuario.TheCondominioSeleccionDTO; YouCom.DTO.Propietario.FamiliaDTO myFamiliaDTO = new YouCom.DTO.Propietario.FamiliaDTO(); myFamiliaDTO = YouCom.bll.FamiliaBLL.detalleFamiliabyRut(myUsuario.Rut); theForoComunidadDTO.TheFamiliaDTO = myFamiliaDTO; YouCom.DTO.CategoriaDTO myCategoriaDTO = new YouCom.DTO.CategoriaDTO(); myCategoriaDTO.IdCategoria = myForoComunidadDTO.TheCategoriaDTO.IdCategoria; theForoComunidadDTO.TheCategoriaDTO = myCategoriaDTO; YouCom.DTO.Foro.ForoComunidadEstadoDTO myForoComunidadEstadoDTO = new YouCom.DTO.Foro.ForoComunidadEstadoDTO(); myForoComunidadEstadoDTO.IdForoComunidadEstado = 2; theForoComunidadDTO.TheForoComunidadEstadoDTO = myForoComunidadEstadoDTO; theForoComunidadDTO.UsuarioIngreso = myUsuario.Rut; bool respuesta = YouCom.bll.ForoComunidadBLL.Insert(theForoComunidadDTO); if (respuesta) { if (enviarMail()) { if (!Page.ClientScript.IsClientScriptBlockRegistered("SET")) { string script = "alert('Estimado Cliente, hemos recibido su mensaje, en breve nos contactaremos con usted.');"; script += "parent.location = '" + retorno1 + "';"; Page.ClientScript.RegisterStartupScript(this.GetType(), "SET", script, true); } } else { if (!Page.ClientScript.IsClientScriptBlockRegistered("SET")) { string script = "alert('A ocurrido un error. Favor envíe su solicitud al mail [email protected] intente más tarde.');"; script += "parent.location = '" + retorno1 + "';"; Page.ClientScript.RegisterStartupScript(this.GetType(), "SET", script, true); } } } else { if (!Page.ClientScript.IsClientScriptBlockRegistered("SET")) { string script = "alert('A ocurrido un error. Favor envíe su solicitud al mail [email protected] intente más tarde.');"; script += "parent.location = '" + retorno1 + "';"; Page.ClientScript.RegisterStartupScript(this.GetType(), "SET", script, true); } } } } catch (Exception ex) { Response.Write(ex.Message); } }
protected void rptForoComunidad_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 hdnIdForoComunidad = new HiddenField(); hdnIdForoComunidad = (HiddenField)e.Item.FindControl("hdnIdForoComunidad"); YouCom.DTO.Foro.ForoComunidadDTO myForoComunidadDTO = new YouCom.DTO.Foro.ForoComunidadDTO(); myForoComunidadDTO = YouCom.bll.ForoComunidadBLL.detalleForoComunidad(decimal.Parse(hdnIdForoComunidad.Value)); this.hdnIdForoComunidad.Value = myForoComunidadDTO.IdForoComunidad.ToString(); this.txtTituloForo.Text = myForoComunidadDTO.TituloForoComunidad; this.txtDescripcion.Text = myForoComunidadDTO.DescripcionForoComunidad; this.txtFecha.Text = myForoComunidadDTO.FechaForoComunidad.ToShortDateString(); ddlCondominio.SelectedIndex = ddlCondominio.Items.IndexOf(ddlCondominio.Items.FindByValue(myForoComunidadDTO.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(myForoComunidadDTO.TheComunidadDTO.IdComunidad.ToString())); YouCom.DTO.Propietario.FamiliaDTO myFamiliaDTO = new YouCom.DTO.Propietario.FamiliaDTO(); myFamiliaDTO = YouCom.bll.FamiliaBLL.detalleFamilia(myForoComunidadDTO.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(myForoComunidadDTO.TheFamiliaDTO.IdFamilia.ToString())); ddlCategoria.SelectedIndex = ddlCategoria.Items.IndexOf(ddlCategoria.Items.FindByValue(myForoComunidadDTO.TheCategoriaDTO.IdCategoria.ToString())); ddlEstado.SelectedIndex = ddlEstado.Items.IndexOf(ddlEstado.Items.FindByValue(myForoComunidadDTO.TheForoComunidadEstadoDTO.IdForoComunidadEstado.ToString())); btnGrabar.Visible = false; btnEditar.Visible = true; } if (e.CommandName == "Eliminar") { HiddenField hdnIdForoComunidad = new HiddenField(); hdnIdForoComunidad = (HiddenField)e.Item.FindControl("hdnIdForoComunidad"); ForoComunidadDTO theForoComunidadDTO = new ForoComunidadDTO(); theForoComunidadDTO.IdForoComunidad = decimal.Parse(hdnIdForoComunidad.Value); theForoComunidadDTO.UsuarioModificacion = myUsuario.Rut; bool validacionIntegridad = YouCom.bll.ForoComunidadBLL.ValidaEliminacionForoComunidad(theForoComunidadDTO); if (validacionIntegridad) { string script = "alert(' No es posible eliminar un foro con informacion asociada.');"; Page.ClientScript.RegisterStartupScript(this.GetType(), "SET", script, true); return; } else { bool respuesta = YouCom.bll.ForoComunidadBLL.Delete(theForoComunidadDTO); if (respuesta) { cargarForoComunidad(); if (!Page.ClientScript.IsClientScriptBlockRegistered("SET")) { string script = "alert('Foro eliminado correctamente.');"; Page.ClientScript.RegisterStartupScript(this.GetType(), "SET", script, true); } } else { } } } }