Esempio n. 1
0
        private void btnChangeExtendAttribute_Click(object sender, EventArgs e)
        {
            List <string> columnNameList = new List <string>();

            foreach (ListViewItem item in this.lstFields.Items)
            {
                columnNameList.Add(item.Text);
            }

            foreach (ListViewItem item in this.lstExtendAttribute.Items)
            {
                columnNameList.Add(item.Text);
            }

            if (this.lstExtendAttribute.SelectedItems.Count > 0)
            {
                ListViewItem editItem    = this.lstExtendAttribute.SelectedItems[0];
                string       oldAttrName = editItem.Text;
                columnNameList.Remove(oldAttrName);

                FieldExtendFrm frm = new FieldExtendFrm(columnNameList, editItem.Text, editItem.Tag as ExtendAttributeInfo);
                frm.ShowDialog();
                if (frm.IsAddSuccess)
                {
                    this.lstExtendAttribute.SelectedItems[0].Tag = frm.ExtendInfo;
                    editItem.Text             = frm.ExtendInfo.NewAttName;
                    editItem.SubItems[1].Text = frm.ExtendInfo.Comment;
                    PageCache.ChangeExtendInfo(oldAttrName, frm.ExtendInfo);
                }
            }
        }
Esempio n. 2
0
        private void btnAddExtendAttribute_Click(object sender, EventArgs e)
        {
            List <string> columnNameList = new List <string>();

            foreach (ListViewItem item in this.lstFields.Items)
            {
                columnNameList.Add(item.Text);
            }

            foreach (ListViewItem item in this.lstExtendAttribute.Items)
            {
                columnNameList.Add(item.Text);
            }

            if (this.lstFields.SelectedItems.Count > 0)
            {
                string         fieldsStr   = this.lstFields.SelectedItems[0].Text;
                string         fieldDbType = (this.lstFields.SelectedItems[0].Tag as SqlColumnInfo).DbType;
                string         commentStr  = this.lstFields.SelectedItems[0].SubItems[1].Text;
                FieldExtendFrm frm         = new FieldExtendFrm(columnNameList, fieldsStr, fieldDbType, commentStr);
                frm.ShowDialog();
                if (frm.IsAddSuccess)
                {
                    ListViewItem item = new ListViewItem(frm.ExtendInfo.NewAttName);
                    item.Tag = frm.ExtendInfo;
                    item.SubItems.AddRange(new string[] { frm.ExtendInfo.Comment, frm.ExtendInfo.AttributeType });
                    this.lstExtendAttribute.Items.Add(item);

                    PageCache.AddAttribute(frm.ExtendInfo);
                }
            }
        }