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; if (_data.DsData.Tables[0].PrimaryKey.Length > 0) { DataColumn colKey = _data.DsData.Tables[0].PrimaryKey[0]; _data.DsData.Tables[0].PrimaryKey = null; colKey.AllowDBNull = true; } 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 ChangeCode() { if (this._data.DsData.Tables[0].Columns.Contains("ws") && this._data.DrTable["sysUserID"] != DBNull.Value && this._data.DrTable["sysUserID"].ToString() != Config.GetValue("sysUserID").ToString()) { return; } if (lciEdit.Visibility == DevExpress.XtraLayout.Utils.LayoutVisibility.Never) { return; } Config.NewKeyValue("Operation", "F5-Sao chép"); _frmDesigner.formAction = FormAction.Copy; DataRow OldCode = (_bindingSource.Current as DataRowView).Row.Table.NewRow(); OldCode.ItemArray = (_bindingSource.Current as DataRowView).Row.ItemArray; if (frmSingleDt == null) { frmSingleDt = new FrmSingleDt(_frmDesigner); } string s = gvMain.ActiveFilterString; gvMain.ActiveFilterString = ""; gvMain.ApplyColumnsFilter(); frmSingleDt.ShowDialog(); this.gvMain.BeginUpdate(); gvMain.ActiveFilterString = s; gvMain.ApplyColumnsFilter(); 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(); }
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 simpleButtonEdit_Click(object sender, EventArgs e) { Config.NewKeyValue("Operation", (sender as SimpleButton).Text); string s = gvMain.ActiveFilterString; gvMain.ActiveFilterString = ""; gvMain.ApplyColumnsFilter(); _frmDesigner.formAction = FormAction.Edit; if (frmSingleDt == null) { frmSingleDt = new FrmSingleDt(_frmDesigner); } frmSingleDt.ShowDialog(); gvMain.ActiveFilterString = s; gvMain.ApplyColumnsFilter(); DisplayData(); }
private void simpleButtonNew_Click(object sender, EventArgs e) { Config.NewKeyValue("Operation", (sender as SimpleButton).Text); _frmDesigner.formAction = FormAction.New; if (frmSingleDt == null) { frmSingleDt = new FrmSingleDt(_frmDesigner); } _bindingSource.AddNew(); _bindingSource.EndEdit(); _frmDesigner.RefreshGridLookupEdit(); frmSingleDt.ShowDialog(); if (frmSingleDt.DialogResult == DialogResult.Cancel) { bsMain.DataSource = _data.DsData; } }