Esempio n. 1
0
        public override void Siguiente()
        {
            eFORMATO o = new eFORMATO();

            o.FOR_codigo = this.txtCodigo.Text.Trim();
            cargarDatos(balFORMATO.siguienteRegistro(o));
        }
Esempio n. 2
0
        public override void Anterior()
        {
            eFORMATO o = new eFORMATO();

            o.FOR_codigo = this.txtCodigo.Text.Trim();
            cargarDatos(balFORMATO.anteriorRegistro(o));
        }
Esempio n. 3
0
        private void btnGoFormato_Click(object sender, EventArgs e)
        {
            eFORMATO o = new eFORMATO();

            o.FOR_codigo = this.cmbFormato.SelectedValue != null?this.cmbFormato.SelectedValue.ToString() : "";

            frmDM_Formato o2 = new frmDM_Formato(o);

            o2.MdiParent = this.MdiParent;
            o2.Show();
        }
Esempio n. 4
0
        public bool eliminarRegistro(eFORMATO oeFORMATO)
        {
            using (SqlConnection cnn = new SqlConnection(ConfigurationManager.ConnectionStrings["CadenaPrincipal"].ToString()))
            {
                string     sp  = "pa_crud_FORMATO_eliminarRegistro";
                SqlCommand cmd = new SqlCommand(sp, cnn);
                cmd.CommandType = CommandType.StoredProcedure;

                cnn.Open();

                cmd.Parameters.Add(new SqlParameter("@FOR_CODIGO", oeFORMATO.FOR_codigo));

                return(cmd.ExecuteNonQuery() > 0);
            }
        }
Esempio n. 5
0
        public DataTable obtenerRegistro(eFORMATO oeFORMATO)
        {
            using (SqlConnection cnn = new SqlConnection(ConfigurationManager.ConnectionStrings["CadenaPrincipal"].ToString()))
            {
                string     sp  = "pa_crud_FORMATO_obtenerRegistro";
                SqlCommand cmd = new SqlCommand(sp, cnn);
                cmd.CommandType = CommandType.StoredProcedure;

                SqlDataAdapter dad = new SqlDataAdapter(cmd);
                dad.SelectCommand.Parameters.Add(new SqlParameter("@FOR_CODIGO", oeFORMATO.FOR_codigo));

                DataTable dt = new DataTable();
                dad.Fill(dt);

                return(dt);
            }
        }
Esempio n. 6
0
        public override void Buscar()
        {
            eFORMATO   o = new eFORMATO();
            balFORMATO b = new balFORMATO();

            _frmBusqueda ventana   = new _frmBusqueda(true, "buscarRegistro", b);
            DialogResult respuesta = ventana.ShowDialog();

            if (respuesta == DialogResult.OK)
            {
                o.FOR_codigo = ventana.pk;
                DataTable dt = balFORMATO.obtenerRegistro(o);
                cargarDatos(dt);

                this.txtCodigo.ReadOnly = true;
            }
        }
Esempio n. 7
0
        public override bool Actualizar()
        {
            bool rpta = false;

            try
            {
                eFORMATO o = new eFORMATO();
                o.FOR_codigo = this.txtCodigo.Text.Trim();
                o.FOR_nombre = this.txtNombre.Text.Trim();

                if (balFORMATO.actualizarRegistro(o))
                {
                    mensaje("actualizar", "");
                    //MessageBox.Show("El registro fue actualizado correctamente.", "SICO", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    this.txtCodigo.ReadOnly = true;
                    rpta = true;
                }
            }
            catch (CustomException ex)
            {
                if (ex.tupla != null)
                {
                    foreach (Control c in this.gpbInformacion.Controls)
                    {
                        foreach (var item in ex.tupla)
                        {
                            if (c.Tag != null && c.Tag.ToString() == item.name)
                            {
                                errValidacion.SetError(c, item.message.ToString());
                            }
                        }
                    }
                    mensaje("subsanar", "");
                }
                else
                {
                    mensaje("corregir", ex.Message);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Ocurrió un error inesperado:\r\n" + ex.Message, "SICO", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            return(rpta);
        }
Esempio n. 8
0
 public frmDM_Formato(eFORMATO o)
 {
     InitializeComponent();
     tabla   = "FORMATO";
     this._o = o;
 }