Ejemplo n.º 1
0
        protected void btnAddCategoria_Click(object sender, EventArgs e)
        {
            try
            {
                SociosCostos oSC = null;

                if (!string.IsNullOrEmpty(this.lblCategoriaId.Text))
                {
                    if (Validar())
                    {
                        oSC = new Socio().GetSocioCategoria(int.Parse(this.lblCategoriaId.Text));

                        oSC.SociosCategorias.Descripcion = this.txtDesc.Text;
                        oSC.SociosCategorias.Valor = Convert.ToInt32(this.txtValor.Text);
                        oSC.SociosCategorias.Abreviatura = this.txtAbrev.Text;

                        oSC.FechaDesde = Convert.ToDateTime(this.txtFechaDesde.Text);
                        oSC.Valor = Convert.ToInt32(this.txtValor.Text);
                        oSC.Observaciones = this.txtObservaciones.Text;

                        new Socio().UpdateSocioCategoria(oSC);

                        ClientScript.RegisterStartupScript(this.GetType(), "myScript",
                                                           "alert('Registro actualizado exitosamente.');", true);

                        this.ClearForm();
                    }
                }
                else
                {
                    SociosCategorias oSociosCategorias = new SociosCategorias();

                    oSociosCategorias.Descripcion = this.txtDesc.Text;
                    oSociosCategorias.Valor = Convert.ToInt32(this.txtValor.Text);
                    oSociosCategorias.Abreviatura = this.txtAbrev.Text;

                    oSC = new SociosCostos();

                    oSC.FechaDesde = Convert.ToDateTime(this.txtFechaDesde.Text);
                    oSC.Valor = Convert.ToInt32(this.txtValor.Text);

                    new Socio().AddSocioCategoria(oSociosCategorias,oSC);

                    this.ClearForm();
                }

                this.FillCategorias();
            }
            catch (Exception ex)
            {
                this.lblErrorCategoria.Text = ex.Message;
            }
        }
Ejemplo n.º 2
0
        public string GenerarCuotas(int mes, int anio)
        {
            AEPDataAccess.SociosCuotas oSC = null;
            DateTime _CuotaFecha = new DateTime(anio, mes, 1);

            if (ValidateNewSocioCuota(_CuotaFecha) == 0)
            {
                using (var context = new AEPEntities())
                {
                    List<Socios> listSocios = new Socio().GetListSocioActivo();

                    foreach (Socios socio in listSocios)
                    {
                        oSC = new AEPDataAccess.SociosCuotas();
                        oSC.CuotaFecha = _CuotaFecha;
                        oSC.SocioId = socio.SocioId;
                        if (socio.SociosCategorias.Valor == 0)// .SociosCostos
                        //.Where(p => p.FechaHasta == null &&
                        //p.SocioCategoriaId == oSC.Socios.SocioCategoriaId)
                        //.FirstOrDefault().Valor == 0)
                        {
                            oSC.EstadoId = 3; //PAGADA
                            oSC.FechaPago = oSC.CuotaFecha;
                            oSC.Observacion = "CATEGORÍA DE SOCIO CON COSTO 0";
                        }
                        else
                        {
                            oSC.EstadoId = 4; //PENDIENTE
                        }

                        context.SociosCuotas.AddObject(oSC);
                    }

                    context.SaveChanges();

                    return "CUOTAS GENERADA EXITOSAMENTE.";
                }
            }
            else
            {
                return "LA CUOTA PARA ESE PERIODO YA SE ENCUENTRA GENERADA.";
            }
        }
Ejemplo n.º 3
0
 protected void gvSocioCategoria_RowCommand(object sender, GridViewCommandEventArgs e)
 {
     if (e.CommandArgument != null)
     {
         switch (e.CommandName.ToLower())
         {
             case "delete":
                 new Socio().DeleteSocio(int.Parse(e.CommandArgument.ToString()));
                 this.FillGridSocio();
                 ClientScript.RegisterStartupScript(this.GetType(), "myScript", "alert('Registro borrado exitosamente.');", true);
                 break;
             case "edit":
                 this.txtFechaAltaSocio.Text = this.txtFechaBajaSocio.Text = "";
                 AEPDataAccess.Socios oSocio = new Socio().GetSocio(int.Parse(e.CommandArgument.ToString()));
                 this.lblbSocioId.Text = oSocio.SocioId.ToString();
                 this.ddlSocioCategoria.SelectedValue = oSocio.SocioCategoriaId.ToString();
                 this.txtFechaAltaSocio.Text = oSocio.FechaAlta.Date.ToShortDateString();
                 if (oSocio.FechaBaja.HasValue)
                     this.txtFechaBajaSocio.Text = oSocio.FechaBaja.Value.Date.ToShortDateString();
                 this.btnAddSocio.Text = "Actualizar";
                 this.btnCancelarSocio.Visible = true;
                 break;
             default:
                 break;
         }
     }
 }
