示例#1
0
 private void packItinMaint_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.KeyCode == Keys.Enter && GridViewPackItin.IsFilterRow(GridViewPackItin.FocusedRowHandle))
     {
         executeQuery();
     }
 }
示例#2
0
        private void BindingNavigatorSaveItem_Click(object sender, EventArgs e)
        {
            if (PitinBindingSource.Current == null)
            {
                return;
            }

            GridViewPackItin.CloseEditor();
            ImageComboBoxEditCode.Focus();
            //bindingNavigatorPositionItem.Focus();//trigger field leave event
            bool temp = newRec;

            if (checkForms())
            {
                setReadOnly(true);
                dATEDateEdit.Properties.ReadOnly = true;
                GridViewPackItin.Columns.ColumnByName(colName).OptionsColumn.AllowEdit = false;
                panelControlStatus.Visible = true;
                LabelStatus.Text           = "Record Saved";
                rowStatusSave          = new Timer();
                rowStatusSave.Interval = 3000;
                rowStatusSave.Start();
                rowStatusSave.Tick += TimedEventSave;
            }

            if (!temp && !modified)
            {
                context.Refresh(System.Data.Entity.Core.Objects.RefreshMode.StoreWins, (PITIN)PitinBindingSource.Current);
            }
        }
示例#3
0
        private void executeQuery()
        {
            this.Cursor = Cursors.WaitCursor;
            string colName = GridViewPackItin.FocusedColumn.FieldName;
            string value   = String.Empty;

            if (!string.IsNullOrWhiteSpace(GridViewPackItin.GetFocusedDisplayText()))
            {
                value = GridViewPackItin.GetFocusedDisplayText();
            }
            if (!string.IsNullOrWhiteSpace(value))
            {
                string query   = String.Format("it.CAT like '{0}%'", GridViewPackItin.GetRowCellDisplayText(GridControl.AutoFilterRowHandle, "CAT"));
                var    special = context.PITIN.Where(query);

                if (!string.IsNullOrWhiteSpace(GridViewPackItin.GetRowCellDisplayText(GridControl.AutoFilterRowHandle, "CODE")))
                {
                    query   = String.Format("it.{0} like '{1}%'", "CODE", GridViewPackItin.GetRowCellDisplayText(GridControl.AutoFilterRowHandle, "CODE"));
                    special = special.Where(query);
                }
                if (!string.IsNullOrWhiteSpace(GridViewPackItin.GetRowCellDisplayText(GridControl.AutoFilterRowHandle, "DATE")))
                {
                    string validDate = GridViewPackItin.GetRowCellDisplayText(GridControl.AutoFilterRowHandle, "DATE");
                    string values    = validCheck.convertDate(validDate);
                    if (!string.IsNullOrWhiteSpace(values))
                    {
                        DateTime startDate = Convert.ToDateTime(values);
                        special = special.Where("it.DATE >= @dates", new ObjectParameter("dates", startDate));
                    }
                }
                int count = special.Count();
                if (count > 0)
                {
                    PitinBindingSource.DataSource            = special;
                    GridViewPackItin.FocusedRowHandle        = 0;
                    GridViewPackItin.FocusedColumn.FieldName = colName;
                    GridViewPackItin.ClearColumnsFilter();
                }
                else
                {
                    MessageBox.Show("No records in database.");
                    GridViewPackItin.ClearColumnsFilter();
                }
            }
            this.Cursor = Cursors.Default;
        }