public frmArticulosGenerarApartir(BindingSource bindingSource)
 {
     InitializeComponent();
     this.bindingSource = bindingSource;
     bindingSource.RemoveFilter();
     txtDesde.KeyDown += new System.Windows.Forms.KeyEventHandler(BL.Utilitarios.EnterTab);
     txtHasta.KeyDown += new System.Windows.Forms.KeyEventHandler(BL.Utilitarios.EnterTab);
     txtDesde.Enter += new System.EventHandler(BL.Utilitarios.SelTextoTextBox);
     txtHasta.Enter += new System.EventHandler(BL.Utilitarios.SelTextoTextBox);
     txtDesde.KeyPress += new System.Windows.Forms.KeyPressEventHandler(BL.Utilitarios.SoloNumeros);
     txtHasta.KeyPress += new System.Windows.Forms.KeyPressEventHandler(BL.Utilitarios.SoloNumeros);
 }
예제 #2
0
        public bool GenericEditAction(IEditable _geditForm, BindingSource actualActions, BindingSource groupHeadersList, bool isNew = false)
        {
            ulog = UserLog.Instance;
            try
            {
                DataRowView actionDataRowView;
                actionDataRowView = (isNew == false) ? (DataRowView)actualActions.Current : (DataRowView)actualActions.AddNew();
                if (actionDataRowView == null)
                    throw new Exception("Нет записей для редактирования.");

                using (IEditable editActForm = _geditForm)
                {//открываем форму и сохраняем изменения
                    if (editActForm.ShowDialog() == DialogResult.OK)
                    {
                        actualActions.EndEdit();
                        return true;
                    }
                    else
                    {
                        actualActions.CancelEdit();
                        return false;
                    }
                }
            }
            catch (Exception ex)
            {
                actualActions.CancelEdit();
                ulog.Message(ex.Message, UserLogMessageLevel.Error);
                return false;
            }
            finally
            {
                groupHeadersList.RemoveFilter();
                groupHeadersList.Filter = "[InList] = 1";
            }
        }
        private void txbBuscaNome_KeyUp(object sender, KeyEventArgs e)
        {
            BindingSource bs = new BindingSource();
            bs.DataSource = dvgOperadores.DataSource;
            if (txbBuscaNome.Text != string.Empty)
                bs.Filter = "nome like '%" + txbBuscaNome.Text + "%'";
            else
                bs.RemoveFilter();

            dvgOperadores.DataSource = bs;
        }
        private void txbBuscaNome_KeyUp(object sender, KeyEventArgs e)
        {
            BindingSource bs = new BindingSource();
            bs.DataSource = dgvProdutos.DataSource;
            if (txbBuscaNome.Text != string.Empty)
                bs.Filter = "descricao like '%" + txbBuscaNome.Text + "%'";
            else
                bs.RemoveFilter();

            dgvProdutos.DataSource = bs;
        }
예제 #5
0
        // Tim
        /************************************************************************************************************************************/
        /* public void textBoxSuchenTextChanged(DataGridView dataGridView, ComboBox comboBox, TextBox textBox, BindingSource bindingSource) */
        /************************************************************************************************************************************/
        /* Wenn sich er TextBox Text geändert haben sollte, wird der Filter angepasst                                                        */
        /************************************************************************************************************************************/
        public void textBoxSuchenTextChanged(DataGridView dataGridView, ComboBox comboBox, TextBox textBox, BindingSource bindingSource)
        {
            string suchen = "";
            if (String.IsNullOrEmpty(textBox.Text)) // Wenn leer dann suchen Filter entfernen
            {
                bindingSource.RemoveFilter();
            }
            else // Nach irgendwas suchen
            {
                suchen += dataGridView.Columns[comboBox.SelectedIndex].HeaderText.ToString();
                suchen = "Convert([" + suchen + "], 'System.String') LIKE '*{0}*'";
            }

            bindingSource.Filter = string.Format(suchen, textBox.Text);
        }