コード例 #1
0
    protected void rptServiciosInactivo_OnItemCommand(object sender, RepeaterCommandEventArgs e)
    {
        if (e.CommandName == "Activar")
        {
            HiddenField hdnIdServicios = new HiddenField();
            hdnIdServicios = (HiddenField)e.Item.FindControl("hdnIdServicios");

            ServiciosDTO theServiciosDTO = new ServiciosDTO();
            theServiciosDTO.IdServicio          = decimal.Parse(hdnIdServicios.Value);
            theServiciosDTO.UsuarioModificacion = myUsuario.Rut;
            bool respuesta = YouCom.bll.ServiciosBLL.ActivaServicios(theServiciosDTO);
            if (respuesta)
            {
                cargarServiciosInactivo();
                if (!Page.ClientScript.IsClientScriptBlockRegistered("SET"))
                {
                    string script = "alert('Servicio Activado correctamente.');";
                    Page.ClientScript.RegisterStartupScript(this.GetType(), "SET", script, true);
                }
            }
            else
            {
            }
        }
    }
コード例 #2
0
    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;

        ServiciosDTO theServiciosDTO = new ServiciosDTO();

        theServiciosDTO.NombreServicio      = this.txtServicioNombre.Text.ToUpper();
        theServiciosDTO.DescripcionServicio = this.txtServicioDescripcion.Text.ToUpper();

        YouCom.DTO.Seguridad.CondominioDTO myCondominioDTO = new YouCom.DTO.Seguridad.CondominioDTO();
        myCondominioDTO.IdCondominio     = decimal.Parse(ddlCondominio.SelectedValue);
        theServiciosDTO.TheCondominioDTO = myCondominioDTO;

        YouCom.DTO.Seguridad.ComunidadDTO myComunidadDTO = new YouCom.DTO.Seguridad.ComunidadDTO();
        myComunidadDTO.IdComunidad      = decimal.Parse(ddlComunidad.SelectedValue);
        theServiciosDTO.TheComunidadDTO = myComunidadDTO;

        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.UsuarioModificacion = myUsuario.Rut;

        bool respuesta = YouCom.bll.ServiciosBLL.Update(theServiciosDTO);

        if (respuesta)
        {
            cargarServicios();
            this.txtServicioNombre.Text      = string.Empty;
            this.txtServicioDescripcion.Text = string.Empty;
            this.FechaInicio.Text            = string.Empty;
            this.FechaTermino.Text           = string.Empty;

            if (!Page.ClientScript.IsClientScriptBlockRegistered("SET"))
            {
                string script = "alert('Servicio editado correctamente.');";
                Page.ClientScript.RegisterStartupScript(this.GetType(), "SET", script, true);
            }
        }
        else
        {
        }
    }
コード例 #3
0
    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 <ServiciosDTO> servicio = new List <ServiciosDTO>();

        servicio = (Session["servicio"] as List <ServiciosDTO>);

        ServiciosDTO theServiciosDTO = new ServiciosDTO();

        theServiciosDTO.NombreServicio      = this.txtServicioNombre.Text.ToUpper();
        theServiciosDTO.DescripcionServicio = this.txtServicioDescripcion.Text.ToUpper();

        YouCom.DTO.Seguridad.CondominioDTO myCondominioDTO = new YouCom.DTO.Seguridad.CondominioDTO();
        myCondominioDTO.IdCondominio     = decimal.Parse(ddlCondominio.SelectedValue);
        theServiciosDTO.TheCondominioDTO = myCondominioDTO;

        YouCom.DTO.Seguridad.ComunidadDTO myComunidadDTO = new YouCom.DTO.Seguridad.ComunidadDTO();
        myComunidadDTO.IdComunidad      = decimal.Parse(ddlComunidad.SelectedValue);
        theServiciosDTO.TheComunidadDTO = myComunidadDTO;

        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;

        servicio = servicio.Where(x => x.NombreServicio == theServiciosDTO.NombreServicio).ToList();
        if (servicio.Any())
        {
            foreach (var item in servicio)
            {
                if (item.Estado == "2")
                {
                    string script = "alert('Servicio existe pero fue eliminado para activarlo dirigase a Papelera.');";
                    Page.ClientScript.RegisterStartupScript(this.GetType(), "SET", script, true);
                    return;
                }
                else
                {
                    string script = "alert('Servicio ya Existe .');";
                    Page.ClientScript.RegisterStartupScript(this.GetType(), "SET", script, true);
                    return;
                }
            }
        }

        bool respuesta = YouCom.bll.ServiciosBLL.Insert(theServiciosDTO);

        if (respuesta)
        {
            this.txtServicioNombre.Text      = string.Empty;
            this.txtServicioDescripcion.Text = string.Empty;
            this.FechaInicio.Text            = string.Empty;
            this.FechaTermino.Text           = string.Empty;

            string script = "alert('Servicio ingresado correctamente.');";
            Page.ClientScript.RegisterStartupScript(this.GetType(), "SET", script, true);
            cargarServicios();
        }
        else
        {
        }
    }
