private void simpleButtonNew_Click(object sender, EventArgs e) { Config.NewKeyValue("Operation", (sender as SimpleButton).Text); this.gcMain.Refresh(); //this.gvMain.EndDataUpdate(); string s = gvMain.ActiveFilterString; gvMain.ClearColumnsFilter(); _frmDesigner.formAction = FormAction.New; _bindingSource.AddNew(); _bindingSource.EndEdit(); if (frmSingleDt == null) { frmSingleDt = new FrmSingleDt(_frmDesigner); } frmSingleDt.ShowDialog(); gvMain.ActiveFilterString = s; gvMain.ApplyColumnsFilter(); this.gvMain.BeginUpdate(); this.gcMain.DataSource = null; this.gcMain.DataSource = _bindingSource.DataSource; this.gvMain.EndUpdate(); this.gvMain.RefreshData(); DisplayData(); //this.bindingSource_CurrentChanged _data.DataChanged = false; }
private void simpleButtonCopy_Click(object sender, EventArgs e) { Config.NewKeyValue("Operation", (sender as SimpleButton).Text); _frmDesigner.formAction = FormAction.Copy; if (frmSingleDt == null) { frmSingleDt = new FrmSingleDt(_frmDesigner); } frmSingleDt.ShowDialog(); }
private void simpleButtonEdit_Click(object sender, EventArgs e) { Config.NewKeyValue("Operation", (sender as SimpleButton).Text); _frmDesigner.formAction = FormAction.Edit; if (frmSingleDt == null) { frmSingleDt = new FrmSingleDt(_frmDesigner); } frmSingleDt.ShowDialog(); if (frmSingleDt.DialogResult == DialogResult.Cancel) { bsMain.DataSource = _data.DsData; } }
private void simpleButtonCopy_Click(object sender, EventArgs e) { Config.NewKeyValue("Operation", (sender as SimpleButton).Text); _frmDesigner.formAction = FormAction.Copy; if (frmSingleDt == null) { frmSingleDt = new FrmSingleDt(_frmDesigner); } frmSingleDt.ShowDialog(); this.gvMain.BeginUpdate(); this.gcMain.DataSource = null; this.gcMain.DataSource = _bindingSource.DataSource; DisplayData(); this.gvMain.EndUpdate(); this.gvMain.RefreshData(); }
private void ChangeCode() { Config.NewKeyValue("Operation", "F5-Sao chép"); _frmDesigner.formAction = FormAction.Copy; DataRow OldCode = (_bindingSource.Current as DataRowView).Row; if (frmSingleDt == null) { frmSingleDt = new FrmSingleDt(_frmDesigner); } frmSingleDt.ShowDialog(); this.gvMain.BeginUpdate(); if (frmSingleDt.DialogResult != DialogResult.Cancel) { DataRow NewCode = (_bindingSource.Current as DataRowView).Row; if (XtraMessageBox.Show("Có chắc chắn muốn chuyển Mã không?", "Xác nhận", MessageBoxButtons.YesNo) == DialogResult.Yes) { (_data as DataSingle).ChangeCode(OldCode, NewCode); Config.NewKeyValue("Operation", "F4 - Xóa"); int index = _bindingSource.Find(_data.DrTable["pk"].ToString(), OldCode[_data.DrTable["pk"].ToString()]); _bindingSource.Position = index; _frmDesigner.formAction = FormAction.Delete; _bindingSource.RemoveCurrent(); } } if (!_data.UpdateData(DataAction.Delete)) { _data.CancelUpdate(); DisplayData(); } _data.Reset(); this.gcMain.DataSource = null; this.gcMain.DataSource = _bindingSource.DataSource; DisplayData(); this.gvMain.EndUpdate(); this.gvMain.RefreshData(); }