//Thêm - Sửa giao dịch private void btNew_Click(object sender, EventArgs e) { if (MaKH == null) { return; } Config.NewKeyValue("Operation", (sender as SimpleButton).Text); this.gcHistory.Refresh(); //this.gvMain.EndDataUpdate(); string s = (gcHistory.Views[0] as GridView).ActiveFilterString; if (dtGDHistory.DsData.Tables[0].PrimaryKey.Length > 0) { DataColumn colKey = dtGDHistory.DsData.Tables[0].PrimaryKey[0]; dtGDHistory.DsData.Tables[0].PrimaryKey = null; colKey.AllowDBNull = true; } (gcHistory.Views[0] as GridView).ClearColumnsFilter(); designer_history.formAction = FormAction.New; bsGDHistory.AddNew(); bsGDHistory.EndEdit(); (bsGDHistory.Current as DataRowView).Row["MaKH"] = MaKH; if (FrmGDHistory == null) { FrmGDHistory = new FrmSingleDt(designer_history); } foreach (CDTGridLookUpEdit Gle in designer_history._glist) { if (Gle.Data.DrTable["TableName"].ToString() == "dmGDType") { Gle.Data.Condition = "BangLK is null"; Gle.Data.GetData(); } } FrmGDHistory.ShowDialog(); (gcHistory.Views[0] as GridView).ActiveFilterString = s; (gcHistory.Views[0] as GridView).ApplyColumnsFilter(); (gcHistory.Views[0] as GridView).BeginUpdate(); gcHistory.DataSource = null; gcHistory.DataSource = bsGDHistory; (gcHistory.Views[0] as GridView).EndUpdate(); (gcHistory.Views[0] as GridView).RefreshData(); //this.bindingSource_CurrentChanged dtGDHistory.DataChanged = false; foreach (CDTGridLookUpEdit Gle in designer_history._glist) { if (Gle.Data.DrTable["TableName"].ToString() == "dmGDType") { Gle.Data.Condition = ""; Gle.Data.GetData(); } } }
private void btAddKH_Click(object sender, EventArgs e) { if (dmkh == null) { return; } BindingSource bs = new BindingSource(); bs.DataSource = dmkh.DsData.Tables[0]; FrmSingleDt frm = new FrmSingleDt(dmkh, bs); if (frm.ShowDialog() == DialogResult.OK) { } }