Example #1
0
        private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.ColumnIndex == (this.dataGridView1.Columns.Count - 1))
            {
                string        str      = MapeoQuerySql.ObtenerPorId("frmCatCuentas.dataGridView1_CellClick");
                frmBuscador   oBuscar  = new frmBuscador(str);
                List <string> lstDatos = new List <string>();

                oBuscar.ShowDialog();
                lstDatos = oBuscar.LstDatos;

                try
                {
                    if (lstDatos.Count > 0)
                    {
                        this.dataGridView1[e.ColumnIndex, e.RowIndex].Value = lstDatos[0];
                    }
                }
                catch (Exception ex)
                {
                    _ArchivoErrores = new LogErrores();
                    _ArchivoErrores.escribir("frmDatProveedores", "dataGridView1_CellClick", ex.Message);
                }
            }
        }
Example #2
0
        private void button_Cuenta_Click(object sender, EventArgs e)
        {
            try
            {
                string        str      = MapeoQuerySql.ObtenerPorId("frmCDescuentos.button_Cuenta_Click");
                frmBuscador   oBuscar  = new frmBuscador(str);
                List <string> lstDatos = new List <string>();

                oBuscar.ShowDialog();
                lstDatos = oBuscar.LstDatos;

                if (lstDatos.Count > 0)
                {
                    this.dataGridView1.Rows.Add(new object[] { lstDatos[0] });
                }
            }
            catch (Exception ex)
            {
                _ArchivoErrores = new LogErrores();
                _ArchivoErrores.escribir("frmCDescuentos", "button_Cuenta_Click", ex.Message);
            }
        }
Example #3
0
        private void tsbBuscar_Click(object sender, EventArgs e)
        {
            try
            {
                string        str      = MapeoQuerySql.ObtenerPorId("frmCatCuentas.tsbBuscar_Click");
                bool          flag     = true;
                frmBuscador   oBuscar  = new frmBuscador(str);
                List <string> lstDatos = new List <string>();

                oBuscar.ShowDialog();
                lstDatos = oBuscar.LstDatos;

                if (lstDatos.Count > 0)
                {
                    foreach (DataGridViewRow row in (IEnumerable)this.dataGridView1.Rows)
                    {
                        if (lstDatos[0].ToString() == row.Cells["Cuenta"].Value.ToString())
                        {
                            flag = false;
                        }
                    }

                    if (flag)
                    {
                        this.dataGridView1.Rows.Add(new object[] { true, lstDatos[0], lstDatos[1], lstDatos[2], 0 });
                    }
                    else
                    {
                        this.utilidades.mensaje_compuesto("Esta cuenta ya se encuentra en uso", "Aviso", 1, 1);
                    }
                }
            }
            catch (Exception ex)
            {
                _ArchivoErrores = new LogErrores();
                _ArchivoErrores.escribir("frmDatProveedores", "tsbBuscar_Click", ex.Message);
            }
        }