Ejemplo n.º 1
0
        public AddVirtualField(string tablename, ModelEdit parent, paraMetaInfo param)
        {
            InitializeComponent();
            TableName_comboBox.Left = edit_TableName.Left;
            TableName_comboBox.Top = edit_TableName.Top;
            FieldName_comboBox.Left = edit_FieldName.Left;
            FieldName_comboBox.Top = edit_FieldName.Top;

            m_parent = parent;
            m_paramMetaInfo = param;
            
            if (param.m_nFieldType != 1)
            {
                TableName_comboBox.Visible = false;
                TableName_comboBox.Enabled = false;
                edit_TableName.Visible = true;
                edit_TableName.Enabled = false;
                edit_TableName.Text = tablename;
                FieldName_comboBox.Visible = true;
                FieldName_comboBox.Enabled = true;
                edit_FieldName.Visible = false;
                edit_FieldName.Enabled = false;
                FieldName_comboBox.Items.Clear();

                //DataTable table = m_parent.QueryData("SELECT * FROM " + tablename);
                DataTable table = Helper.GetDataTableProxy(tablename, m_parent.m_conn);

                FieldName_comboBox.Items.Clear();
                for (int i = 0; i < table.Columns.Count; i++)
                {
                    string strColumnName = table.Columns[i].ColumnName;
                    FieldName_comboBox.Items.AddRange(new object[] { strColumnName });
                }
                // 设置光标位置
                FieldName_comboBox.Select();
            }
            else
            {
                TableName_comboBox.Visible = true;
                TableName_comboBox.Enabled = true;
                edit_TableName.Visible = false;
                edit_TableName.Enabled = false;
                FieldName_comboBox.Visible = false;
                FieldName_comboBox.Enabled = false;
                edit_FieldName.Visible = true;
                edit_FieldName.Enabled = true;
                FieldName_comboBox.Items.Clear();
                
                //DataTable table = m_parent.QueryData("SELECT name FROM sysobjects WHERE xtype = 'u' order by name asc");
                DataTable table = Helper.GetDataTableProxy("sysobjects", "xtype = 'u'", "name asc", m_parent.m_conn);
                foreach (DataRow row in table.Rows)
                {
                    TableName_comboBox.Items.Add(row["name"].ToString().Trim());
                }
                // 设置光标位置
                TableName_comboBox.Select();
            }
        }
Ejemplo n.º 2
0
        public AddVirtualField(string tablename, ModelEdit parent, paraMetaInfo param)
        {
            InitializeComponent();
            TableName_comboBox.Left = edit_TableName.Left;
            TableName_comboBox.Top  = edit_TableName.Top;
            FieldName_comboBox.Left = edit_FieldName.Left;
            FieldName_comboBox.Top  = edit_FieldName.Top;

            m_parent        = parent;
            m_paramMetaInfo = param;

            if (param.m_nFieldType != 1)
            {
                TableName_comboBox.Visible = false;
                TableName_comboBox.Enabled = false;
                edit_TableName.Visible     = true;
                edit_TableName.Enabled     = false;
                edit_TableName.Text        = tablename;
                FieldName_comboBox.Visible = true;
                FieldName_comboBox.Enabled = true;
                edit_FieldName.Visible     = false;
                edit_FieldName.Enabled     = false;
                FieldName_comboBox.Items.Clear();

                //DataTable table = m_parent.QueryData("SELECT * FROM " + tablename);
                DataTable table = Helper.GetDataTableProxy(tablename, m_parent.m_conn);

                FieldName_comboBox.Items.Clear();
                for (int i = 0; i < table.Columns.Count; i++)
                {
                    string strColumnName = table.Columns[i].ColumnName;
                    FieldName_comboBox.Items.AddRange(new object[] { strColumnName });
                }
                // 设置光标位置
                FieldName_comboBox.Select();
            }
            else
            {
                TableName_comboBox.Visible = true;
                TableName_comboBox.Enabled = true;
                edit_TableName.Visible     = false;
                edit_TableName.Enabled     = false;
                FieldName_comboBox.Visible = false;
                FieldName_comboBox.Enabled = false;
                edit_FieldName.Visible     = true;
                edit_FieldName.Enabled     = true;
                FieldName_comboBox.Items.Clear();

                //DataTable table = m_parent.QueryData("SELECT name FROM sysobjects WHERE xtype = 'u' order by name asc");
                DataTable table = Helper.GetDataTableProxy("sysobjects", "xtype = 'u'", "name asc", m_parent.m_conn);
                foreach (DataRow row in table.Rows)
                {
                    TableName_comboBox.Items.Add(row["name"].ToString().Trim());
                }
                // 设置光标位置
                TableName_comboBox.Select();
            }
        }
