Exemplo n.º 1
0
        public void CargarDatos(string clase, string linea, string tipofor)
        {
            FormatoDataSource formatoedit = new FormatoDataSource();

            try
            {
                formatoedit         = this.negocioFormato.DevolverFormato(tipofor, clase, linea);
                txt_encabezado.Text = this.negocioFormato.DevolverEncabezado(int.Parse(tipofor));
            }
            catch (Exception ex)
            {
                MessageBox.Show("SE PRESENTO UN ERROR." + ex.Message, "ERROR");
            }

            cbx_tipo.SelectedIndex = tipofor.Equals("1") ? 0 : 1;
            txt_clase.Text         = formatoedit.ClaseCuenta;
            txt_linea.Text         = formatoedit.Linea;
            txt_nombre.Text        = formatoedit.Nombre;
            txt_cuentaini.Text     = formatoedit.CuentaInicial;
            txt_cuentafin.Text     = formatoedit.CuentaFinal;
            btn_guardar.Enabled    = true;
            this.CamposActivos();
            txt_encabezado.Focus();
            cbx_tipo.Enabled = false;
            this.BotonesInhab();
            this.btn_cancelar.Enabled = true;
        }
Exemplo n.º 2
0
        public FormatoDataSource DevolverFormato(string tipo, string clase, string linea)
        {
            FormatoDataSource formato = new FormatoDataSource();

            try
            {
                var items = this.persistencia.DevolverFormato(tipo, clase, linea);
                if (items != null)
                {
                    formato.TipoFormato   = items.tipoformato;
                    formato.ClaseCuenta   = items.clasemayor;
                    formato.Linea         = items.linea;
                    formato.Nombre        = items.nombref;
                    formato.CuentaInicial = this.persistenciaCuenta.DevolverCuenta(items.cuentaini);
                    formato.CuentaFinal   = this.persistenciaCuenta.DevolverCuenta(items.cuentafin);
                }
                else
                {
                    formato = null;
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return(formato);
        }
Exemplo n.º 3
0
        private FormatoDataSource GuardarDatos()
        {
            FormatoDataSource format = new FormatoDataSource();

            format.TipoFormato   = cbx_tipo.SelectedItem.ToString() == "BALANCE GENERAL" ? "1" : "2";
            format.ClaseCuenta   = txt_clase.Text;
            format.Linea         = txt_linea.Text;
            format.Nombre        = txt_nombre.Text;
            format.CuentaInicial = txt_cuentaini.Text;
            format.CuentaFinal   = txt_cuentafin.Text;
            return(format);
        }
Exemplo n.º 4
0
        private void Btn_guardar_Click(object sender, EventArgs e)
        {
            bool validar = this.ValidarGuardar();

            if (validar)
            {
                FormatoDataSource formato = new FormatoDataSource();
                formato = this.GuardarDatos();
                if (cbx_tipo.Enabled == true)
                {
                    try
                    {
                        bool guardar = this.negocioFormato.GuardarFormato(formato, txt_encabezado.Text);
                        if (guardar)
                        {
                            MessageBox.Show("EL FORMATO HA SIDO GUARDADO", "GUARDAR", MessageBoxButtons.OK);
                        }
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show("SE PRESENTO UN ERROR. " + ex.Message, "ERROR");
                    }
                }
                else
                {
                    try
                    {
                        bool guardar = this.negocioFormato.ActualizarFormato(formato, txt_encabezado.Text);
                        if (guardar)
                        {
                            MessageBox.Show("EL FROMATO HA SIDO ACTUALIZADO", "GUARDAR", MessageBoxButtons.OK);
                        }
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show("SE PRESENTO UN ERROR. " + ex.Message, "ERROR");
                    }
                }

                this.CamposVacios();
                this.CamposInactivos();
                this.BotonesHabit();
                btn_cancelar.Enabled = false;
            }
        }
Exemplo n.º 5
0
        private bool ValidarGuardar()
        {
            bool result = false;

            if (!txt_encabezado.Text.Equals(string.Empty) && !txt_clase.Text.Equals(string.Empty) && !txt_linea.Text.Equals(string.Empty) && !txt_nombre.Text.Equals(string.Empty) &&
                !txt_cuentaini.Text.Equals(string.Empty) && !txt_cuentafin.Text.Equals(string.Empty))
            {
                bool existe = false;
                FormatoDataSource format = new FormatoDataSource();
                format = this.GuardarDatos();
                try
                {
                    existe = this.negocioFormato.ExisteFormato(format);
                }
                catch (Exception ex)
                {
                    MessageBox.Show("SE PRESENTO UN ERROR." + ex.Message, "ERROR");
                }

                if (!existe)
                {
                    result = true;
                }
                else
                {
                    if (cbx_tipo.Enabled == true)
                    {
                        result = false;
                        MessageBox.Show("EL FORMATO QUE DESEA INGRESAR YA EXISTE", "ERROR", MessageBoxButtons.OK);
                    }
                    else
                    {
                        result = true;
                    }
                }
            }
            else
            {
                result = false;
                MessageBox.Show("POR FAVOR INGRESE TODOS LOS CAMPOS", "ERROR", MessageBoxButtons.OK);
            }

            return(result);
        }
Exemplo n.º 6
0
        public bool ExisteFormato(FormatoDataSource formato)
        {
            formatosbpyg forma = new formatosbpyg();

            forma.tipoformato = formato.TipoFormato;
            forma.nombref     = formato.Nombre;
            forma.clasemayor  = formato.ClaseCuenta;
            forma.linea       = formato.Linea;
            forma.cuentaini   = this.persistenciaCuenta.DevolverId(formato.CuentaInicial);
            forma.cuentafin   = this.persistenciaCuenta.DevolverId(formato.CuentaFinal);
            try
            {
                return(this.persistencia.ExisteFormato(forma));
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }