public BoxModeCreateUpdate(BoxTagInfo bti, LiveDataForm ldf) { InitializeComponent(); _bti = bti; this.ldf = ldf; db.OpenDB(); }
private void button1_Click(object sender, EventArgs e) { try { if (!ValidUid(txtBoxTagUid.Text)) { MessageBox.Show(ResStrings.BoxModeCreateUpdate_button1_Click_TagUID_not_Valid_, ResStrings.BoxModeCreateUpdate_button1_Click_Box_Mode_Info, MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } _bti = new BoxTagInfo(); _bti.TagBox = txtBoxTagUid.Text; _bti.BoxRef = txtBoxRef.Text; _bti.BoxDesc = txtBoxDesc.Text; _bti.Criteria = txtCriteria.Text.Replace("'", ""e"); db.DeleteGroup(_bti.TagBox); db.AddGroup(_bti.TagBox, _bti.BoxRef, _bti.BoxDesc, _bti.Criteria); Close(); } catch (Exception exp) { ExceptionMessageBox.Show(exp); } }
private void dataGridViewGroup_SelectionChanged(object sender, EventArgs e) { if (dataGridViewGroup.SelectedRows.Count > 0) { _bti = new BoxTagInfo(); _bti.TagBox = dataGridViewGroup.SelectedRows[0].Cells[0].Value.ToString(); _bti.BoxRef = dataGridViewGroup.SelectedRows[0].Cells[1].Value.ToString(); _bti.BoxDesc = dataGridViewGroup.SelectedRows[0].Cells[2].Value.ToString(); _bti.Criteria = dataGridViewGroup.SelectedRows[0].Cells[3].Value.ToString(); _bti.Criteria = _bti.Criteria.Replace(""e", "'"); if (!string.IsNullOrEmpty(_bti.TagBox)) { _groupTagList = db.GetGroupLink(_bti.TagBox); } } if (_groupTagList == null) { _groupTagList = new ArrayList(); } UpdateDataList(); }
private void addGroupToolStripMenuItem_Click(object sender, EventArgs e) { _bti = null; if (dataGridViewGroup.SelectedRows.Count > 0) { _bti = new BoxTagInfo(); _bti.TagBox = dataGridViewGroup.SelectedRows[0].Cells[0].Value.ToString(); _bti.BoxRef = dataGridViewGroup.SelectedRows[0].Cells[1].Value.ToString(); _bti.BoxDesc = dataGridViewGroup.SelectedRows[0].Cells[2].Value.ToString(); _bti.Criteria = dataGridViewGroup.SelectedRows[0].Cells[3].Value.ToString(); _bti.Criteria = _bti.Criteria.Replace(""e", "'"); } if (_bmcu != null) { _bmcu.Close(); _bmcu = null; } _bmcu = new BoxModeCreateUpdate(_bti, ldf); _bmcu.ShowDialog(); UpdateGroup(); }