Ejemplo n.º 3
0
 public addField(string tbl_name, string type, MetainfoEditorForm parent, paraMetaInfo param)
 {
     InitializeComponent();
     m_parent            = parent;
     m_paramMetaInfo     = param;
     edit_TableName.Text = tbl_name;
     m_adp = new SqlDataAdapter("SELECT * FROM " + edit_TableName.Text, m_parent.m_conn);
     combo_DataType.Items.AddRange(new object[] { "文本",
                                                  "浮点数" });
     switch (type)
     {
     default:
         combo_DataType.Text = "文本";
         break;
     }
 }
Ejemplo n.º 4
0
 public addField(string tbl_name, string type, MetainfoEditorForm parent, paraMetaInfo param)
 {
     InitializeComponent();          
     m_parent = parent;
     m_paramMetaInfo = param;
     edit_TableName.Text = tbl_name;
     m_adp = new SqlDataAdapter("SELECT * FROM " + edit_TableName.Text, m_parent.m_conn);
     combo_DataType.Items.AddRange(new object[] { "文本",
                                                  "浮点数"
                                                });
     switch (type)
     {
         default:
             combo_DataType.Text = "文本";
             break;
     }
 }
Ejemplo n.º 5
0
        private void addField_button_Click(object sender, EventArgs e)
        {
            paraMetaInfo param = new paraMetaInfo();

            param.m_strEditType    = EditorTypeEn[editortype_comboBox.SelectedIndex];
            param.m_strFieldNameCN = fieldcnnametxt.Text.Trim();
            param.m_strCatName     = catname_comboBox.Text.Trim();
            param.m_strDescription = descriptiontxt.Text.Trim();
            param.m_bVisible       = visible_checkBox.Checked;
            param.m_bReadOnly      = readonly_checkBox.Checked;
            switch (EditorTypeEn[editortype_comboBox.SelectedIndex])
            {
            case "filename":
                param.m_strRelativePath = txtBoxRelativePath.Text.Trim();
                break;

            case "lookupcombo":
                param.m_strListTable = listtable_comboBox.Text.Trim();
                param.m_strKeyField  = keyfield_comboBox.Text.Trim();
                param.m_strListField = listfield_comboBox.Text.Trim();
                param.m_strCondition = listconditiontxt.Text.Trim();
                break;

            case "textcombo":
                param.m_strTextCombo = txtBoxListValues.Text.Trim();
                break;

            default:
                break;
            }

            addField     form   = new addField(tablename_comboBox.Text, editortype_comboBox.Text, this, param);
            DialogResult result = form.ShowDialog();

            if (result == DialogResult.OK)
            {
                RefreshFieldname_ListBox();
                DataGridViewShow();
            }
        }
Ejemplo n.º 6
0
        private void addField_button_Click(object sender, EventArgs e)
        {
            paraMetaInfo param = new paraMetaInfo();
            param.m_strEditType = EditorTypeEn[editortype_comboBox.SelectedIndex];
            param.m_strFieldNameCN = fieldcnnametxt.Text.Trim();
            param.m_strCatName = catname_comboBox.Text.Trim();
            param.m_strDescription = descriptiontxt.Text.Trim();
            param.m_bVisible = visible_checkBox.Checked;
            param.m_bReadOnly = readonly_checkBox.Checked;
            switch (EditorTypeEn[editortype_comboBox.SelectedIndex])
            {
                case "filename":
                    param.m_strRelativePath = txtBoxRelativePath.Text.Trim();
                    break;
                case "lookupcombo":
                    param.m_strListTable = listtable_comboBox.Text.Trim();
                    param.m_strKeyField = keyfield_comboBox.Text.Trim();
                    param.m_strListField = listfield_comboBox.Text.Trim();
                    param.m_strCondition = listconditiontxt.Text.Trim();
                    break;
                case "textcombo":
                    param.m_strTextCombo = txtBoxListValues.Text.Trim();
                    break;
                default:
                    break;
            }

            addField form = new addField(tablename_comboBox.Text, editortype_comboBox.Text, this, param);
            DialogResult result = form.ShowDialog();
            if (result == DialogResult.OK)
            {
                RefreshFieldname_ListBox();
                DataGridViewShow();
            }
        }
