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 <NoticiaDTO> noticias = new List <NoticiaDTO>(); noticias = (Session["noticia"] as List <NoticiaDTO>); NoticiaDTO theNoticiaDTO = new NoticiaDTO(); theNoticiaDTO.NotiTitulo = this.txtNoticiaTitulo.Text.ToUpper(); theNoticiaDTO.NotiResumen = this.txtNoticiaResumen.Text.ToUpper(); theNoticiaDTO.NotiDetalle = this.FCKeditorDetalle.Value; theNoticiaDTO.NotiAutor = this.TxtNotiAutor.Text.ToUpper(); YouCom.DTO.Seguridad.CondominioDTO myCondominioDTO = new YouCom.DTO.Seguridad.CondominioDTO(); myCondominioDTO.IdCondominio = decimal.Parse(ddlCondominio.SelectedValue); theNoticiaDTO.TheCondominioDTO = myCondominioDTO; YouCom.DTO.Seguridad.ComunidadDTO myComunidadDTO = new YouCom.DTO.Seguridad.ComunidadDTO(); myComunidadDTO.IdComunidad = decimal.Parse(ddlComunidad.SelectedValue); theNoticiaDTO.TheComunidadDTO = myComunidadDTO; YouCom.DTO.CategoriaDTO myCategoriaDTO = new YouCom.DTO.CategoriaDTO(); myCategoriaDTO.IdCategoria = decimal.Parse(ddlCategoria.SelectedValue); theNoticiaDTO.TheCategoriaDTO = myCategoriaDTO; theNoticiaDTO.UsuarioIngreso = myUsuario.Rut; if (this.FileImagenNoticia.HasFile) { if (System.IO.Path.GetExtension(FileImagenNoticia.PostedFile.FileName) == ".swf") { theNoticiaDTO.NotiImagen = this.ProcessOtherFile(FileImagenNoticia, null, YouCom.Service.Generales.General.GetPropiedad("UploadsPathNoticiaPub")); } else { theNoticiaDTO.NotiImagen = YouCom.Service.Imagenes.Imagen.ProcessFileResize(FileImagenNoticia, YouCom.Service.Generales.General.GetPropiedad("UploadsPathNoticiaPub"), 198, 118, Page); } } theNoticiaDTO.NotiPublicacion = DateTime.ParseExact(this.FechaPublicacion.Text + " " + DateTime.Now.ToString("HH:mm"), "dd/MM/yyyy HH:mm", System.Globalization.CultureInfo.InvariantCulture); theNoticiaDTO.NotiInicio = DateTime.ParseExact(this.FechaPublicacion.Text + " " + DateTime.Now.ToString("HH:mm"), "dd/MM/yyyy HH:mm", System.Globalization.CultureInfo.InvariantCulture); theNoticiaDTO.NotiExpira = string.Copy(RdbNotiExpira.SelectedItem.Value); if (RdbNotiExpira.SelectedValue.Equals("S")) { theNoticiaDTO.NotiExpiracion = DateTime.ParseExact(this.FechaExpiracion.Text + " 00:00", "dd/MM/yyyy HH:mm", System.Globalization.CultureInfo.InvariantCulture); } else { theNoticiaDTO.NotiExpiracion = DateTime.MaxValue; } noticias = noticias.Where(x => x.NotiTitulo == theNoticiaDTO.NotiTitulo).ToList(); if (noticias.Any()) { foreach (var item in noticias) { if (item.Estado == "2") { string script = "alert('Noticia existe pero fue eliminado para activarlo dirigase a Papelera.');"; Page.ClientScript.RegisterStartupScript(this.GetType(), "SET", script, true); return; } else { string script = "alert('Noticia ya Existe .');"; Page.ClientScript.RegisterStartupScript(this.GetType(), "SET", script, true); return; } } } bool respuesta = YouCom.bll.NoticiaBLL.Insert(theNoticiaDTO); if (respuesta) { this.TxtNotiAutor.Text = string.Empty; this.txtNoticiaTitulo.Text = string.Empty; this.txtNoticiaResumen.Text = string.Empty; string script = "alert('Noticia ingresada correctamente.');"; Page.ClientScript.RegisterStartupScript(this.GetType(), "SET", script, true); cargarNoticia(); } 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; NoticiaDTO theNoticiaDTO = new NoticiaDTO(); theNoticiaDTO.NoticiaId = decimal.Parse(this.hdnNoticiaId.Value); theNoticiaDTO.NotiTitulo = this.txtNoticiaTitulo.Text.ToUpper(); theNoticiaDTO.NotiResumen = this.txtNoticiaResumen.Text.ToUpper(); theNoticiaDTO.NotiDetalle = this.FCKeditorDetalle.Value; theNoticiaDTO.NotiAutor = this.TxtNotiAutor.Text.ToUpper(); YouCom.DTO.Seguridad.CondominioDTO myCondominioDTO = new YouCom.DTO.Seguridad.CondominioDTO(); myCondominioDTO.IdCondominio = decimal.Parse(ddlCondominio.SelectedValue); theNoticiaDTO.TheCondominioDTO = myCondominioDTO; YouCom.DTO.Seguridad.ComunidadDTO myComunidadDTO = new YouCom.DTO.Seguridad.ComunidadDTO(); myComunidadDTO.IdComunidad = decimal.Parse(ddlComunidad.SelectedValue); theNoticiaDTO.TheComunidadDTO = myComunidadDTO; YouCom.DTO.CategoriaDTO myCategoriaDTO = new YouCom.DTO.CategoriaDTO(); myCategoriaDTO.IdCategoria = decimal.Parse(ddlCategoria.SelectedValue); theNoticiaDTO.TheCategoriaDTO = myCategoriaDTO; theNoticiaDTO.UsuarioModificacion = myUsuario.Rut; if (this.FileImagenNoticia.HasFile) { theNoticiaDTO.NotiImagen = YouCom.Service.Imagenes.Imagen.ProcessFileResize(FileImagenNoticia, YouCom.Service.Generales.General.GetPropiedad("UploadsPathBann"), 198, 118, Page); } else { YouCom.DTO.NoticiaDTO myNoticiaDTO = new YouCom.DTO.NoticiaDTO(); myNoticiaDTO = YouCom.bll.NoticiaBLL.detalleNoticia(decimal.Parse(hdnNoticiaId.Value)); theNoticiaDTO.NotiImagen = myNoticiaDTO.NotiImagen; } theNoticiaDTO.NotiPublicacion = DateTime.ParseExact(this.FechaPublicacion.Text + " " + DateTime.Now.ToString("HH:mm"), "dd/MM/yyyy HH:mm", System.Globalization.CultureInfo.InvariantCulture); theNoticiaDTO.NotiInicio = DateTime.ParseExact(this.FechaPublicacion.Text + " " + DateTime.Now.ToString("HH:mm"), "dd/MM/yyyy HH:mm", System.Globalization.CultureInfo.InvariantCulture); theNoticiaDTO.NotiExpira = string.Copy(RdbNotiExpira.SelectedItem.Value); if (RdbNotiExpira.SelectedValue.Equals("S")) { theNoticiaDTO.NotiExpiracion = DateTime.ParseExact(this.FechaExpiracion.Text + " 00:00", "dd/MM/yyyy HH:mm", System.Globalization.CultureInfo.InvariantCulture); } else { theNoticiaDTO.NotiExpiracion = DateTime.MaxValue; } bool respuesta = YouCom.bll.NoticiaBLL.Update(theNoticiaDTO); if (respuesta) { cargarNoticia(); this.TxtNotiAutor.Text = string.Empty; this.txtNoticiaTitulo.Text = string.Empty; this.txtNoticiaResumen.Text = string.Empty; if (!Page.ClientScript.IsClientScriptBlockRegistered("SET")) { string script = "alert('Noticia editada 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 <ComercioDTO> comercios = new List <ComercioDTO>(); comercios = (Session["comercio"] as List <ComercioDTO>); ComercioDTO theComercioDTO = new ComercioDTO(); theComercioDTO.NombreComercio = this.txtComercioNombre.Text.ToUpper(); theComercioDTO.DireccionComercio = this.txtComercioDireccion.Text.ToUpper(); theComercioDTO.TelefonoComercio = this.txtComercioTelefono.Text; theComercioDTO.UrlComercio = this.txtComercioURL.Text.ToUpper(); theComercioDTO.EmailComercio = this.txtEmail.Text; YouCom.DTO.Seguridad.CondominioDTO myCondominioDTO = new YouCom.DTO.Seguridad.CondominioDTO(); myCondominioDTO.IdCondominio = decimal.Parse(ddlCondominio.SelectedValue); theComercioDTO.TheCondominioDTO = myCondominioDTO; YouCom.DTO.Seguridad.ComunidadDTO myComunidadDTO = new YouCom.DTO.Seguridad.ComunidadDTO(); myComunidadDTO.IdComunidad = decimal.Parse(ddlComunidad.SelectedValue); theComercioDTO.TheComunidadDTO = myComunidadDTO; YouCom.DTO.CategoriaDTO myCategoriaDTO = new YouCom.DTO.CategoriaDTO(); myCategoriaDTO.IdCategoria = decimal.Parse(ddlCategoria.SelectedValue); theComercioDTO.TheCategoriaDTO = myCategoriaDTO; theComercioDTO.UsuarioIngreso = myUsuario.Rut; if (this.FileImagenComercio.HasFile) { if (System.IO.Path.GetExtension(FileImagenComercio.PostedFile.FileName) == ".swf") { theComercioDTO.LogoComercio = this.ProcessOtherFile(FileImagenComercio, null, YouCom.Service.Generales.General.GetPropiedad("UploadsPathComercioPub")); } else { theComercioDTO.LogoComercio = YouCom.Service.Imagenes.Imagen.ProcessFileResize(FileImagenComercio, YouCom.Service.Generales.General.GetPropiedad("UploadsPathComercioPub"), 198, 118, Page); } } comercios = comercios.Where(x => x.NombreComercio == theComercioDTO.NombreComercio).ToList(); if (comercios.Any()) { foreach (var item in comercios) { if (item.Estado == "2") { string script = "alert('Comercio existe pero fue eliminado para activarlo dirigase a Papelera.');"; Page.ClientScript.RegisterStartupScript(this.GetType(), "SET", script, true); return; } else { string script = "alert('Comercio ya Existe .');"; Page.ClientScript.RegisterStartupScript(this.GetType(), "SET", script, true); return; } } } bool respuesta = YouCom.bll.ComercioBLL.Insert(theComercioDTO); if (respuesta) { this.txtComercioNombre.Text = string.Empty; this.txtComercioDireccion.Text = string.Empty; this.txtComercioTelefono.Text = string.Empty; this.txtComercioURL.Text = string.Empty; string script = "alert('Comercio ingresado correctamente.');"; Page.ClientScript.RegisterStartupScript(this.GetType(), "SET", script, true); cargarComercio(); } 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; ComercioDTO theComercioDTO = new ComercioDTO(); theComercioDTO.IdComercio = decimal.Parse(this.hdnIdComercio.Value); theComercioDTO.NombreComercio = this.txtComercioNombre.Text.ToUpper(); theComercioDTO.DireccionComercio = this.txtComercioDireccion.Text.ToUpper(); theComercioDTO.TelefonoComercio = this.txtComercioTelefono.Text; theComercioDTO.UrlComercio = this.txtComercioURL.Text.ToUpper(); theComercioDTO.EmailComercio = this.txtEmail.Text; YouCom.DTO.Seguridad.CondominioDTO myCondominioDTO = new YouCom.DTO.Seguridad.CondominioDTO(); myCondominioDTO.IdCondominio = decimal.Parse(ddlCondominio.SelectedValue); theComercioDTO.TheCondominioDTO = myCondominioDTO; YouCom.DTO.Seguridad.ComunidadDTO myComunidadDTO = new YouCom.DTO.Seguridad.ComunidadDTO(); myComunidadDTO.IdComunidad = decimal.Parse(ddlComunidad.SelectedValue); theComercioDTO.TheComunidadDTO = myComunidadDTO; YouCom.DTO.CategoriaDTO myCategoriaDTO = new YouCom.DTO.CategoriaDTO(); myCategoriaDTO.IdCategoria = decimal.Parse(ddlCategoria.SelectedValue); theComercioDTO.TheCategoriaDTO = myCategoriaDTO; theComercioDTO.UsuarioModificacion = myUsuario.Rut; if (this.FileImagenComercio.HasFile) { theComercioDTO.LogoComercio = YouCom.Service.Imagenes.Imagen.ProcessFileResize(FileImagenComercio, YouCom.Service.Generales.General.GetPropiedad("UploadsPathComercioPub"), 198, 118, Page); } else { YouCom.DTO.ComercioDTO myComercioDTO = new YouCom.DTO.ComercioDTO(); myComercioDTO = YouCom.bll.ComercioBLL.detalleComercio(decimal.Parse(hdnIdComercio.Value)); theComercioDTO.LogoComercio = myComercioDTO.LogoComercio; } bool respuesta = YouCom.bll.ComercioBLL.Update(theComercioDTO); if (respuesta) { cargarComercio(); this.txtComercioNombre.Text = string.Empty; this.txtComercioDireccion.Text = string.Empty; this.txtComercioTelefono.Text = string.Empty; this.txtComercioURL.Text = string.Empty; if (!Page.ClientScript.IsClientScriptBlockRegistered("SET")) { string script = "alert('Comercio editado correctamente.');"; Page.ClientScript.RegisterStartupScript(this.GetType(), "SET", script, true); } } else { } }
protected void rptCategoria_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 hdnIdCategoria = new HiddenField(); hdnIdCategoria = (HiddenField)e.Item.FindControl("hdnIdCategoria"); YouCom.DTO.CategoriaDTO myCategoriaDTO = new YouCom.DTO.CategoriaDTO(); myCategoriaDTO = YouCom.bll.CategoriaBLL.detalleCategoria(decimal.Parse(hdnIdCategoria.Value)); this.hdnIdCategoria.Value = myCategoriaDTO.IdCategoria.ToString(); txtNombre.Text = myCategoriaDTO.NombreCategoria; txtDescripcion.Text = myCategoriaDTO.DescripcionCategoria; ddlTipo.SelectedIndex = ddlTipo.Items.IndexOf(ddlTipo.Items.FindByValue(myCategoriaDTO.TheTipoCategoriaDTO.IdTipoCategoria.ToString())); ddlCondominio.SelectedIndex = ddlCondominio.Items.IndexOf(ddlCondominio.Items.FindByValue(myCategoriaDTO.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(myCategoriaDTO.TheComunidadDTO.IdComunidad.ToString())); btnGrabar.Visible = false; btnEditar.Visible = true; } if (e.CommandName == "Eliminar") { HiddenField hdnIdCategoria = new HiddenField(); hdnIdCategoria = (HiddenField)e.Item.FindControl("hdnIdCategoria"); CategoriaDTO theCategoriaDTO = new CategoriaDTO(); theCategoriaDTO.IdCategoria = decimal.Parse(hdnIdCategoria.Value); theCategoriaDTO.UsuarioModificacion = myUsuario.Rut; bool validacionIntegridad = YouCom.bll.CategoriaBLL.ValidaEliminacionCategoria(theCategoriaDTO); if (validacionIntegridad) { string script = "alert(' No es posible eliminar un categoria con registro asociado.');"; Page.ClientScript.RegisterStartupScript(this.GetType(), "SET", script, true); return; } else { bool respuesta = YouCom.bll.CategoriaBLL.Delete(theCategoriaDTO); if (respuesta) { cargarCategoria(); if (!Page.ClientScript.IsClientScriptBlockRegistered("SET")) { string script = "alert('Categoria Eliminada correctamente.');"; Page.ClientScript.RegisterStartupScript(this.GetType(), "SET", script, true); } } else { } } } }
protected bool setEnviaServicio() { bool retorno = false; bool salida = false; ServiciosDTO theServiciosDTO = new ServiciosDTO(); theServiciosDTO.NombreServicio = this.txtServicioNombre.Text.ToUpper(); theServiciosDTO.DescripcionServicio = this.txtServicioDescripcion.Text.ToUpper(); theServiciosDTO.TheCondominioDTO = myUsuario.TheCondominioSeleccionDTO; theServiciosDTO.TheComunidadDTO = myUsuario.TheComunidadSeleccionDTO; YouCom.DTO.CategoriaDTO myCategoriaDTO = new YouCom.DTO.CategoriaDTO(); myCategoriaDTO.IdCategoria = decimal.Parse(ddlCategoria.SelectedValue); theServiciosDTO.TheCategoriaDTO = myCategoriaDTO; theServiciosDTO.FechaInicio = DateTime.ParseExact(this.FechaInicio.Text + " " + DateTime.Now.ToString("HH:mm"), "dd/MM/yyyy HH:mm", System.Globalization.CultureInfo.InvariantCulture); theServiciosDTO.FechaTermino = DateTime.ParseExact(this.FechaTermino.Text + " " + DateTime.Now.ToString("HH:mm"), "dd/MM/yyyy HH:mm", System.Globalization.CultureInfo.InvariantCulture); theServiciosDTO.UsuarioIngreso = myUsuario.Rut; retorno = YouCom.bll.ServiciosBLL.Insert(theServiciosDTO); if (retorno) { YouCom.DTO.Servicio.EmpresaServicioDTO theEmpresaServicioDTO = new YouCom.DTO.Servicio.EmpresaServicioDTO(); theEmpresaServicioDTO.RutEmpresaServicio = this.txtRutEmpresa.Text.ToUpper(); theEmpresaServicioDTO.RazonSocialEmpresaServicio = this.txtNombreEmpresa.Text.ToUpper(); theEmpresaServicioDTO.TelefonoEmpresaServicio = this.txtTelefono.Text; theEmpresaServicioDTO.UrlEmpresaServicio = this.txtURL.Text; theEmpresaServicioDTO.CelularEmpresaServicio = this.txtCelular.Text; theEmpresaServicioDTO.DireccionEmpresaServicio = this.txtDireccion.Text; theEmpresaServicioDTO.EmailEmpresaServicio = this.txtEmail.Text; YouCom.DTO.ComunaDTO myComunaDTO = new YouCom.DTO.ComunaDTO(); myComunaDTO.IdComuna = decimal.Parse(ddlComuna.SelectedValue); theEmpresaServicioDTO.TheComunaDTO = myComunaDTO; YouCom.DTO.CiudadDTO myCiudadDTO = new YouCom.DTO.CiudadDTO(); myCiudadDTO.IdCiudad = decimal.Parse(ddlCiudad.SelectedValue); theEmpresaServicioDTO.TheComunaDTO.TheCiudadDTO = myCiudadDTO; YouCom.DTO.RegionDTO myRegionDTO = new YouCom.DTO.RegionDTO(); myRegionDTO.IdRegion = decimal.Parse(ddlRegion.SelectedValue); theEmpresaServicioDTO.TheComunaDTO.TheCiudadDTO.TheRegionDTO = myRegionDTO; YouCom.DTO.PaisDTO myPaisDTO = new YouCom.DTO.PaisDTO(); myPaisDTO.IdPais = decimal.Parse(ddlPais.SelectedValue); theEmpresaServicioDTO.TheComunaDTO.TheCiudadDTO.TheRegionDTO.ThePaisDTO = myPaisDTO; theEmpresaServicioDTO.TheCondominioDTO = myUsuario.TheCondominioSeleccionDTO; theEmpresaServicioDTO.TheComunidadDTO = myUsuario.TheComunidadSeleccionDTO; theEmpresaServicioDTO.TheServiciosDTO = theServiciosDTO; if (this.FileImagenServicio.HasFile) { theEmpresaServicioDTO.LogoEmpresaServicio = this.ProcessOtherFile(FileImagenServicio, null, YouCom.Service.Generales.General.GetPropiedad("UploadsPathServiciosPub")); } salida = YouCom.bll.EmpresaServicioBLL.Insert(theEmpresaServicioDTO); salida = true; } return(salida); }