private void barButtonItem1_ItemClick_1(object sender, ItemClickEventArgs e) { if (_bindingSource.Position < 0) { return; } fComment fc = new fComment(_data, _bindingSource.Position); fc.ShowDialog(); }
void bindingNavigator1_ItemClicked(object sender, ToolStripItemClickedEventArgs e) { switch (e.ClickedItem.Name) { case "toolStripButton1": if (_data.DataChanged) { if (MessageBox.Show("Dữ liệu chưa được lưu, bạn có muốn lưu không?", "", MessageBoxButtons.YesNo) == DialogResult.Yes) { Config.NewKeyValue("Operation", "F12-Lưu"); UpdateData(); RemoveTabReport(); } else { CancelUpdate(); break; } } _frmDesigner.formAction = FormAction.New; _bindingSource.AddNew(); _bindingSource.EndEdit(); _frmDesigner.RefreshGridLookupEdit(); _x = true; SetCurrentData(); _frmDesigner.RefreshFormulaDetail(); _frmDesigner.InsertedToDetail = false; _frmDesigner.TabDetail.SelectedTabPage = _frmDesigner.TabDetail.TabPages[0]; break; case "toolStripButton2": Config.NewKeyValue("Operation", "F12-Lưu"); UpdateData(); RemoveTabReport(); break; case "toolStripButton3": // Config.NewKeyValue("Operation", 'F7-Print"); if (_data.DrTable["Report"].ToString() == string.Empty) { return; } else { int[] newIndex = { _bindingSource.Position }; BeforePrint bp = new BeforePrint(_data, newIndex); bp.ShowDialog(); } break; case "toolStripButton4": Config.NewKeyValue("Operation", "F12-Lưu"); UpdateData(); RemoveTabReport(); if (!_x) { //if (_data.DrTable["Report"].ToString() == string.Empty) // return; //else //{ // // int[] newIndex ={ _bindingSource.Position }; // // BeforePrint bp = new BeforePrint(_data, newIndex); // // bp.ShowDialog(); //} Config.NewKeyValue("Operation", "New"); _frmDesigner.formAction = FormAction.New; _bindingSource.AddNew(); _bindingSource.EndEdit(); _frmDesigner.RefreshGridLookupEdit(); _x = true; SetCurrentData(); _frmDesigner.RefreshFormulaDetail(); _frmDesigner.InsertedToDetail = false; _frmDesigner.TabDetail.SelectedTabPage = _frmDesigner.TabDetail.TabPages[0]; } break; case "toolStripButton5": if (_bindingSource.Position < 0) { return; } fComment fC = new fComment(_data, _bindingSource.Position); fC.ShowDialog(); break; } }