private void toolStripButtonEdit_Click(object sender, EventArgs e)
        {
            if (this.arduinoThread.IsAlive)
            {
                this.arduinoRW.Cancel();
                this.arduinoThread.Join();
            }
            FormAnchoredKeysAddEdit frmAncEdit = new FormAnchoredKeysAddEdit(id_worker_visitor, whoIs,
                                                                             Convert.ToInt32(((DataRowView)this.view_key_user_keyBindingSource.Current).Row["ID_key"].ToString()),
                                                                             Convert.ToInt32(((DataRowView)this.view_key_user_keyBindingSource.Current).Row["ID_user"].ToString()),
                                                                             ((DataRowView)this.view_key_user_keyBindingSource.Current).Row["Date_of_issue"].ToString(),
                                                                             ((DataRowView)this.view_key_user_keyBindingSource.Current).Row["Date_of_start_action"].ToString(),
                                                                             ((DataRowView)this.view_key_user_keyBindingSource.Current).Row["Date_expiration"].ToString(),
                                                                             (whoIs.Equals("worker") ? null : ((DataRowView)this.view_key_user_keyBindingSource.Current).Row["Visit_purpose"].ToString()));

            frmAncEdit.ShowDialog();
            this.toolStripButtonRefresh.PerformClick();
        }
예제 #2
0
        private void view_keysDataGridView_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            if (id_worker_visitor != -1)
            {
                try
                {
                    var senderGrid = (DataGridView)sender;

                    if (senderGrid.Columns[e.ColumnIndex] is DataGridViewButtonColumn &&
                        e.RowIndex >= 0)
                    {
                        FormAnchoredKeysAddEdit frmAncAdd = new FormAnchoredKeysAddEdit(id_worker_visitor, worker_visitor, Convert.ToInt32(((DataRowView)this.view_keysBindingSource.Current).Row["ID_key"].ToString()), -1, null, null, null, null);
                        frmAncAdd.ShowDialog();
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Ошибка добавления записи.\nТекст ошибки:" + ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }