예제 #1
0
        private void explorerBar1_ItemClick(object sender, Janus.Windows.ExplorerBar.ItemEventArgs e)
        {
            switch (e.Item.Text.ToString())
            {
                case "修改":
                    if (this.m_selectNode == "")
                    {
                        MessageBox.Show("请先选择数据!");
                        return;
                    }
                    this.m_isEdit = true;
                    this.richTextBox1.ReadOnly = false;
                    this.textBox3.ReadOnly = false;
                    this.textBox6.ReadOnly = false;
                    this.textBox4.ReadOnly = false;
                    this.textBox9.ReadOnly = false;
                    this.textBox10.ReadOnly = false;
                    this.textBox8.ReadOnly = false;
                    this.textBox13.ReadOnly = false;
                    this.textBox12.ReadOnly = false;

                    this.richTextBox1.BackColor = Color.White;
                    this.textBox3.BackColor = Color.White;
                    this.textBox6.BackColor = Color.White;
                    this.textBox4.BackColor = Color.White;
                    this.textBox9.BackColor = Color.White;
                    this.textBox10.BackColor = Color.White;
                    this.textBox8.BackColor = Color.White;
                    this.textBox13.BackColor = Color.White;
                    this.textBox12.BackColor = Color.White;

                    for (int i = 0; i < m_labelActive.Count; i++)
                    {
                        m_textBoxActive[i].ReadOnly = false;
                        m_textBoxActive[i].BackColor = Color.White;
                    }
                    break;

                case "保存":
                    if (this.m_selectNode == "")
                    {
                        MessageBox.Show("请先选择数据!");
                        return;
                    }
                    if (this.m_isEdit == false)
                    {
                        MessageBox.Show("请先修改数据!");
                        return;
                    }
                    this.richTextBox1.ReadOnly = true;
                    this.textBox3.ReadOnly = true;
                    this.textBox6.ReadOnly = true;
                    this.textBox4.ReadOnly = true;
                    this.textBox9.ReadOnly = true;
                    this.textBox10.ReadOnly = true;
                    this.textBox8.ReadOnly = true;
                    this.textBox13.ReadOnly = true;
                    this.textBox12.ReadOnly = true;

                    this.richTextBox1.BackColor = Color.AliceBlue;
                    this.textBox3.BackColor = Color.AliceBlue;
                    this.textBox6.BackColor = Color.AliceBlue;
                    this.textBox4.BackColor = Color.AliceBlue;
                    this.textBox9.BackColor = Color.AliceBlue;
                    this.textBox10.BackColor = Color.AliceBlue;
                    this.textBox8.BackColor = Color.AliceBlue;
                    this.textBox13.BackColor = Color.AliceBlue;
                    this.textBox12.BackColor = Color.AliceBlue;

                    for (int i = 0; i < m_labelActive.Count; i++)
                    {
                        m_textBoxActive[i].ReadOnly = false;
                        m_textBoxActive[i].BackColor = Color.AliceBlue;
                    }

                    string sqlText = "update SHEETMETADATA set SOURCEFORMAT='" + textBox3.Text + "'," + "DESCRIPTION='" + richTextBox1.Text + "'," + "ALIANAME='" + textBox6.Text + "'," + "SOURCE='" + textBox4.Text + "'," + "HEIGHTDATUM='" + textBox10.Text + "'," + "SHEETNO='" + textBox9.Text + "'," + "COOR='" + textBox8.Text + "'," + "SCALE='" + textBox13.Text + "'," + "EDITER='" + textBox12.Text + "' where NAME='" + textBox1.Text + "'";
                    m_oraCmd.CommandText = sqlText;
                    m_oraCmd.ExecuteNonQuery();
                    if (this.m_labelActive.Count > 0)
                    {
                        sqlText = "update CUSTOMMETADATA set ";
                        for (int i = 0; i < this.m_customField.Count; i++)
                        {
                            if (i != this.m_customField.Count - 1)
                            {
                                sqlText += this.m_customField[i].ToString() + "='" + this.m_textBoxActive[i].Text.Trim().ToString() + "',";
                            }
                            else
                            {
                                sqlText += this.m_customField[i].ToString() + "='" + this.m_textBoxActive[i].Text.Trim().ToString() + "'";
                            }
                        }
                        sqlText += " where NAME='" + textBox1.Text + "'";
                        m_oraCmd.CommandText = sqlText;
                        m_oraCmd.ExecuteNonQuery();
                    }
                    this.m_isEdit = false;
                    MessageBox.Show("更新成功!");

                    break;

                case "按名称":
                    frmSearchByName frmSearch = new frmSearchByName();
                    frmSearch.ShowDialog();
                    string name = frmSearch.Name;
                    if (name != "")
                    {
                        sqlText = "select *from SHEETMETADATA where NAME='" + name + "'";
                        m_oraCmd.CommandText = sqlText;
                        OracleDataReader dr = m_oraCmd.ExecuteReader();
                        if (dr.Read())
                        {
                            this.textBox1.Text = dr.GetValue(0).ToString();
                            this.textBox5.Text = dr.GetValue(2).ToString();
                            this.textBox7.Text = dr.GetValue(1).ToString();
                            this.textBox2.Text = dr.GetValue(4).ToString();
                            this.textBox3.Text = dr.GetValue(3).ToString();
                            this.textBox4.Text = dr.GetValue(7).ToString();
                            this.textBox6.Text = dr.GetValue(6).ToString();
                            this.richTextBox1.Text = dr.GetValue(5).ToString();

                            this.textBox9.Text = dr.GetValue(6).ToString();
                            this.textBox10.Text = dr.GetValue(9).ToString();
                            this.textBox8.Text = dr.GetValue(11).ToString();
                            this.textBox13.Text = dr.GetValue(12).ToString();
                            this.textBox12.Text = dr.GetValue(13).ToString();
                            //this.m_selectNode = e.Node.Text;
                        }
                        else
                        {
                            this.textBox1.Text = "";
                            this.textBox5.Text = "";
                            this.textBox7.Text = "";
                            this.textBox2.Text = "";
                            this.textBox3.Text = "";
                            this.textBox4.Text = "";
                            this.textBox6.Text = "";
                            this.richTextBox1.Text = "";

                            this.textBox9.Text = "";
                            this.textBox10.Text = "";
                            this.textBox8.Text = "";
                            this.textBox13.Text = "";
                            this.textBox12.Text = "";
                            //this.m_selectNode = "";
                        }
                    }
                    break;

            }
        }
