Exemple #1
0
        private void btnComandoEditCancel_Click(object sender, EventArgs e)
        {
            DBM.CLS.CRUD Tabla = new DBM.CLS.CRUD();

            if (btnComandoEditCancel.Tag.ToString() == "1")
            {
                btnComandoEditCancel.Tag   = "2";
                btnComandoEditCancel.Image = Properties.Resources.cancel;

                btnComandoNewSave.Tag   = "2";
                btnComandoNewSave.Image = Resources.save;
                groupBoxComando.Controls.OfType <TextBox>().ToList().ForEach(o => o.ReadOnly = false);
                txtIdComando.ReadOnly = true;

                DataRow dr = Tabla.GetRecordByID("comando", "idComando", dgComando.CurrentRow.Cells["idComando"].Value.ToString());

                txtIdComando.Text = dr["idComando"].ToString();
                txtComando.Text   = dr["comando"].ToString();
                txtComando.Focus();
            }
            else
            {
                btnComandoEditCancel.Tag   = "1";
                btnComandoEditCancel.Image = Properties.Resources.edit;

                btnComandoNewSave.Tag   = "1";
                btnComandoNewSave.Image = Properties.Resources.new_;
                groupBoxComando.Controls.OfType <TextBox>().ToList().ForEach(o => o.ReadOnly = true);
                LimpiarComandoForm();
            }
        }
Exemple #2
0
        private void btnEditCancel_Click(object sender, EventArgs e)
        {
            DBM.CLS.CRUD Tabla = new DBM.CLS.CRUD();


            if (btnEditCancel.Tag.ToString() == "1")
            {
                btnEditCancel.Tag   = "2";
                btnEditCancel.Image = Properties.Resources.cancel;

                btnNewSave.Tag     = "2";
                btnNewSave.Image   = Resources.save;
                txtEstado.ReadOnly = false;
                DataRow dr = Tabla.GetRecordByID("Estado", "idEstado", dgEstado.CurrentRow.Cells["idEstado"].Value.ToString());
                txtIdEstado.Text             = dr["idEstado"].ToString();
                txtEstado.Text               = dr["Estado"].ToString();
                CboColorPicker.SelectedIndex = int.Parse(dr["indexColor"].ToString());
                //lblColorSelector.BackColor = Color.FromName(dr["color"].ToString());
                //lblColorSelector.BackColor = Color.FromName(dr["color"].ToString());
                //    lblColorSelector.BackColor = Color.FromName("#"+dr["color"].ToString());
            }
            else
            {
                btnEditCancel.Tag   = "1";
                btnEditCancel.Image = Properties.Resources.edit;

                btnNewSave.Tag     = "1";
                btnNewSave.Image   = Properties.Resources.new_;
                txtEstado.ReadOnly = true;
                LimpiarForm();
                MostrarColor();
            }
        }
Exemple #3
0
        private void btnProveedorEditCancel_Click(object sender, EventArgs e)
        {
            DBM.CLS.CRUD Tabla = new DBM.CLS.CRUD();

            if (btnProveedorEditCancel.Tag.ToString() == "1")
            {
                btnProveedorEditCancel.Tag   = "2";
                btnProveedorEditCancel.Image = Properties.Resources.cancel;

                btnProveedorNewSave.Tag   = "2";
                btnProveedorNewSave.Image = Resources.save;
                groupBoxProveedor.Controls.OfType <TextBox>().ToList().ForEach(o => o.ReadOnly = false);
                txtidProveedor.ReadOnly = true;
                DataRow dr = Tabla.GetRecordByID("proveedor", "idProveedor", dgProveedor.CurrentRow.Cells["idProveedor"].Value.ToString());

                txtidProveedor.Text   = dr["idProveedor"].ToString();
                txtNombreProv.Text    = dr["nombre"].ToString();
                txtDireccionProv.Text = dr["direccion"].ToString();
                txtEmailProv.Text     = dr["email"].ToString();
                txtTelefonoProv.Text  = dr["telefono"].ToString();
                txtNITProv.Text       = dr["NIT"].ToString();
                txtNRCProv.Text       = dr["regContable"].ToString();
                txtContactoProv.Text  = dr["contacto"].ToString();
            }
            else
            {
                btnProveedorEditCancel.Tag   = "1";
                btnProveedorEditCancel.Image = Properties.Resources.edit;

                btnProveedorNewSave.Tag   = "1";
                btnProveedorNewSave.Image = Properties.Resources.new_;
                groupBoxProveedor.Controls.OfType <TextBox>().ToList().ForEach(o => o.ReadOnly = true);
                LimpiarProveedorForm();
            }
        }
