private void simpleButton1_Click(object sender, EventArgs e) { Dialog_TokenSet _dialog = new Dialog_TokenSet(); if (_dialog.ShowDialog() == DialogResult.OK) { GDSTokenRecord _newRec = new GDSTokenRecord(); _newRec.ID = Guid.NewGuid().ToString(); _newRec.RemoteIP = _dialog.TokenIP; _newRec.TokenData = MD5Base64.Encode(_dialog.TokenString); _newRec.CommandName = this.CommandName; using (SinoSZClientBase.CommonService.CommonServiceClient _csc = new SinoSZClientBase.CommonService.CommonServiceClient()) { bool _ret = _csc.InsertTokenRecord(_newRec); if (_ret) { this.gridView1.BeginUpdate(); TokenRecords.Add(_newRec); this.gridView1.EndUpdate(); this.gridView1.RefreshData(); } else { MessageBox.Show("添加失败!", "系统提示", MessageBoxButtons.OK); } } } }
private void simpleButton2_Click(object sender, EventArgs e) { if (gridView1.FocusedRowHandle >= 0) { GDSTokenRecord _g = gridView1.GetRow(this.gridView1.FocusedRowHandle) as GDSTokenRecord; Dialog_TokenSet _dialog = new Dialog_TokenSet(_g); if (_dialog.ShowDialog() == DialogResult.OK) { using (SinoSZClientBase.CommonService.CommonServiceClient _csc = new SinoSZClientBase.CommonService.CommonServiceClient()) { GDSTokenRecord _newRec = new GDSTokenRecord(); _newRec.ID = _g.ID; _newRec.RemoteIP = _g.RemoteIP; _newRec.TokenData = MD5Base64.Encode(_dialog.TokenString); _newRec.CommandName = _g.CommandName; bool _ret = _csc.UpdateTokenRecord(_newRec); if (_ret) { this.gridView1.BeginUpdate(); _g.TokenData = _newRec.TokenData; this.gridView1.EndUpdate(); this.gridView1.RefreshData(); } else { MessageBox.Show("删除失败!", "系统提示", MessageBoxButtons.OK); } } } } else { MessageBox.Show("请选择一个要重设令牌的记录!", "系统提示", MessageBoxButtons.OK); } }