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 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"); ForoComunidadDTO theForoComunidadDTO = new ForoComunidadDTO(); theForoComunidadDTO.TituloForoComunidad = this.txtTituloForo.Text.ToUpper(); theForoComunidadDTO.DescripcionForoComunidad = this.txtDescripcion.Text.ToUpper(); theForoComunidadDTO.FechaPublicacion = DateTime.Now; theForoComunidadDTO.IdPadre = 0; YouCom.DTO.Seguridad.CondominioDTO myCondominioDTO = new YouCom.DTO.Seguridad.CondominioDTO(); myCondominioDTO.IdCondominio = decimal.Parse(ddlCondominio.SelectedValue); theForoComunidadDTO.TheCondominioDTO = myCondominioDTO; YouCom.DTO.Seguridad.ComunidadDTO myComunidadDTO = new YouCom.DTO.Seguridad.ComunidadDTO(); myComunidadDTO.IdComunidad = decimal.Parse(ddlComunidad.SelectedValue); theForoComunidadDTO.TheComunidadDTO = myComunidadDTO; YouCom.DTO.Propietario.FamiliaDTO myFamiliaDTO = new YouCom.DTO.Propietario.FamiliaDTO(); myFamiliaDTO.IdFamilia = decimal.Parse(ddlFamilia.SelectedValue); 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 = 2; theForoComunidadDTO.TheForoComunidadEstadoDTO = myForoComunidadEstadoDTO; theForoComunidadDTO.UsuarioIngreso = myUsuario.Rut; bool respuesta = YouCom.bll.ForoComunidadBLL.Insert(theForoComunidadDTO); if (respuesta) { this.txtDescripcion.Text = string.Empty; this.txtFecha.Text = string.Empty; this.txtTituloForo.Text = string.Empty; string script = "alert('Mensaje enviado correctamente.');"; Page.ClientScript.RegisterStartupScript(this.GetType(), "SET", script, true); cargarForoComunidad(); } else { } }
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 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; ForoComunidadDTO theForoComunidadDTO = new ForoComunidadDTO(); theForoComunidadDTO.IdForoComunidad = decimal.Parse(this.hdnIdForoComunidad.Value); theForoComunidadDTO.TituloForoComunidad = this.txtTituloForo.Text.ToUpper(); theForoComunidadDTO.DescripcionForoComunidad = this.txtDescripcion.Text.ToUpper(); theForoComunidadDTO.FechaPublicacion = DateTime.Now; theForoComunidadDTO.IdPadre = 0; YouCom.DTO.Seguridad.CondominioDTO myCondominioDTO = new YouCom.DTO.Seguridad.CondominioDTO(); myCondominioDTO.IdCondominio = decimal.Parse(ddlCondominio.SelectedValue); theForoComunidadDTO.TheCondominioDTO = myCondominioDTO; YouCom.DTO.Seguridad.ComunidadDTO myComunidadDTO = new YouCom.DTO.Seguridad.ComunidadDTO(); myComunidadDTO.IdComunidad = decimal.Parse(ddlComunidad.SelectedValue); theForoComunidadDTO.TheComunidadDTO = myComunidadDTO; YouCom.DTO.Propietario.FamiliaDTO myFamiliaDTO = new YouCom.DTO.Propietario.FamiliaDTO(); myFamiliaDTO.IdFamilia = decimal.Parse(ddlFamilia.SelectedValue); 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 = decimal.Parse(ddlEstado.SelectedValue); theForoComunidadDTO.TheForoComunidadEstadoDTO = myForoComunidadEstadoDTO; if (ddlEstado.SelectedValue == "3") { theForoComunidadDTO.FechaPublicacion = DateTime.Now; theForoComunidadDTO.FechaTermino = DateTime.Now.AddMonths(1); } theForoComunidadDTO.MotivoEstadoForoComunidad = this.txtMotivoEstado.Text; theForoComunidadDTO.UsuarioModificacion = myUsuario.Rut; bool respuesta = YouCom.bll.ForoComunidadBLL.Update(theForoComunidadDTO); if (respuesta) { cargarForoComunidad(); this.txtDescripcion.Text = string.Empty; this.txtFecha.Text = string.Empty; this.txtTituloForo.Text = string.Empty; if (!Page.ClientScript.IsClientScriptBlockRegistered("SET")) { string script = "alert('Mensaje respondido correctamente.');"; Page.ClientScript.RegisterStartupScript(this.GetType(), "SET", script, true); } } else { } }