Exemple #4
0
        private void btnEliminar_Click(object sender, EventArgs e)
        {
            DBM.CLS.CRUD Tabla     = new DBM.CLS.CRUD();
            DBM.CLS.CRUD objEgreso = new DBM.CLS.CRUD();
            string       egresoID  = dgEgreso.CurrentRow.Cells["idEgreso"].Value.ToString();
            string       importe   = dgEgreso.CurrentRow.Cells["cantidad"].Value.ToString();

            objEgreso.GetRecordByID("egreso", "idEgreso", dgEgreso.CurrentRow.Cells["idEgreso"].Value.ToString());
            try
            {
                if (Tabla.Delete("egreso", "idEgreso", egresoID) > 0)
                {
                    MessageBox.Show("El registro se eliminó correctamente", "Confirmacion", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    List <string> campos  = new List <string>();
                    List <string> valores = new List <string>();
                    campos.Add("saldo");
                    valores.Add("saldo + " + importe.Replace(",", "."));

                    Tabla.Update("caja", campos, valores, "estado", "1");
                    lblEfectivoDisponible.Text = obtenerSaldoCaja().ToString();
                    cargarGrid();
                }
                else
                {
                    MessageBox.Show("El registro no se pudo eliminar", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }catch (Exception)
            {
                MessageBox.Show("No ha seleccionado un registro para eliminar", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }
Exemple #5
0
        private void btnTipoProductoEditCancel_Click(object sender, EventArgs e)
        {
            DBM.CLS.CRUD Tabla = new DBM.CLS.CRUD();


            if (btnTipoProductoEditCancel.Tag.ToString() == "1")
            {
                btnTipoProductoEditCancel.Tag   = "2";
                btnTipoProductoEditCancel.Image = Properties.Resources.cancel;

                btnTipoProductoNewSave.Tag   = "2";
                btnTipoProductoNewSave.Image = Resources.save;
                txtTipoProducto.ReadOnly     = false;
                DataRow dr = Tabla.GetRecordByID("tipo_producto", "idTipo", dgTipoProducto.CurrentRow.Cells["idTipo"].Value.ToString());
                txtIdTipo.Text       = dr["idTipo"].ToString();
                txtTipoProducto.Text = dr["tipo_producto"].ToString();
            }
            else
            {
                btnTipoProductoEditCancel.Tag   = "1";
                btnTipoProductoEditCancel.Image = Properties.Resources.edit;

                btnTipoProductoNewSave.Tag   = "1";
                btnTipoProductoNewSave.Image = Properties.Resources.new_;
                txtTipoProducto.ReadOnly     = true;
                LimpiarTipoProductoForm();
            }
        }
Exemple #6
0
        private void btnClienteEditCancel_Click(object sender, EventArgs e)
        {
            DBM.CLS.CRUD Tabla = new DBM.CLS.CRUD();

            if (btnClienteEditCancel.Tag.ToString() == "1")
            {
                btnClienteEditCancel.Tag   = "2";
                btnClienteEditCancel.Image = Properties.Resources.cancel;

                btnClienteNewSave.Tag   = "2";
                btnClienteNewSave.Image = Resources.save;
                groupBoxCliente.Controls.OfType <TextBox>().ToList().ForEach(o => o.ReadOnly = false);
                txtIdCliente.ReadOnly = true;
                DataRow dr = Tabla.GetRecordByID("cliente", "idCliente", dgCliente.CurrentRow.Cells["idCliente"].Value.ToString());

                txtIdCliente.Text = dr["idCliente"].ToString();
                txtNombre.Text    = dr["nombre"].ToString();
                txtDireccion.Text = dr["direccion"].ToString();
                txtEmail.Text     = dr["email"].ToString();
                txtTelefono.Text  = dr["telefono"].ToString();
                txtNIT.Text       = dr["NIT"].ToString();
                //txtNRC.Text = dr["NRC"].ToString();
            }
            else
            {
                btnClienteEditCancel.Tag   = "1";
                btnClienteEditCancel.Image = Properties.Resources.edit;

                btnClienteNewSave.Tag   = "1";
                btnClienteNewSave.Image = Properties.Resources.new_;
                groupBoxCliente.Controls.OfType <TextBox>().ToList().ForEach(o => o.ReadOnly = true);
                LimpiarClienteForm();
            }
        }
Exemple #7
0
        private void btnMarcaEditCancel_Click(object sender, EventArgs e)
        {
            DBM.CLS.CRUD Tabla = new DBM.CLS.CRUD();


            if (btnMarcaEditCancel.Tag.ToString() == "1")
            {
                btnMarcaEditCancel.Tag   = "2";
                btnMarcaEditCancel.Image = Properties.Resources.cancel;

                btnMarcaNewSave.Tag   = "2";
                btnMarcaNewSave.Image = Resources.save;
                txtMarca.ReadOnly     = false;
                DataRow dr = Tabla.GetRecordByID("marca", "idMarca", dgMarcas.CurrentRow.Cells["idMarca"].Value.ToString());
                txtIdMarca.Text = dr["idMarca"].ToString();
                txtMarca.Text   = dr["marca"].ToString();
            }
            else
            {
                btnMarcaEditCancel.Tag   = "1";
                btnMarcaEditCancel.Image = Properties.Resources.edit;

                btnMarcaNewSave.Tag   = "1";
                btnMarcaNewSave.Image = Properties.Resources.new_;
                txtMarca.ReadOnly     = true;
                LimpiarMarcaForm();
            }
        }
Exemple #8
0
        private void btnPresentacionEditCancel_Click(object sender, EventArgs e)
        {
            DBM.CLS.CRUD Tabla = new DBM.CLS.CRUD();


            if (btnPresentacionEditCancel.Tag.ToString() == "1")
            {
                btnPresentacionEditCancel.Tag   = "2";
                btnPresentacionEditCancel.Image = Properties.Resources.cancel;

                btnPresentacionNewSave.Tag   = "2";
                btnPresentacionNewSave.Image = Resources.save;
                txtPresentacion.ReadOnly     = false;
                DataRow dr = Tabla.GetRecordByID("UnidadMedida", "idUnidad", dgPresentacion.CurrentRow.Cells["idUnidad"].Value.ToString());
                txtIdPresentacion.Text = dr["idUnidad"].ToString();
                txtPresentacion.Text   = dr["UnidadMedida"].ToString();
            }
            else
            {
                btnPresentacionEditCancel.Tag   = "1";
                btnPresentacionEditCancel.Image = Properties.Resources.edit;

                btnPresentacionNewSave.Tag   = "1";
                btnPresentacionNewSave.Image = Properties.Resources.new_;
                txtPresentacion.ReadOnly     = true;
                LimpiarPresentacionForm();
            }
        }
Exemple #9
0
        private void btnCategoriaEditCancel_Click(object sender, EventArgs e)
        {
            DBM.CLS.CRUD Tabla = new DBM.CLS.CRUD();


            if (btnCategoriaEditCancel.Tag.ToString() == "1")
            {
                btnCategoriaEditCancel.Tag   = "2";
                btnCategoriaEditCancel.Image = Properties.Resources.cancel;

                btnCategoriaNewSave.Tag   = "2";
                btnCategoriaNewSave.Image = Resources.save;
                txtCategoria.ReadOnly     = false;
                DataRow dr = Tabla.GetRecordByID("Familia", "IdFamilia", dgCategoria.CurrentRow.Cells["IdFamilia"].Value.ToString());
                txtIdCategoria.Text        = dr["IdFamilia"].ToString();
                txtCategoria.Text          = dr["Familia"].ToString();
                chkCategoriaActiva.Checked = bool.Parse(dr["activo"].ToString()) ? true : false;
            }
            else
            {
                btnCategoriaEditCancel.Tag   = "1";
                btnCategoriaEditCancel.Image = Properties.Resources.edit;

                btnCategoriaNewSave.Tag   = "1";
                btnCategoriaNewSave.Image = Properties.Resources.new_;
                txtCategoria.ReadOnly     = true;
                LimpiarCategoryForm();
            }
        }
Exemple #10
0
        private void btnRead_Click(object sender, EventArgs e)
        {
            DBM.CLS.CRUD Tabla = new DBM.CLS.CRUD();
            DataRow      dr    = Tabla.GetRecordByID("Familia", "idFamilia", txtId.Text);

            TxtField1.Text = dr["familia"].ToString();
        }
Exemple #11
0
        private void btnProductoEditCancel_Click(object sender, EventArgs e)
        {
            DBM.CLS.CRUD Tabla = new DBM.CLS.CRUD();

            if (btnProductoEditCancel.Tag.ToString() == "1")
            {
                btnProductoEditCancel.Tag   = "2";
                btnProductoEditCancel.Image = Properties.Resources.cancel;

                btnProductoNewSave.Tag   = "2";
                btnProductoNewSave.Image = Resources.save;
                groupBoxProducto.Controls.OfType <TextBox>().ToList().ForEach(o => o.ReadOnly = false);
                DataRow dr = Tabla.GetRecordByID("producto", "idProducto", dgProducto.CurrentRow.Cells["idProducto"].Value.ToString());

                txtIdProducto.Text = dr["idProducto"].ToString();


                if (dr["IdFamilia"].ToString().Length > 0)
                {
                    cboCategoria.SelectedValue = dr["IdFamilia"].ToString();
                }
                if (dr["idUnidad"].ToString().Length > 0)
                {
                    cboPresentacion.SelectedValue = dr["idUnidad"].ToString();
                }
                if (dr["idTipo"].ToString().Length > 0)
                {
                    cboTipoProducto.SelectedValue = dr["idTipo"].ToString();
                }
                if (dr["idMarca"].ToString().Length > 0)
                {
                    cboMarca.SelectedValue = dr["idMarca"].ToString();
                }

                txtDescripcion.Text      = dr["descripcion"].ToString();
                txtPrecio.Text           = dr["precio"].ToString();
                txtCosto.Text            = dr["costo"].ToString();
                txtStock.Text            = dr["stock"].ToString();
                txtStockMinimo.Text      = dr["stockMinimo"].ToString();
                chkInventariable.Checked = Convert.ToBoolean(dr["inventariable"].ToString());
                chkMostrar.Checked       = Convert.ToBoolean(dr["activo"].ToString());
            }
            else
            {
                btnProductoEditCancel.Tag   = "1";
                btnProductoEditCancel.Image = Properties.Resources.edit;

                btnProductoNewSave.Tag   = "1";
                btnProductoNewSave.Image = Properties.Resources.new_;
                groupBoxProducto.Controls.OfType <TextBox>().ToList().ForEach(o => o.ReadOnly = true);
                LimpiarProductoForm();
            }
        }
Exemple #12
0
        private void btnUsuarioEditCancel_Click(object sender, EventArgs e)
        {
            DBM.CLS.CRUD Tabla = new DBM.CLS.CRUD();

            if (btnUsuarioEditCancel.Tag.ToString() == "1")
            {
                btnUsuarioEditCancel.Tag   = "2";
                btnUsuarioEditCancel.Image = Properties.Resources.cancel;

                btnUsuarioNewSave.Tag   = "2";
                btnUsuarioNewSave.Image = Resources.save;
                groupBoxUsuario.Controls.OfType <TextBox>().ToList().ForEach(o => o.ReadOnly = false);
                txtIdUsuario.ReadOnly = true;
                DataRow dr = Tabla.GetRecordByID("empleado", "idEmpleado", dgUsuario.CurrentRow.Cells["idEmpleado"].Value.ToString());

                txtIdUsuario.Text       = dr["idUsuario"].ToString();
                txtNombres.Text         = dr["nombres"].ToString();
                txtApellidos.Text       = dr["apellidos"].ToString();
                txtEmail.Text           = dr["email"].ToString();
                txtTelefono.Text        = dr["telefono"].ToString();
                cboPerfil.SelectedValue = dr["idRol"].ToString();

                txtPassword.ReadOnly  = true;
                txtPassword2.ReadOnly = true;

                chkChangePassword.Visible = true;

                txtNombres.Focus();
            }
            else
            {
                btnUsuarioEditCancel.Tag   = "1";
                btnUsuarioEditCancel.Image = Properties.Resources.edit;

                btnUsuarioNewSave.Tag   = "1";
                btnUsuarioNewSave.Image = Properties.Resources.new_;
                groupBoxUsuario.Controls.OfType <TextBox>().ToList().ForEach(o => o.ReadOnly = true);
                chkChangePassword.Checked = false;
                chkChangePassword.Visible = false;
                LimpiarForm();
            }
        }