コード例 #1
0
        private void tb2_cmdBuscarPlantilla_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(tb2_txtVar.Text) || string.IsNullOrEmpty(tb2_txtTipo.Text))
            {
                MessageBox.Show("Favor de introducir tipo de etiqueta y variación de la misma.", "Campo Vacío", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            this.Cursor = Cursors.WaitCursor;
            int tipo = int.Parse(tb2_txtTipo.Text);
            int var = int.Parse(tb2_txtVar.Text);
            etq = new Etiqueta_C();
            List<string> todosLosCampos;
            if (etq.obtenerTodosLosCamposDeBD())
                todosLosCampos = etq.TodosLosCampos;
            else
                return;
            string tipocod = "", etqxhoja = "", loteProd = "", loteDesp = "";
            int idioma = 0;
            List<string> camposUsados = etq.obtenerCampos(tipo, var);
            etq.Obtener_Idioma_Codigo_EtqPorHoja(tipo, var, ref tipocod, ref idioma, ref etqxhoja);
            if (camposUsados.Count == 0)
            {
                this.Cursor = Cursors.Default;
                if (MessageBox.Show("El registro de etiqueta tipo " + tipo + " y variación " + var
                    + " no existe en la base de datos. \n¿Desea crearlo en este momento?"
                    , "Nuevo Registro", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes)
                {
                    //pasar a crear etiqueta
                }
                else
                {
                    return;
                }
            }
            else
            {
                this.creaDataGridView_tb2(todosLosCampos, camposUsados, tb2_dgv);
                this.AgregarItemsAComboBoxes(tipocod, etqxhoja, idioma.ToString());
                if (this.obtenerNombresLotes(tipo, var, ref loteProd, ref loteDesp))
                {
                    tb2_txtLoteDesp.Text = loteDesp;
                    tb2_txtLoteProd.Text = loteProd;
                }
            }

            this.Cursor = Cursors.Default;
        }
コード例 #2
0
        private void tb1_cmdBuscar_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(tb1_txtVar.Text) || string.IsNullOrEmpty(tb1_txtTipo.Text))
            {
                MessageBox.Show("Favor de introducir tipo de etiqueta y variación de la misma.", "Campo Vacío", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            this.Cursor = Cursors.WaitCursor;
            int tipo = int.Parse(tb1_txtTipo.Text);
            int var = int.Parse(tb1_txtVar.Text);
            etq = new Etiqueta_C();
            if (etq.checarSiExisteRegistro(tipo, var))
            {
                if (MessageBox.Show("El registro de etiqueta tipo " + tipo + " y variación " + var + " ya existe. \n¿Desea editarlo en este momento?"
                    , "Registro Duplicado", MessageBoxButtons.YesNo, MessageBoxIcon.Error) == DialogResult.Yes)
                {
                    this.tb1_reset();
                    tabControl1.SelectedTab = tb2_EditarEtiqueta;
                    tb2_txtTipo.Text = tipo.ToString();
                    tb2_txtVar.Text = var.ToString();
                    this.Cursor = Cursors.Default;
                    return;
                }
                else
                {
                    this.Cursor = Cursors.Default;
                    this.tb1_reset();
                    return;
                }
            }
            List<string> todosLosCampos;
            if (etq.obtenerTodosLosCamposDeBD())
                todosLosCampos = etq.TodosLosCampos;
            else
                return;

            this.creaDataGridView_tb1(todosLosCampos, tb1_dgv);
            tb1_pn_adicionales.Enabled = true;
            tb1_cmdNuevoCampo.Enabled = true;
            this.Cursor = Cursors.Default;
        }