protected void rptDirectivaInactivo_OnItemCommand(object sender, RepeaterCommandEventArgs e) { if (e.CommandName == "Activar") { HiddenField hdnDirectivaId = new HiddenField(); hdnDirectivaId = (HiddenField)e.Item.FindControl("hdnDirectivaId"); DirectivaDTO theDirectivaDTO = new DirectivaDTO(); theDirectivaDTO.IdDirectiva = decimal.Parse(hdnDirectivaId.Value); theDirectivaDTO.UsuarioModificacion = myUsuario.Rut; bool respuesta = YouCom.bll.DirectivaBLL.ActivaDirectiva(theDirectivaDTO); if (respuesta) { cargarDirectivaInactivo(); if (!Page.ClientScript.IsClientScriptBlockRegistered("SET")) { string script = "alert('Cargo 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("wucCondominio1"); DropDownList ddlCondominio = (DropDownList)wucCondominio.FindControl("ddlCondominio"); DropDownList ddlComunidad = (DropDownList)wucCondominio.FindControl("ddlComunidad"); List <DirectivaDTO> directivas = new List <DirectivaDTO>(); directivas = (Session["directiva"] as List <DirectivaDTO>); DirectivaDTO theDirectivaDTO = new DirectivaDTO(); theDirectivaDTO.RutDirectiva = this.txtRut.Text.ToUpper(); theDirectivaDTO.NombreDirectiva = this.txtNombre.Text.ToUpper(); theDirectivaDTO.ApellidoPaternoDirectiva = this.txtApellidoPaterno.Text.ToUpper(); theDirectivaDTO.ApellidoMaternoDirectiva = this.txtApellidoMaterno.Text.ToUpper(); theDirectivaDTO.TelefonoDirectiva = this.txtTelefono.Text; theDirectivaDTO.EmailDirectiva = this.txtMail.Text; YouCom.DTO.Seguridad.CondominioDTO myCondominioDTO = new YouCom.DTO.Seguridad.CondominioDTO(); myCondominioDTO.IdCondominio = decimal.Parse(ddlCondominio.SelectedValue); theDirectivaDTO.TheCondominioDTO = myCondominioDTO; YouCom.DTO.Seguridad.ComunidadDTO myComunidadDTO = new YouCom.DTO.Seguridad.ComunidadDTO(); myComunidadDTO.IdComunidad = decimal.Parse(ddlComunidad.SelectedValue); theDirectivaDTO.TheComunidadDTO = myComunidadDTO; YouCom.DTO.CargoDTO myCargoDTO = new YouCom.DTO.CargoDTO(); myCargoDTO.IdCargo = decimal.Parse(ddlCargo.SelectedValue); theDirectivaDTO.TheCargoDTO = myCargoDTO; theDirectivaDTO.UsuarioIngreso = myUsuario.Rut; if (this.FileImagenDirectiva.HasFile) { if (System.IO.Path.GetExtension(FileImagenDirectiva.PostedFile.FileName) == ".swf") { theDirectivaDTO.ImagenDirectiva = this.ProcessOtherFile(FileImagenDirectiva, null, YouCom.Service.Generales.General.GetPropiedad("UploadsPathDirectivaPub")); } else { theDirectivaDTO.ImagenDirectiva = YouCom.Service.Imagenes.Imagen.ProcessFileResize(FileImagenDirectiva, YouCom.Service.Generales.General.GetPropiedad("UploadsPathDirectivaPub"), 198, 118, Page); } } directivas = directivas.Where(x => x.NombreDirectiva == theDirectivaDTO.NombreDirectiva).ToList(); if (directivas.Any()) { foreach (var item in directivas) { if (item.Estado == "2") { string script = "alert('Directiva existe pero fue eliminado para activarlo dirigase a Papelera.');"; Page.ClientScript.RegisterStartupScript(this.GetType(), "SET", script, true); return; } else { string script = "alert('Directiva ya Existe .');"; Page.ClientScript.RegisterStartupScript(this.GetType(), "SET", script, true); return; } } } bool respuesta = YouCom.bll.DirectivaBLL.Insert(theDirectivaDTO); if (respuesta) { this.txtRut.Text = string.Empty; this.txtNombre.Text = string.Empty; this.txtApellidoPaterno.Text = string.Empty; this.txtApellidoMaterno.Text = string.Empty; this.txtTelefono.Text = string.Empty; this.txtMail.Text = string.Empty; this.ddlCargo.ClearSelection(); ddlCondominio.ClearSelection(); string script = "alert('Directiva Ingresado correctamente.');"; Page.ClientScript.RegisterStartupScript(this.GetType(), "SET", script, true); cargarDirectiva(); } else { } }
protected void rptDirectiva_OnItemCommand(object sender, RepeaterCommandEventArgs e) { UserControl wucCondominio = (UserControl)Page.Master.FindControl("ContentPlaceHolder1").FindControl("wucCondominio1"); DropDownList ddlCondominio = (DropDownList)wucCondominio.FindControl("ddlCondominio"); DropDownList ddlComunidad = (DropDownList)wucCondominio.FindControl("ddlComunidad"); if (e.CommandName == "Editar") { HiddenField hdnDirectivaId = new HiddenField(); hdnDirectivaId = (HiddenField)e.Item.FindControl("hdnDirectivaId"); YouCom.DTO.DirectivaDTO myDirectivaDTO = new YouCom.DTO.DirectivaDTO(); myDirectivaDTO = YouCom.bll.DirectivaBLL.detalleDirectiva(decimal.Parse(hdnDirectivaId.Value)); this.hdnDirectivaId.Value = myDirectivaDTO.IdDirectiva.ToString(); this.txtRut.Text = YouCom.Service.Generales.Formato.FormatoRut(myDirectivaDTO.RutDirectiva); this.txtNombre.Text = myDirectivaDTO.NombreDirectiva; this.txtApellidoPaterno.Text = myDirectivaDTO.ApellidoPaternoDirectiva; this.txtApellidoMaterno.Text = myDirectivaDTO.ApellidoMaternoDirectiva; this.txtTelefono.Text = myDirectivaDTO.TelefonoDirectiva; this.txtMail.Text = myDirectivaDTO.EmailDirectiva; ddlCondominio.SelectedIndex = ddlCondominio.Items.IndexOf(ddlCondominio.Items.FindByValue(myDirectivaDTO.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(myDirectivaDTO.TheComunidadDTO.IdComunidad.ToString())); ddlCargo.SelectedIndex = ddlCargo.Items.IndexOf(ddlCargo.Items.FindByValue(myDirectivaDTO.TheCargoDTO.IdCargo.ToString())); if (!string.IsNullOrEmpty(myDirectivaDTO.ImagenDirectiva)) { this.lnkImagen.Visible = true; this.chkImagen.Visible = true; this.lnkImagen.NavigateUrl = YouCom.Service.Generales.General.GetPropiedad("UploadsPathDirectivaPub") + myDirectivaDTO.ImagenDirectiva; } btnGrabar.Visible = false; btnEditar.Visible = true; } if (e.CommandName == "Eliminar") { HiddenField hdnDirectivaId = new HiddenField(); hdnDirectivaId = (HiddenField)e.Item.FindControl("hdnDirectivaId"); DirectivaDTO theDirectivaDTO = new DirectivaDTO(); theDirectivaDTO.IdDirectiva = decimal.Parse(hdnDirectivaId.Value); theDirectivaDTO.UsuarioModificacion = myUsuario.Rut; bool validacionIntegridad = YouCom.bll.DirectivaBLL.ValidaEliminacionDirectiva(theDirectivaDTO); if (validacionIntegridad) { string script = "alert(' No es posible eliminar una directiva con informacion asociada.');"; Page.ClientScript.RegisterStartupScript(this.GetType(), "SET", script, true); return; } else { bool respuesta = YouCom.bll.DirectivaBLL.Delete(theDirectivaDTO); if (respuesta) { cargarDirectiva(); if (!Page.ClientScript.IsClientScriptBlockRegistered("SET")) { string script = "alert('Directiva eliminada 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("wucCondominio1"); DropDownList ddlCondominio = (DropDownList)wucCondominio.FindControl("ddlCondominio"); DropDownList ddlComunidad = (DropDownList)wucCondominio.FindControl("ddlComunidad"); btnEditar.Visible = false; btnGrabar.Visible = true; DirectivaDTO theDirectivaDTO = new DirectivaDTO(); theDirectivaDTO.IdDirectiva = decimal.Parse(this.hdnDirectivaId.Value); theDirectivaDTO.RutDirectiva = this.txtRut.Text.ToUpper(); theDirectivaDTO.NombreDirectiva = this.txtNombre.Text.ToUpper(); theDirectivaDTO.ApellidoPaternoDirectiva = this.txtApellidoPaterno.Text.ToUpper(); theDirectivaDTO.ApellidoMaternoDirectiva = this.txtApellidoMaterno.Text.ToUpper(); theDirectivaDTO.TelefonoDirectiva = this.txtTelefono.Text; theDirectivaDTO.EmailDirectiva = this.txtMail.Text; YouCom.DTO.Seguridad.CondominioDTO myCondominioDTO = new YouCom.DTO.Seguridad.CondominioDTO(); myCondominioDTO.IdCondominio = decimal.Parse(ddlCondominio.SelectedValue); theDirectivaDTO.TheCondominioDTO = myCondominioDTO; YouCom.DTO.Seguridad.ComunidadDTO myComunidadDTO = new YouCom.DTO.Seguridad.ComunidadDTO(); myComunidadDTO.IdComunidad = decimal.Parse(ddlComunidad.SelectedValue); theDirectivaDTO.TheComunidadDTO = myComunidadDTO; YouCom.DTO.CargoDTO myCargoDTO = new YouCom.DTO.CargoDTO(); myCargoDTO.IdCargo = decimal.Parse(ddlCargo.SelectedValue); theDirectivaDTO.TheCargoDTO = myCargoDTO; theDirectivaDTO.UsuarioModificacion = myUsuario.Rut; if (this.FileImagenDirectiva.HasFile) { theDirectivaDTO.ImagenDirectiva = YouCom.Service.Imagenes.Imagen.ProcessFileResize(FileImagenDirectiva, YouCom.Service.Generales.General.GetPropiedad("UploadsPathDirectivaPub"), 198, 118, Page); } else { YouCom.DTO.DirectivaDTO myDirectivaDTO = new YouCom.DTO.DirectivaDTO(); myDirectivaDTO = YouCom.bll.DirectivaBLL.detalleDirectiva(decimal.Parse(hdnDirectivaId.Value)); theDirectivaDTO.ImagenDirectiva = myDirectivaDTO.ImagenDirectiva; } bool respuesta = YouCom.bll.DirectivaBLL.Update(theDirectivaDTO); if (respuesta) { cargarDirectiva(); this.txtRut.Text = string.Empty; this.txtNombre.Text = string.Empty; this.txtApellidoPaterno.Text = string.Empty; this.txtApellidoMaterno.Text = string.Empty; this.txtTelefono.Text = string.Empty; this.txtMail.Text = string.Empty; this.ddlCargo.ClearSelection(); ddlCondominio.ClearSelection(); if (!Page.ClientScript.IsClientScriptBlockRegistered("SET")) { string script = "alert('Directiva editada correctamente.');"; Page.ClientScript.RegisterStartupScript(this.GetType(), "SET", script, true); } } else { } }
public static bool ValidaEliminacionDirectiva(DirectivaDTO theDirectivaDTO) { bool respuesta = facade.Directiva.ValidaEliminacionDirectiva(theDirectivaDTO); return(respuesta); }
public static bool ActivaDirectiva(DirectivaDTO theDirectivaDTO) { bool respuesta = YouCom.DAL.DirectivaDAL.ActivaDirectiva(theDirectivaDTO); return(respuesta); }