Ejemplo n.º 7
0
        // 子字段那层的新建虚拟字段按钮
        private void CreateVirtualField2_buttom_Click(object sender, EventArgs e)
        {
            if (treeView.SelectedNode != null)
            {
                if (treeView.SelectedNode.Level <= 2)
                    return;
                int nFieldID = (int)treeView.SelectedNode.Tag;
                DataRow row = m_DicMetaInfoTable.Rows.Find(new object[] { nFieldID });
                if (row == null)
                    return;

                paraMetaInfo param = new paraMetaInfo();
                param.m_nFieldType = 1;
                param.m_nModTableID = (int)row["modtabid"];
                param.m_nParentField = (int)treeView.SelectedNode.Tag;
                param.m_DicMetaInfo = m_DicMetaInfoTable;
                AddVirtualField form = new AddVirtualField(null, this, param);
                DialogResult result = form.ShowDialog();
                if (result == DialogResult.OK)
                {
                    if (row["fieldtype"] != null && row["fieldtype"].ToString().Trim() != "2")
                    {
                        DataRow modRow = m_DicMetaInfoTable.Rows.Find(new object[] { nFieldID });
                        if (modRow["fieldtype"].ToString().Trim() == "1")
                            return;
                        modRow.BeginEdit();
                        modRow["fieldtype"] = 2;
                        modRow.EndEdit();
                        UpdateData("SELECT * FROM sys_meta_info", m_DicMetaInfoTable, UpdateType.MOD);
                    }
                }
            }
        }
Ejemplo n.º 8
0
        private void CreateSubAttib_buttom_Click(object sender, EventArgs e)
        {
            if (treeView.SelectedNode != null)
            {
                // 检查所选的叶子节点是否为虚拟字段
                DataRow row = m_DicMetaInfoTable.Rows.Find(new object[]{treeView.SelectedNode.Tag});
                if (row == null)
                    return;

                if ((int)row["fieldtype"] != 1)
                    return;

                // 设置parentid, 
                paraMetaInfo param = new paraMetaInfo();

                param.m_nFieldType = 0;
                param.m_nModTableID = (int)row["modtabid"];
                param.m_nParentField = (int)treeView.SelectedNode.Tag;
                param.m_DicMetaInfo = m_DicMetaInfoTable;
                AddVirtualField form = new AddVirtualField(row["tablename"].ToString().Trim(), this, param);
                DialogResult result = form.ShowDialog();
            
            }
        }
Ejemplo n.º 9
0
        // 标签那层的新建虚拟字段按钮
        private void CreatVirtualField_buttom_Click(object sender, EventArgs e)
        {
            if (treeView.SelectedNode != null)
            {
                TreeNode tabNode = treeView.SelectedNode;
                string strTableName = tabNode.Tag.ToString().Trim();
                if (strTableName == "")
                {
                    MessageBox.Show("请先为标签指定主表!");
                    return;
                }

                // 标签页那层以下才能建虚拟字段
                if (treeView.SelectedNode.Level != 2)
                    return;

                DataRow row = m_ModelTabDefTable.Rows.Find(tabNode.Text.Trim());
                if (row == null)
                    return;
                
                paraMetaInfo param = new paraMetaInfo();
                param.m_nFieldType = 1;
                param.m_nModTableID = (int)row["modtabid"];
                param.m_DicMetaInfo = m_DicMetaInfoTable;
                AddVirtualField form = new AddVirtualField(null, this, param);
                form.ShowDialog();
            }
        }