예제 #1
0
 private void cargarTipoIngreso()
 {
     cbTipoIngreso.DataSource    = NTipoMovAlmacen.MostrarTipoMovIngreso();
     cbTipoIngreso.ValueMember   = "Codigo";
     cbTipoIngreso.DisplayMember = "Tipo_Movimiento";
     cbTipoIngreso.SelectedIndex = -1;
     //lblPrueba.Text = cbCategoria.SelectedValue.ToString();
 }
예제 #2
0
        private void Guardar()
        {
            try
            {
                string rpta = "";
                if (this.txtNombre.Text.Trim() == string.Empty)
                {
                    MensajeError("Ingrese el tipo de Movimiento");
                    errorIcono.SetError(txtNombre, "Ingrese el tipo");
                }
                else
                {
                    if (this.IsNuevo)
                    {
                        rpta = NTipoMovAlmacen.Insertar(this.txtNombre.Text.Trim().ToUpper(), "I", "A");
                    }
                    else
                    {
                        rpta = NTipoMovAlmacen.Editar(Convert.ToInt32(this.txtIdTipoMov.Text), this.txtNombre.Text.Trim().ToUpper());
                    }

                    if (rpta.Equals("OK"))
                    {
                        if (this.IsNuevo)
                        {
                            this.MensajeOK("Se insertó correctamente");
                        }
                        else
                        {
                            this.MensajeOK("Se actualizó correctamente");
                        }
                    }
                    else
                    {
                        this.MensajeError(rpta);
                    }

                    this.IsNuevo  = false;
                    this.IsEditar = false;
                    this.Botones();
                    this.Limpiar();
                    this.Mostrar();
                    this.tabControl2.SelectedIndex = 0;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message + ex.StackTrace);
            }
        }
예제 #3
0
        private void Mostrar()
        {
            this.dataListado.DataSource = NTipoMovAlmacen.MostrarTipoMovIngreso();

            lblTotal.Text = "Total de Registros: " + Convert.ToString(dataListado.Rows.Count);

            if (this.dataListado.Rows.Count == 0)
            {
                this.dataListado.Visible = false;
            }
            else
            {
                this.dataListado.Visible = true;
                this.ocultarColumnas();
            }
        }
예제 #4
0
        private void btnEliminar_Click(object sender, EventArgs e)
        {
            try
            {
                DialogResult opcion;
                opcion = MessageBox.Show("Está seguro de eliminar los registros?", "Sistema de Ventas", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);

                if (opcion == DialogResult.OK)
                {
                    string codigo;
                    string rpta = "";

                    foreach (DataGridViewRow row in dataListado.Rows)
                    {
                        if (Convert.ToBoolean(row.Cells[0].Value))
                        {
                            codigo = Convert.ToString(row.Cells[1].Value);
                            rpta   = NTipoMovAlmacen.Eliminar(Convert.ToInt32(codigo));
                        }
                    }

                    if (rpta.Equals("OK"))
                    {
                        this.MensajeOK("Se eliminó correctamente el registro");
                    }
                    else
                    {
                        this.MensajeError(rpta);
                    }
                    this.Mostrar();
                    this.Limpiar();
                    this.btnEliminar.Enabled = false;
                    this.btnCancelar.Enabled = false;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message + ex.StackTrace);
            }
        }