Example #1
0
        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 += "*";
            }
        }
Example #2
0
        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 += "*";
            }
        }
Example #3
0
 private void testForm_Load(object sender, EventArgs e)
 {
     SqlConnection conn = new SqlConnection();
     conn.ConnectionString = "Server = jx3web; DataBase = s3design_test; Uid = s3design; Password = davidbowie;";
     ScriptViewer.frmScriptView fsv   = new ScriptViewer.frmScriptView(conn);
     fsv.OnNewWindow += new svEventsHandle(fsv_OnNewWindow);
     fsv.OpenWindow(7374, 206, null);
     fsv.Show();
     fsv.OpenWindow(7374, 206, null);
     fsv.Show();
 }
Example #4
0
        private void testForm_Load(object sender, EventArgs e)
        {
            SqlConnection conn = new SqlConnection();

            conn.ConnectionString = "Server = jx3web; DataBase = s3design_test; Uid = s3design; Password = davidbowie;";
            ScriptViewer.frmScriptView fsv = new ScriptViewer.frmScriptView(conn);
            fsv.OnNewWindow += new svEventsHandle(fsv_OnNewWindow);
            fsv.OpenWindow(7374, 206, null);
            fsv.Show();
            fsv.OpenWindow(7374, 206, null);
            fsv.Show();
        }
Example #5
0
        /// <summary>
        /// 保存文档到数据库
        /// </summary>
        /// <returns></returns>
        public bool Save()
        {
            m_fsv = this.MdiParent as frmScriptView;
            if (this.filename != "")
            {
                //保存文件到磁盘
                StringToFile(luaEditorControl1.Text, filename);
            }
            else
            {
                //保存脚本到dbclass
                if (this.OnSave != null && m_bLocalLocked)
                {
                    OnSaveEventArgs osea = new OnSaveEventArgs(this.fieldid, this.tabid, luaEditorControl1.Text, this.tag);
                    this.OnSave(this, osea);
                    //m_slLock = new ScriptLock(m_fsv.Conn, Convert.ToInt32(this.fieldid), Convert.ToInt32(this.tabid), "", "");
                    m_slLock.UnLock();
                    m_bLocalLocked = false;
                    m_bLocked      = false;

                    if (osea.fieldid == "NG")
                    {
                        return(false);
                    }
                }
                else if (!m_bLocalLocked && m_bLocked)
                {
                    MessageBox.Show("内容被锁定,无法保存到数据库!");
                }
            }

            this.strCode = luaEditorControl1.Text;
            if (this.Text.EndsWith("*"))
            {
                this.Text = this.Text.Substring(0, this.Text.Length - 1);
            }

            return(true);
        }
Example #6
0
        /// <summary>
        /// 保存文档到数据库
        /// </summary>
        /// <returns></returns>
        public bool Save()
        {
            m_fsv = this.MdiParent as frmScriptView;
            if(this.filename != "")
            {
                //保存文件到磁盘
                StringToFile(luaEditorControl1.Text, filename);
            }
            else
            {
                //保存脚本到dbclass
                if(this.OnSave != null && m_bLocalLocked)
                {
                    OnSaveEventArgs osea = new OnSaveEventArgs(this.fieldid, this.tabid, luaEditorControl1.Text, this.tag);
                    this.OnSave(this, osea);
                    //m_slLock = new ScriptLock(m_fsv.Conn, Convert.ToInt32(this.fieldid), Convert.ToInt32(this.tabid), "", "");
                    m_slLock.UnLock();
                    m_bLocalLocked = false;
                    m_bLocked = false;

                    if( osea.fieldid == "NG")
                    {
                        return false;
                    }
                }
                else if (!m_bLocalLocked && m_bLocked)
                {
                    MessageBox.Show("内容被锁定,无法保存到数据库!");
                }
            }
            
            this.strCode = luaEditorControl1.Text;
            if (this.Text.EndsWith("*")) this.Text = this.Text.Substring(0, this.Text.Length - 1);

            return true;
        }