public void Init() { this.deBegin.Text = DateTime.Now.ToString("yyyy-MM-dd"); this.deEnd.Text = DateTime.Now.ToString("yyyy-MM-dd"); this.sbQuery.Click += RefeshData; this.cbeJKR.Properties.Items.Add("所有"); foreach (DataRow datarow in SqlHelper.ExecuteTable("select distinct jkr from account").Rows) { this.cbeJKR.Properties.Items.Add(datarow["jkr"]); } this.cbeJKR.SelectedIndex = 0; this.groupControl1.CustomButtonClick += (s, e) => { if (e.Button.Properties.Caption == "新增") { SelectedAccount = new Account(); DialogFactory.CreateJKDControl(SelectedAccount); } else if (e.Button.Properties.Caption == "查看") { DialogFactory.CreateJKDControl(SelectedAccount); } else if (e.Button.Properties.Caption == "删除") { DialogResult dr = XtraMessageBox.Show("是否确定删除该记录?", "确认框", MessageBoxButtons.OKCancel); if (dr == DialogResult.OK) { int count = new AccountManager().Delete(SelectedAccount.id); if (count > 0) { XtraMessageBox.Show($"Id为{SelectedAccount.id}的记录删除成功"); } } } this.RefeshData(this, new EventArgs()); }; }