Esempio n. 1
0
 private void Guardar()
 {
     sys_configuracion oSysConfig = new sys_configuracion();
     SysConfigImplement oSysConfigImplement = new SysConfigImplement();
     if (this.lblCodigo.Text == "")
     {
         oSysConfig.nombre = this.txtNombre.Text;
         oSysConfig.valor = this.txtValor.Text;
         oSysConfig.observacion = this.txtObsevacion.Text;
         oSysConfigImplement.Save(oSysConfig);
     }
     else
     {
         DataGridViewRow row = this.dgvConfig.CurrentRow;
         int id = Convert.ToInt32(row.Cells[0].Value);
         oSysConfig = oSysConfigImplement.Get(id);
         oSysConfig.nombre = this.txtNombre.Text;
         oSysConfig.valor = this.txtValor.Text;
         oSysConfig.observacion = this.txtObsevacion.Text;
         oSysConfigImplement.Update(oSysConfig);
     }
     Deshabilitar();
     this.txtNombre.Text = "";
     this.txtValor.Text = "";
     this.txtObsevacion.Text = "";
     CargarGrid();
 }
        private void Generar()
        {
            string UltimoPeriodo="";
            pgbProgreso.Value = 0;
            pgbProgreso.Minimum = 0;
            pgbProgreso.Visible = true;
            DateTime StartDate = new DateTime(int.Parse(this.mtbDesde.Text.Substring(0, 4)),int.Parse( this.mtbDesde.Text.Substring(5, 2)), 1);
            DateTime EndDate = new DateTime(int.Parse(this.mtbHasta.Text.Substring(0, 4)), int.Parse(this.mtbHasta.Text.Substring(5, 2)), 1);
            //Calculo diferencia de meses para utilizar en la barra de progreso
            pgbProgreso.Maximum = Math.Abs((EndDate.Month - StartDate.Month) + 12 * (EndDate.Year - StartDate.Year));
            int MonthInterval = 1;
            PeriodosImplement oPeriodoImplement = new PeriodosImplement();
            SysConfigImplement oSysConfigImplement = new SysConfigImplement();
            sys_configuracion oSysUltimoPeriodo = new sys_configuracion();
            oSysUltimoPeriodo = oSysConfigImplement.GetByNombre("UltimoPeriodo");
            UltimoPeriodo = oSysUltimoPeriodo.valor;
            //voy sumando meses hasta llegar a iguales fechas
            while (StartDate.AddMonths(MonthInterval) <= EndDate)
            {
                StartDate = StartDate.AddMonths(MonthInterval);
                periodos oPeriodo = new periodos();
                oPeriodo.id_periodo = StartDate.Date.ToString("yyyyMMdd").Substring(0,6);
                DateTime PrimerVencimiento = DateTime.Parse(oPeriodo.id_periodo.Substring(0, 4) + "/" + oPeriodo.id_periodo.Substring(4, 2)+"/" + this.txtPrimerVenc.Text);
                // incremento el dia mientra no sea fin de semana(se puede agregar para feriados - primer vencimiento
                while (PrimerVencimiento.DayOfWeek == DayOfWeek.Saturday || PrimerVencimiento.DayOfWeek == DayOfWeek.Sunday)
                {
                    PrimerVencimiento=PrimerVencimiento.Date.AddDays(1);
                }
                DateTime segundoVencimiento = PrimerVencimiento.Date.AddDays(int.Parse(this.txtDiasEntre.Text));
                // incremento el dia mientra no sea fin de semana(se puede agregar para feriados - segundo vencimiento
                while (segundoVencimiento.DayOfWeek == DayOfWeek.Saturday || segundoVencimiento.DayOfWeek == DayOfWeek.Sunday)
                {
                    segundoVencimiento = segundoVencimiento.Date.AddDays(1);
                }
                oPeriodo.fecha_primer_venc = PrimerVencimiento;
                oPeriodo.fecha_segundo_venc = segundoVencimiento;
                oPeriodo.fecha_tercer_venc = null;
                oPeriodo.fecha_facturacion = null;
                oPeriodo.facturado = false;
                oPeriodoImplement.Save(oPeriodo);
                UltimoPeriodo=oPeriodo.id_periodo;
                pgbProgreso.Value += 1;
            }

            if (oSysUltimoPeriodo.valor != UltimoPeriodo)
            {
                oSysUltimoPeriodo.valor = UltimoPeriodo;
                oSysConfigImplement.Update(oSysUltimoPeriodo);
                MessageBox.Show("La Generación se realizo Exitosamente");
                Inicializar();
            }
            else {
                MessageBox.Show("La Generación fue nula");
            }
        }
