コード例 #1
0
        private void DeleteDetail(string sDetailIndex)
        {
            if (tvComboDetail.SelectedNode == null)
            {
                return;
            }
            if (tvComboDetail.SelectedNode.Nodes.Count > 0)
            {
                MessageBox.Show("该节点有子节点,不允许删除");
                return;
            }

            string sComboValue = tvComboDetail.SelectedNode.Text.ToString();

            if (tvComboName.SelectedNode != null)
            {
                if (DoValidData(sDetailIndex, sComboValue) == true)
                {
                    MessageBox.Show("该数据已被使用,禁止删除!", "提示");
                    return;
                }
                else if (DoValidData(sDetailIndex, sComboValue) == false)
                {
                    sDetailIndex = tvComboDetail.SelectedNode.Tag.ToString();
                    if (SQLDBBase.ExecuteSql("delete from ComboDataDetail where DetailIndex =" + sDetailIndex) > 1)
                    {
                        tvComboDetail.Nodes.Remove(tvComboDetail.SelectedNode);
                    }
                    DoRefreshDetail();
                }
            }
        }
コード例 #2
0
        private void tvComboName_AfterLabelEdit(object sender, NodeLabelEditEventArgs e)
        {
            tvComboName.LabelEdit = false;
            string sComboIndex = tvComboName.SelectedNode.Tag.ToString();
            string sComboName  = e.Label;

            SQLDBBase.ExecuteSql(" update ComboData set ComboName ='" + sComboName + "' where ComboDataIndex ='" + sComboIndex + "'");
        }
コード例 #3
0
        private void ChangeDropType()
        {
            if (tvComboName.SelectedNode != null)
            {
                string sComboIndex = tvComboName.SelectedNode.Tag.ToString();
                string sComboType  = "-2";
                string ssComboType = "";

                DataTable dtCombo     = SQLDBBase.ExecuteDataTable("select * from ComboData where comboDataIndex = '" + sComboIndex + "'");
                string    ssComboName = dtCombo.Rows[0]["ComboName"].ToString();//为了实时刷新显示类型
                sComboType = dtCombo.Rows[0]["ComboType"].ToString();

                //重选类型后刷新下拉框名表内信息
                if (sComboType == "-1")
                {
                    ssComboType = "";
                }
                else if (sComboType == "0")
                {
                    ssComboType = " (单选)";
                }
                else if (sComboType == "1")
                {
                    ssComboType = " (多选)";
                }

                if (rbSing.Checked)
                {
                    sComboType = "0";
                    tvComboName.SelectedNode.Text = ssComboName + ssComboType;
                }
                else if (rbMult.Checked)
                {
                    sComboType = "1";
                    tvComboName.SelectedNode.Text = ssComboName + ssComboType;
                }

                if (sComboType != null)
                {
                    SQLDBBase.ExecuteSql("update ComboData set ComboType = '" + sComboType + "'where ComboDataIndex = '" + sComboIndex + "'");
                }
            }
        }