Ejemplo n.º 1
0
 private void SvcRestr2Form_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.KeyCode == Keys.Enter && GridViewSvcRest.IsFilterRow(GridViewSvcRest.FocusedRowHandle))
     {
         executeQuery();
     }
 }
Ejemplo n.º 2
0
        private void sVCRESTR2BindingNavigatorSaveItem_Click(object sender, EventArgs e)
        {
            if (SvcRestr2BindingSource.Current == null)
            {
                return;
            }

            GridViewSvcRest.CloseEditor();
            ComboBoxEditType.Focus();
            bool temp = newRec;

            //bindingNavigatorPositionItem.Focus();//trigger field leave event
            if (checkForms())
            {
                //codeTextEdit.Focus();
                //codeTextEdit.Properties.ReadOnly = true;
                //gridView1.Columns.ColumnByName(colName1).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, (SVCRESTR2)SvcRestr2BindingSource.Current);
            }
        }
Ejemplo n.º 3
0
 private void bindingNavigatorAddNewItem_Click(object sender, EventArgs e)
 {
     if (SvcRestr2BindingSource.Current == null)
     {
         SvcRestr2BindingSource.AddNew();
         //codeTextEdit.Focus();
         //codeTextEdit.Properties.ReadOnly = false;
         //gridView1.Columns.ColumnByName(colName1).OptionsColumn.AllowEdit = true;
         newRec = true;
         return;
     }
     ComboBoxEditType.Focus();
     //bindingNavigatorPositionItem.Focus();  //trigger field leave event
     GridViewSvcRest.CloseEditor();
     temp = newRec;
     if (checkForms())
     {
         if (!temp)
         {
             context.Refresh(System.Data.Entity.Core.Objects.RefreshMode.StoreWins, (SVCRESTR2)SvcRestr2BindingSource.Current);
         }
         SvcRestr2BindingSource.AddNew();
         //codeTextEdit.Focus();
         //codeTextEdit.Properties.ReadOnly = false;
         //gridView1.Columns.ColumnByName(colName1).OptionsColumn.AllowEdit = true;
         newRec = true;
     }
 }
Ejemplo n.º 4
0
 private void gridView1_CellValueChanging(object sender, DevExpress.XtraGrid.Views.Base.CellValueChangedEventArgs e)
 {
     if (!GridViewSvcRest.IsFilterRow(e.RowHandle))
     {
         modified = true;
     }
     labelControl8.Text  = DateTime.Today.ToShortDateString();;
     labelControl10.Text = username;
 }
Ejemplo n.º 5
0
 private bool move()
 {
     GridViewSvcRest.CloseEditor();
     ComboBoxEditType.Focus();
     //bindingNavigatorPositionItem.Focus();//trigger field leave event
     temp = newRec;
     if (checkForms())
     {
         if (!temp)
         {
             context.Refresh(System.Data.Entity.Core.Objects.RefreshMode.StoreWins, (SVCRESTR2)SvcRestr2BindingSource.Current);
         }
         //codeTextEdit.Properties.ReadOnly = true;
         //gridView1.Columns.ColumnByName(colName1).OptionsColumn.AllowEdit = false;
         newRec   = false;
         modified = false;
         return(true);
     }
     return(false);
 }
Ejemplo n.º 6
0
 private void bindingNavigatorDeleteItem_Click(object sender, EventArgs e)
 {
     if (SvcRestr2BindingSource.Current == null)
     {
         return;
     }
     GridViewSvcRest.CloseEditor();
     if (MessageBox.Show("Are you sure you want to delete?", "CONFIRM", MessageBoxButtons.YesNo) == DialogResult.Yes)
     {
         modified = false;
         newRec   = false;
         SvcRestr2BindingSource.RemoveCurrent();
         errorProvider1.Clear();
         context.SaveChanges();
         panelControlStatus.Visible = true;
         LabelStatus.Text           = "Record Deleted";
         rowStatusDelete            = new Timer();
         rowStatusDelete.Interval   = 3000;
         rowStatusDelete.Start();
         rowStatusDelete.Tick += new EventHandler(TimedEventDelete);
     }
     //currentVal = codeTextEdit.Text;
 }
Ejemplo n.º 7
0
        private void executeQuery()
        {
            this.Cursor = Cursors.WaitCursor;
            string colName = GridViewSvcRest.FocusedColumn.FieldName;
            string value   = String.Empty;

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


                if (!string.IsNullOrWhiteSpace(GridViewSvcRest.GetRowCellDisplayText(GridControl.AutoFilterRowHandle, "CODE")))
                {
                    query   = String.Format("it.{0} like '{1}%'", "CODE", GridViewSvcRest.GetRowCellDisplayText(GridControl.AutoFilterRowHandle, "CODE"));
                    special = special.Where(query);
                }
                int count = special.Count();
                if (count > 0)
                {
                    SvcRestr2BindingSource.DataSource = special;
                    GridViewSvcRest.SetRowCellValue(GridControl.AutoFilterRowHandle, colName, value);
                    GridViewSvcRest.FocusedRowHandle        = 0;
                    GridViewSvcRest.FocusedColumn.FieldName = colName;
                }
                else
                {
                    MessageBox.Show("No records in database.");
                    GridViewSvcRest.ClearColumnsFilter();
                }
            }
            this.Cursor = Cursors.Default;
        }