Ejemplo n.º 4
0
        protected void FillCombos()
        {
            List<MotivosBaja> listaMotivos = new Socio().GetListMotivosBaja();

            ddlMotivoBaja.DataValueField = "MotivoBajaId";
            ddlMotivoBaja.DataTextField = "Descripcion";
            ddlMotivoBaja.DataSource = listaMotivos.ToList();
            ddlMotivoBaja.DataBind();
            ddlMotivoBaja.Items.Insert(0, new ListItem("- Seleccione -", "0"));

            List<Bancos> listaBancos = new Auxiliar().GetBancos();

            ddlBanco.DataValueField = "BancoId";
            ddlBanco.DataTextField = "Descripcion";
            ddlBanco.DataSource = listaBancos.ToList();
            ddlBanco.DataBind();
            ddlBanco.Items.Insert(0, new ListItem("- Seleccione -", "0"));

            List<Pais> listaPaises = new Auxiliar().GetListPais();

            ddlNacionalidad.DataValueField = "PaisId";
            ddlNacionalidad.DataTextField = "Descripcion";
            ddlNacionalidad.DataSource = listaPaises.ToList();
            ddlNacionalidad.DataBind();
            ddlNacionalidad.Items.Insert(0, new ListItem("- Seleccione -", "0"));

            ddlPais.DataValueField = "PaisId";
            ddlPais.DataTextField = "Descripcion";
            ddlPais.DataSource = listaPaises;
            ddlPais.DataBind();
            ddlPais.Items.Insert(0, new ListItem("- Seleccione -", "0"));

            List<SociosCategorias> listaSocioCategoria = new Socio().GetListSocioCategoria();

            ddlSocioCategoria.DataValueField = "SocioCategoriaId";
            ddlSocioCategoria.DataTextField = "Descripcion";
            ddlSocioCategoria.DataSource = listaSocioCategoria;
            ddlSocioCategoria.DataBind();
            ddlSocioCategoria.Items.Insert(0, new ListItem("- Seleccione -", "0"));

            List<EstadosTablas> listaEstados = new Auxiliar().GetEstados("Personas");

            var var = listaEstados.Select(g => new
            {
                Id = g.EstadoId,
                Desc = g.Estados.Descripcion
            }).ToList();

            ddlEstado.DataValueField = "Id";
            ddlEstado.DataTextField = "Desc";
            ddlEstado.DataSource = var;
            ddlEstado.DataBind();
            ddlEstado.Items.Insert(0, new ListItem("- Seleccione -", "0"));

            List<Organismos> listaOrganismos = new Organismo().GetOrganismos();

            ddlOrganismo.DataValueField = "OrganismoId";
            ddlOrganismo.DataTextField = "Descripcion";
            ddlOrganismo.DataSource = listaOrganismos.ToList();
            ddlOrganismo.DataBind();
            ddlOrganismo.Items.Insert(0, new ListItem("- Seleccione -", "0"));

            this.ddlSubOrga.Items.Insert(0, new ListItem("- Seleccione -", "0"));
            this.ddlSubOrga.Enabled = false;

            List<Parentescos> listaParentescos = new Persona().GetParentescos();

            this.ddlParentesco.DataValueField = "ParentescoId";
            this.ddlParentesco.DataTextField = "Descripcion_Parentesco";
            this.ddlParentesco.DataSource = listaParentescos.ToList();
            this.ddlParentesco.DataBind();
            this.ddlParentesco.Items.Insert(0, new ListItem("- Seleccione -", "0"));

            List<Roles> listaRol = new AEPDataAccess.Methods.Administracion().GetListRol();

            this.ddlRol.DataValueField = "RolId";
            this.ddlRol.DataTextField = "Descripcion";
            this.ddlRol.DataSource = listaRol.ToList();
            this.ddlRol.DataBind();
            this.ddlRol.Items.Insert(0, new ListItem("- Seleccione -", "0"));
        }
Ejemplo n.º 5
0
        protected void btnAddSocio_Click(object sender, EventArgs e)
        {
            try
            {
                if (ValidarSocio())
                {

                    AEPDataAccess.Socios oSocio = null;

                    if (!string.IsNullOrEmpty(this.lblbSocioId.Text))
                    {
                        oSocio = new Socio().GetSocio(int.Parse(this.lblbSocioId.Text));
                        oSocio.FechaAlta = Convert.ToDateTime(this.txtFechaAltaSocio.Text);
                        if (!string.IsNullOrEmpty(this.txtFechaBajaSocio.Text))
                        {
                            oSocio.FechaBaja = Convert.ToDateTime(this.txtFechaBajaSocio.Text);
                            oSocio.MotivoBajaId = int.Parse(this.ddlMotivoBaja.SelectedValue);
                        }
                        else
                        {
                            oSocio.FechaBaja = null;
                            oSocio.MotivoBajaId = null;
                        }
                        oSocio.EstadoId = 1;

                        new Socio().UpdateSocio(oSocio);
                    }
                    else
                    {
                        oSocio = new AEPDataAccess.Socios();

                        oSocio.FechaAlta = DateTime.Parse(this.txtFechaAltaSocio.Text);
                        if (!string.IsNullOrEmpty(this.txtFechaBajaSocio.Text))
                        {
                            oSocio.FechaBaja = DateTime.Parse(this.txtFechaBajaSocio.Text);
                            oSocio.MotivoBajaId = int.Parse(this.ddlMotivoBaja.SelectedValue);
                        }
                        oSocio.SocioCategoriaId = int.Parse(this.ddlSocioCategoria.SelectedValue);
                        oSocio.PersonaId = int.Parse(Request.QueryString["PersonaId"]);
                        oSocio.EstadoId = 1;

                        new Socio().AddSocio(oSocio);
                    }

                    this.FillGridSocio();
                }
            }
            catch (Exception ex)
            {
                this.lblErrorSocio.Text = ex.Message;
            }
        }
Ejemplo n.º 6
0
        private void FillGridSocio()
        {
            List<AEPDataAccess.Socios> listaSocio = new Socio().GetListSocio(int.Parse(Request.QueryString["PersonaId"]));

            //Paginamos la grilla.
            if (this.gvSocioCategoria.PageSize < listaSocio.Count)
            {
                this.gvSocioCategoria.AllowPaging = true;
                //--- Me fijo que pagina tengo que mostrar

                if (listaSocio.Count <= this.gvSocioCategoria.PageIndex * this.gvSocioCategoria.PageSize)

                    this.gvSocioCategoria.PageIndex = 0;
            }
            else
                this.gvSocioCategoria.AllowPaging = false;

            //Carga los datos en la grilla.
            this.gvSocioCategoria.DataSource = listaSocio;

            //Enlaza los datos.
            this.gvSocioCategoria.DataBind();

            this.lblMessageSocio.Visible = listaSocio.Count == 0;
        }
Ejemplo n.º 7
0
 protected void rptCategoria_ItemCommand(object source, RepeaterCommandEventArgs e)
 {
     if (e.CommandArgument != null)
     {
         switch (e.CommandName.ToLower())
         {
             case "edit":
                 SociosCostos oSC = new Socio().GetSocioCategoria(int.Parse(e.CommandArgument.ToString()));
                 this.lblCategoriaId.Text = oSC.SocioCostoId.ToString();
                 this.txtDesc.Text = oSC.SociosCategorias.Descripcion;
                 this.txtAbrev.Text = oSC.SociosCategorias.Abreviatura;
                 this.txtValor.Text = oSC.Valor.ToString();
                 this.txtFechaDesde.Text = oSC.FechaDesde.ToShortDateString();
                 this.lblFechaDesde.Value = oSC.FechaDesde.ToShortDateString();
                 this.btnAddCategoria.Text = "Actualizar";
                 this.btnCancelarCategoria.Visible = true;
                 this.txtObservaciones.Text = oSC.Observaciones;
                 break;
             default:
                 break;
         }
     }
 }
Ejemplo n.º 8
0
        protected void rptCategoria_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            try
            {
                SociosCostos oSC = e.Item.DataItem as SociosCostos;
                if (oSC != null)
                {
                    ImageButton img = (ImageButton)e.Item.FindControl("imgEdit");
                    if (img != null)
                    {
                        img.CommandArgument = oSC.SocioCostoId.ToString();
                        img.CommandName = "Edit";
                    }

                    Repeater rpt = (Repeater)e.Item.FindControl("rptHistorial");
                    if (rpt != null)
                    {
                        List<SociosCostos> list = new Socio().GetListSocioCostoByCategoria(oSC.SocioCategoriaId);
                        rpt.DataSource = list;
                        rpt.DataBind();
                    }
                }
            }
            catch (Exception ex)
            {
                this.lblErrorCategoria.Text = ex.Message;
            }
        }
Ejemplo n.º 9
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                List<EstadosTablas> listaEstadosCuota = new Auxiliar().GetEstados("SociosCuotas");

                var var = listaEstadosCuota.Select(g => new
                {
                    Id = g.EstadoId,
                    Desc = g.Estados.Descripcion
                }).ToList();

                ddlEstado.DataValueField = "Id";
                ddlEstado.DataTextField = "Desc";
                ddlEstado.DataSource = var;
                ddlEstado.DataBind();
                ddlEstado.Items.Insert(0, new ListItem("- Seleccione -", "0"));

                List<FormaPago> listaFormaPago = new Auxiliar().GetFormasPago();

                ddlFormaPago.DataValueField = "FormaPagoId";
                ddlFormaPago.DataTextField = "Descripcion";
                ddlFormaPago.DataSource = listaFormaPago;
                ddlFormaPago.DataBind();
                ddlFormaPago.Items.Insert(0, new ListItem("- Seleccione -", "0"));

                List<SociosCategorias> listaSC = new Socio().GetListSocioCategoria();

                ddlCategoria.DataValueField = "SocioCategoriaId";
                ddlCategoria.DataTextField = "Descripcion";
                ddlCategoria.DataSource = listaSC;
                ddlCategoria.DataBind();
                ddlCategoria.Items.Insert(0, new ListItem("- Seleccione -", "0"));
            }
        }