コード例 #4
0
    protected void rptServicios_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 hdnIdServicios = new HiddenField();
            hdnIdServicios = (HiddenField)e.Item.FindControl("hdnIdServicios");

            ServiciosDTO myServiciosDTO = new ServiciosDTO();
            myServiciosDTO = YouCom.bll.ServiciosBLL.detalleServicios(decimal.Parse(hdnIdServicios.Value));

            this.hdnIdServicios.Value        = myServiciosDTO.IdServicio.ToString();
            this.txtServicioNombre.Text      = myServiciosDTO.NombreServicio;
            this.txtServicioDescripcion.Text = myServiciosDTO.DescripcionServicio;

            this.FechaInicio.Text  = myServiciosDTO.FechaInicio.ToShortDateString();
            this.FechaTermino.Text = myServiciosDTO.FechaTermino.ToShortDateString();

            ddlCondominio.SelectedIndex = ddlCondominio.Items.IndexOf(ddlCondominio.Items.FindByValue(myServiciosDTO.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(myServiciosDTO.TheComunidadDTO.IdComunidad.ToString()));

            ddlCategoria.SelectedIndex = ddlCategoria.Items.IndexOf(ddlCategoria.Items.FindByValue(myServiciosDTO.TheCategoriaDTO.IdCategoria.ToString()));

            btnGrabar.Visible = false;
            btnEditar.Visible = true;
        }
        if (e.CommandName == "Eliminar")
        {
            HiddenField hdnIdServicios = new HiddenField();
            hdnIdServicios = (HiddenField)e.Item.FindControl("hdnIdServicios");

            ServiciosDTO theServiciosDTO = new ServiciosDTO();
            theServiciosDTO.IdServicio          = decimal.Parse(hdnIdServicios.Value);
            theServiciosDTO.UsuarioModificacion = myUsuario.Rut;

            bool validacionIntegridad = YouCom.bll.ServiciosBLL.ValidaEliminacionServicios(theServiciosDTO);
            if (validacionIntegridad)
            {
                string script = "alert(' No es posible eliminar un Servicio con informacion asociada.');";
                Page.ClientScript.RegisterStartupScript(this.GetType(), "SET", script, true);
                return;
            }
            else
            {
                bool respuesta = YouCom.bll.ServiciosBLL.Delete(theServiciosDTO);
                if (respuesta)
                {
                    cargarServicios();
                    if (!Page.ClientScript.IsClientScriptBlockRegistered("SET"))
                    {
                        string script = "alert('Servicio Eliminada correctamente.');";
                        Page.ClientScript.RegisterStartupScript(this.GetType(), "SET", script, true);
                    }
                }
                else
                {
                }
            }
        }
    }
コード例 #5
0
        public static bool ValidaEliminacionServicios(ServiciosDTO theServiciosDTO)
        {
            bool respuesta = facade.Servicios.ValidaEliminacionServicio(theServiciosDTO);

            return(respuesta);
        }
コード例 #6
0
        public static bool ActivaServicios(ServiciosDTO theServiciosDTO)
        {
            bool respuesta = ServiciosDAL.ActivaServicio(theServiciosDTO);

            return(respuesta);
        }
コード例 #7
0
        public static bool Update(ServiciosDTO myServiciosDTO)
        {
            bool resultado = ServiciosDAL.Update(myServiciosDTO);

            return(resultado);
        }
コード例 #8
0
        public static bool Insert(ServiciosDTO myServiciosDTO)
        {
            bool resultado = ServiciosDAL.Insert(myServiciosDTO);

            return(resultado);
        }
コード例 #9
0
    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);
    }