Ejemplo n.º 1
0
        private void dataGridView1_CellValueChanged(object sender, DataGridViewCellEventArgs e)
        {
            if (RaiseValueChanged)
            {
                DataGridViewCheckBoxCell cc;
                ItemResult ItemChanged;

                if (dataGridView1.Columns[e.ColumnIndex].Name.Equals("CheckedIn"))
                {
                    cc          = dataGridView1[e.ColumnIndex, e.RowIndex] as DataGridViewCheckBoxCell;
                    ItemChanged = GenerateItemResult(e.RowIndex);
                    if ((bool)cc.Value)
                    {
                        ItemChanged.LastCheckInValue = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                        (dataGridView1["LastCheckIn", e.RowIndex] as DataGridViewTextBoxCell).Value = ItemChanged.LastCheckInValue;
                        ItemChanged.UpsertCheckInOut(Form1.MasterConnection, true);
                        dataGridView1.Rows[e.RowIndex].DefaultCellStyle.BackColor = System.Drawing.Color.LightGreen;
                        //Cursor.Current = Cursors.WaitCursor;
                    }
                    else
                    {
                        ItemChanged.LastCheckOutValue = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                        (dataGridView1["LastCheckOut", e.RowIndex] as DataGridViewTextBoxCell).Value = ItemChanged.LastCheckOutValue;
                        ItemChanged.UpsertCheckInOut(Form1.MasterConnection, false);
                        dataGridView1.Rows[e.RowIndex].DefaultCellStyle.BackColor = System.Drawing.Color.LightPink;
                        //Cursor.Current = Cursors.WaitCursor;
                    }
                }
            }
        }
Ejemplo n.º 2
0
        private void dataGridView1_CellValueChanged(object sender, DataGridViewCellEventArgs e)
        {
            DataGridViewCheckBoxCell cc;
            ItemResult ItemChanged;

            if (dataGridView1.Columns[e.ColumnIndex].Name.Equals("CheckInCol"))
            {
                cc          = dataGridView1[e.ColumnIndex, e.RowIndex] as DataGridViewCheckBoxCell;
                ItemChanged = itemResultBindingSource[e.RowIndex] as ItemResult;
                if ((bool)cc.Value)
                {
                    ItemChanged.LastCheckInValue = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                    ItemChanged.UpsertCheckInOut(SearchItems.SearchItemsConnection, true);
                }
                else
                {
                    ItemChanged.LastCheckOutValue = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                    ItemChanged.UpsertCheckInOut(SearchItems.SearchItemsConnection, false);
                }
            }
        }