private void luaEditorControl1_OnChange(object sender, EventArgs e) { if (this.fieldid == null || this.tabid == null) return; m_fsv = this.MdiParent as frmScriptView; m_slLock = new ScriptLock(m_fsv.Conn, Convert.ToInt32(this.fieldid), Convert.ToInt32(this.tabid), "", ""); if (!m_bLocalLocked && !m_bLocked) { //本机未加锁,没有加锁记录 尝试加锁 if (m_slLock.Lock()) { //本机已加锁,加锁成功 m_bLocalLocked = true; m_bLocked = false;//以前无加锁记录 } else { //已有加锁记录,加锁失败 m_bLocked = true; m_bLocalLocked = false; MessageBox.Show("该内容已被" + m_slLock.GetServerLastLockUser() + "锁定,当前的修改不可以被保存!"); } } if (isChanged && !this.Text.EndsWith("*")) { this.Text += "*"; } }
public frmScriptView(SqlConnection conn) { InitFont(); InitializeComponent(); this.tabStrip1.MdiForm = this; this.scriptTree1.init(conn); this.m_conn = conn; ScriptLock slLock = new ScriptLock(conn, 0, 0, "", ""); slLock.DeleteAllLocalLock(); }