Exemplo n.º 1
0
        public override void Siguiente()
        {
            eLINEA o = new eLINEA();

            o.LIN_codigo = this.txtCodigo.Text.Trim();
            cargarDatos(balLINEA.siguienteRegistro(o));
        }
Exemplo n.º 2
0
        public override void Anterior()
        {
            eLINEA o = new eLINEA();

            o.LIN_codigo = this.txtCodigo.Text.Trim();
            cargarDatos(balLINEA.anteriorRegistro(o));
        }
Exemplo n.º 3
0
        private void btnGoLinea_Click(object sender, EventArgs e)
        {
            eLINEA o = new eLINEA();

            o.LIN_codigo = this.cmbLinea.SelectedValue != null?this.cmbLinea.SelectedValue.ToString() : "";

            frmDM_Linea o2 = new frmDM_Linea(o);

            o2.MdiParent = this.MdiParent;
            o2.Show();
        }
Exemplo n.º 4
0
        public frmDM_Linea(eLINEA o)
        {
            InitializeComponent();
            tabla = "LINEA";

            this.cmbCategoria.ValueMember   = "CAT_codigo";
            this.cmbCategoria.DisplayMember = "CAT_nombre";
            this.cmbCategoria.DataSource    = balCATEGORIA.poblar();

            this._o = o;
        }
Exemplo n.º 5
0
        public bool eliminarRegistro(eLINEA oeLINEA)
        {
            using (SqlConnection cnn = new SqlConnection(ConfigurationManager.ConnectionStrings["CadenaPrincipal"].ToString()))
            {
                string     sp  = "pa_crud_LINEA_eliminarRegistro";
                SqlCommand cmd = new SqlCommand(sp, cnn);
                cmd.CommandType = CommandType.StoredProcedure;

                cnn.Open();

                cmd.Parameters.Add(new SqlParameter("@LIN_CODIGO", oeLINEA.LIN_codigo));

                return(cmd.ExecuteNonQuery() > 0);
            }
        }
Exemplo n.º 6
0
        public DataTable obtenerRegistro(eLINEA oeLINEA)
        {
            using (SqlConnection cnn = new SqlConnection(ConfigurationManager.ConnectionStrings["CadenaPrincipal"].ToString()))
            {
                string     sp  = "pa_crud_LINEA_obtenerRegistro";
                SqlCommand cmd = new SqlCommand(sp, cnn);
                cmd.CommandType = CommandType.StoredProcedure;

                SqlDataAdapter dad = new SqlDataAdapter(cmd);
                dad.SelectCommand.Parameters.Add(new SqlParameter("@LIN_CODIGO", oeLINEA.LIN_codigo));

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

                return(dt);
            }
        }
Exemplo n.º 7
0
        public bool actualizarRegistro(eLINEA oeLINEA)
        {
            using (SqlConnection cnn = new SqlConnection(ConfigurationManager.ConnectionStrings["CadenaPrincipal"].ToString()))
            {
                string     sp  = "pa_crud_LINEA_actualizarRegistro";
                SqlCommand cmd = new SqlCommand(sp, cnn);
                cmd.CommandType = CommandType.StoredProcedure;

                cnn.Open();

                cmd.Parameters.Add(new SqlParameter("@LIN_CODIGO", oeLINEA.LIN_codigo));                 //variable tipo:string
                cmd.Parameters.Add(new SqlParameter("@LIN_NOMBRE", oeLINEA.LIN_nombre));                 //variable tipo:string
                cmd.Parameters.Add(new SqlParameter("@CAT_CODIGO", oeLINEA.CAT_codigo));                 //variable tipo:string

                return(cmd.ExecuteNonQuery() > 0);
            }
        }
Exemplo n.º 8
0
        public override bool Actualizar()
        {
            bool rpta = false;

            try
            {
                eLINEA o = new eLINEA();
                o.LIN_codigo = this.txtCodigo.Text.Trim();
                o.LIN_nombre = this.txtNombre.Text.Trim();
                o.CAT_codigo = this.cmbCategoria.SelectedValue != null?this.cmbCategoria.SelectedValue.ToString() : "";

                if (balLINEA.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);
        }
Exemplo n.º 9
0
        public override void Buscar()
        {
            eLINEA   o = new eLINEA();
            balLINEA b = new balLINEA();

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

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

                this.txtCodigo.ReadOnly = true;
            }
        }