Esempio n. 3
0
        private void CargarSeleccion()
        {
            sys_configuracion oSysConfig = new sys_configuracion();
            SysConfigImplement oSysConfigImplement = new SysConfigImplement();
            DataGridViewRow row = this.dgvConfig.CurrentRow;
            int id = Convert.ToInt32(row.Cells[0].Value);
            oSysConfig = oSysConfigImplement.Get(id);

            this.lblCodigo.Text = oSysConfig.id_configuracion.ToString();
            this.txtNombre.Text = oSysConfig.nombre;
            this.txtValor.Text = oSysConfig.valor;
            this.txtObsevacion.Text = oSysConfig.observacion;
            this.gbConfig.Enabled = false;
            Deshabilitar();
        }
 private void CargarVencimientos()
 {
     SysConfigImplement oSysConfigImplement = new SysConfigImplement();
     sys_configuracion oSysDiaPrimerVencimiento = new sys_configuracion();
     sys_configuracion oSysUltimoPeriodo = new sys_configuracion();
     sys_configuracion oSysDíasEntreVenc2 = new sys_configuracion();
     oSysDiaPrimerVencimiento = oSysConfigImplement.GetByNombre("DiaPrimerVencimiento");
     oSysDíasEntreVenc2 = oSysConfigImplement.GetByNombre("DíasEntreVenc2");
     oSysUltimoPeriodo = oSysConfigImplement.GetByNombre("UltimoPeriodo");
     this.mtbDesde.Text = oSysUltimoPeriodo.valor;
     this.txtDiasEntre.Text = oSysDíasEntreVenc2.valor;
     this.txtPrimerVenc.Text = oSysDiaPrimerVencimiento.valor;
     this.mtbDesde.Enabled = false;
     this.txtDiasEntre.Enabled = false;
     this.txtPrimerVenc.Enabled = false;
 }
Esempio n. 5
0
        public sys_configuracion GetByNombre(string nombre)
        {
            sys_configuracion oSysConfig = new sys_configuracion();

            using (cooperativaEntities bd = new cooperativaEntities())
            {
                var regis = (from p in bd.sys_configuracion
                             where p.nombre == nombre
                             select p).Single();

                oSysConfig.id_configuracion = regis.id_configuracion;
                oSysConfig.nombre = regis.nombre;
                oSysConfig.observacion = regis.observacion;
                oSysConfig.valor = regis.valor;

                return oSysConfig;
            }
        }
Esempio n. 6
0
        public void Update(sys_configuracion oSysConfig)
        {
            using (cooperativaEntities bd = new cooperativaEntities())
            {
                var editar = (from p in bd.sys_configuracion
                              where p.id_configuracion == oSysConfig.id_configuracion
                              select p).Single();

                editar.nombre = oSysConfig.nombre;
                editar.observacion = oSysConfig.observacion;
                editar.valor = oSysConfig.valor;
                bd.SaveChanges();
            }
        }
Esempio n. 7
0
 public void Save(sys_configuracion oSysConfig)
 {
     cooperativaEntities bd = new cooperativaEntities();
     bd.sys_configuracion.AddObject(oSysConfig);
     bd.SaveChanges();
 }
        private void GuardarLeyendas()
        {
            SysConfigImplement oSysConfigImplement = new SysConfigImplement();
                sys_configuracion oSysObsComun = new sys_configuracion();
                oSysObsComun = oSysConfigImplement.GetByNombre("ObsComun");
                oSysObsComun.valor=this.txtObsComun.Text;
                oSysConfigImplement.Save(oSysObsComun);

                sys_configuracion oSysObsDeuda = new sys_configuracion();
                oSysObsDeuda = oSysConfigImplement.GetByNombre("ObsDeuda");
                oSysObsDeuda.valor = this.txtObsDeuda.Text;
                oSysConfigImplement.Save(oSysObsDeuda);

                sys_configuracion oSysObsDeuda2 = new sys_configuracion();
                oSysObsDeuda2 = oSysConfigImplement.GetByNombre("ObsDeuda2");
                oSysObsDeuda2.valor = this.txtObsDeuda2.Text;
                oSysConfigImplement.Save(oSysObsDeuda2);
        }
        private void GenerarListado()
        {
            //verifica que el barrio este seleccionado
            if (this.rbtnSelecionaBarrio.Checked && this.cmbBarrio.SelectedValue.ToString() == "0")

                MessageBox.Show("Debe seleccionar un barrio", "Información Insuficiente");

            if (rbtnFiltro.Checked && SQLFiltro=="")
                MessageBox.Show("Filtro", "Información Insuficiente");

            //verifica que se haya ingresado la fecha valida

            if (this.rbtnAAdeudan.Checked && this.txtPeriodos.Text=="")
                MessageBox.Show("Debe indicar la cantidad de Periodos que se utilizara", "Información Insuficiente");

            if (this.rbtnADeudaPesos.AutoCheck && this.txtPesos.Text=="")
                MessageBox.Show("Debe indicar el importe que se utilizara", "Información Insuficiente");

            if( this.rbtnSeleccionaCategoria.Checked && this.cmbCategoria.SelectedValue=="0")
                MessageBox.Show("Debe Seleccionar Categoria", "Información Insuficiente");

            string SQLSocios="select * from socios s "+
                    " inner join socios_conexion sc on s.id_Socio=sc.id_Socio where 1=1 ";

                if (this.rbtnSelecionaBarrio.Checked)

                    SQLSocios= SQLSocios+ " and sc.barrio="+this.cmbBarrio.SelectedValue;

                if (this.rbtnFiltro.Checked)
                    SQLSocios = SQLSocios + SQLFiltro;

                if (this.chkAExcluirNoSocios.Checked){
                    SysConfigImplement oSysConfigImplement = new SysConfigImplement();
                    sys_configuracion oSysConfig = new sys_configuracion();
                    oSysConfig = oSysConfigImplement.GetByNombre("DiaPrimerVencimiento");
                    SQLSocios = SQLSocios + " and s.codigo_socio<" + oSysConfig.valor;
                    }

                if (rbtnSeleccionaCategoria.Checked)
                    SQLSocios = SQLSocios + "and s.categoria=" + cmbCategoria.SelectedValue;

            Consultas oConsultas=new Consultas();
            DataTable dtSocios = oConsultas.GetScript(SQLSocios);
            foreach (DataRow dtRow in dtSocios.Rows)
            {
                //foreach(DataColumn dc in dtRow)
            }
        }
 /// <summary>
 /// Deprecated Method for adding a new object to the sys_configuracion EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddTosys_configuracion(sys_configuracion sys_configuracion)
 {
     base.AddObject("sys_configuracion", sys_configuracion);
 }
 /// <summary>
 /// Create a new sys_configuracion object.
 /// </summary>
 /// <param name="id_configuracion">Initial value of the id_configuracion property.</param>
 public static sys_configuracion Createsys_configuracion(global::System.Int32 id_configuracion)
 {
     sys_configuracion sys_configuracion = new sys_configuracion();
     sys_configuracion.id_configuracion = id_configuracion;
     return sys_configuracion;
 }