예제 #2
0
        private void explorerBar1_ItemClick(object sender, Janus.Windows.ExplorerBar.ItemEventArgs e)
        {
            switch (e.Item.Text.ToString())
            {
            case "修改":
                if (this.m_selectNode == "")
                {
                    MessageBox.Show("请先选择数据!");
                    return;
                }
                this.m_isEdit = true;
                this.richTextBox1.ReadOnly = false;
                this.textBox3.ReadOnly     = false;
                this.textBox6.ReadOnly     = false;
                this.textBox4.ReadOnly     = false;
                this.textBox9.ReadOnly     = false;
                this.textBox10.ReadOnly    = false;
                this.textBox8.ReadOnly     = false;
                this.textBox13.ReadOnly    = false;
                this.textBox12.ReadOnly    = false;

                this.richTextBox1.BackColor = Color.White;
                this.textBox3.BackColor     = Color.White;
                this.textBox6.BackColor     = Color.White;
                this.textBox4.BackColor     = Color.White;
                this.textBox9.BackColor     = Color.White;
                this.textBox10.BackColor    = Color.White;
                this.textBox8.BackColor     = Color.White;
                this.textBox13.BackColor    = Color.White;
                this.textBox12.BackColor    = Color.White;

                for (int i = 0; i < m_labelActive.Count; i++)
                {
                    m_textBoxActive[i].ReadOnly  = false;
                    m_textBoxActive[i].BackColor = Color.White;
                }
                break;

            case "保存":
                if (this.m_selectNode == "")
                {
                    MessageBox.Show("请先选择数据!");
                    return;
                }
                if (this.m_isEdit == false)
                {
                    MessageBox.Show("请先修改数据!");
                    return;
                }
                this.richTextBox1.ReadOnly = true;
                this.textBox3.ReadOnly     = true;
                this.textBox6.ReadOnly     = true;
                this.textBox4.ReadOnly     = true;
                this.textBox9.ReadOnly     = true;
                this.textBox10.ReadOnly    = true;
                this.textBox8.ReadOnly     = true;
                this.textBox13.ReadOnly    = true;
                this.textBox12.ReadOnly    = true;

                this.richTextBox1.BackColor = Color.AliceBlue;
                this.textBox3.BackColor     = Color.AliceBlue;
                this.textBox6.BackColor     = Color.AliceBlue;
                this.textBox4.BackColor     = Color.AliceBlue;
                this.textBox9.BackColor     = Color.AliceBlue;
                this.textBox10.BackColor    = Color.AliceBlue;
                this.textBox8.BackColor     = Color.AliceBlue;
                this.textBox13.BackColor    = Color.AliceBlue;
                this.textBox12.BackColor    = Color.AliceBlue;

                for (int i = 0; i < m_labelActive.Count; i++)
                {
                    m_textBoxActive[i].ReadOnly  = false;
                    m_textBoxActive[i].BackColor = Color.AliceBlue;
                }

                string sqlText = "update SHEETMETADATA set SOURCEFORMAT='" + textBox3.Text + "'," + "DESCRIPTION='" + richTextBox1.Text + "'," + "ALIANAME='" + textBox6.Text + "'," + "SOURCE='" + textBox4.Text + "'," + "HEIGHTDATUM='" + textBox10.Text + "'," + "SHEETNO='" + textBox9.Text + "'," + "COOR='" + textBox8.Text + "'," + "SCALE='" + textBox13.Text + "'," + "EDITER='" + textBox12.Text + "' where NAME='" + textBox1.Text + "'";
                m_oraCmd.CommandText = sqlText;
                m_oraCmd.ExecuteNonQuery();
                if (this.m_labelActive.Count > 0)
                {
                    sqlText = "update CUSTOMMETADATA set ";
                    for (int i = 0; i < this.m_customField.Count; i++)
                    {
                        if (i != this.m_customField.Count - 1)
                        {
                            sqlText += this.m_customField[i].ToString() + "='" + this.m_textBoxActive[i].Text.Trim().ToString() + "',";
                        }
                        else
                        {
                            sqlText += this.m_customField[i].ToString() + "='" + this.m_textBoxActive[i].Text.Trim().ToString() + "'";
                        }
                    }
                    sqlText += " where NAME='" + textBox1.Text + "'";
                    m_oraCmd.CommandText = sqlText;
                    m_oraCmd.ExecuteNonQuery();
                }
                this.m_isEdit = false;
                MessageBox.Show("更新成功!");

                break;

            case "按名称":
                frmSearchByName frmSearch = new frmSearchByName();
                frmSearch.ShowDialog();
                string name = frmSearch.Name;
                if (name != "")
                {
                    sqlText = "select *from SHEETMETADATA where NAME='" + name + "'";
                    m_oraCmd.CommandText = sqlText;
                    OracleDataReader dr = m_oraCmd.ExecuteReader();
                    if (dr.Read())
                    {
                        this.textBox1.Text     = dr.GetValue(0).ToString();
                        this.textBox5.Text     = dr.GetValue(2).ToString();
                        this.textBox7.Text     = dr.GetValue(1).ToString();
                        this.textBox2.Text     = dr.GetValue(4).ToString();
                        this.textBox3.Text     = dr.GetValue(3).ToString();
                        this.textBox4.Text     = dr.GetValue(7).ToString();
                        this.textBox6.Text     = dr.GetValue(6).ToString();
                        this.richTextBox1.Text = dr.GetValue(5).ToString();

                        this.textBox9.Text  = dr.GetValue(6).ToString();
                        this.textBox10.Text = dr.GetValue(9).ToString();
                        this.textBox8.Text  = dr.GetValue(11).ToString();
                        this.textBox13.Text = dr.GetValue(12).ToString();
                        this.textBox12.Text = dr.GetValue(13).ToString();
                        //this.m_selectNode = e.Node.Text;
                    }
                    else
                    {
                        this.textBox1.Text     = "";
                        this.textBox5.Text     = "";
                        this.textBox7.Text     = "";
                        this.textBox2.Text     = "";
                        this.textBox3.Text     = "";
                        this.textBox4.Text     = "";
                        this.textBox6.Text     = "";
                        this.richTextBox1.Text = "";

                        this.textBox9.Text  = "";
                        this.textBox10.Text = "";
                        this.textBox8.Text  = "";
                        this.textBox13.Text = "";
                        this.textBox12.Text = "";
                        //this.m_selectNode = "";
                    }
                }
                break;
            }
        }