Ejemplo n.º 1
0
 private void btnNewField_Click(object sender, EventArgs e)
 {
     System.Windows.Forms.TreeNode Node = tvRelation.SelectedNode;
     if (Node != null)
     {
         TDetailItem DetailItem = (TDetailItem)Node.Tag;
         MWizard.fmSelTableField F = new fmSelTableField();
         if (F.ShowSelTableFieldForm(DetailItem, GetFieldNames, lvSelectedFields, InternalConnection, RearrangeRefValButton, btnRefVal_Click, FClientData.DatabaseType))
         {
             btnDeleteField.Enabled = lvSelectedFields.Items.Count > 0;
         }
     }
 }
Ejemplo n.º 2
0
 private void btnAddField_Click(object sender, EventArgs e)
 {
     TreeNode Node = tvContainer.SelectedNode;
     if (Node != null)
     {
         TNodeObject NodeObject = (TNodeObject)Node.Tag;
         fmSelTableField F = new fmSelTableField();
         if (F.ShowSelTableFieldForm(NodeObject.BlockItem, GetFieldNames, lvSelectedFields, InternalConnection, RearrangeRefValButton, btnRefVal_Click, FClientData.DatabaseType))
         {
             btnDeleteField.Enabled = lvSelectedFields.Items.Count > 0;
         }
     }
 }
Ejemplo n.º 3
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            TreeNode Node = tvTables.SelectedNode;
            string TableName = "";
            MWizard.fmSelTableField F;

            if (Node != null)
                TableName = Node.Text;
            F = new fmSelTableField();
            if (F.ShowSelTableFieldForm(FServerData, FServerData.DatabaseName, ref TableName, InternalConnection))
            {
                Node = tvTables.Nodes.Add(TableName);
                Node.Name = TableName;
                AddDatasetNode(Node);
                tvTables.SelectedNode = Node;

                String sQL = "select * from " + WzdUtils.Quote(TableName, GlobalConnection) + " where 1=0";
                IDbCommand cmd = GlobalConnection.CreateCommand();
                cmd.CommandText = sQL;
                if (GlobalConnection.State == ConnectionState.Closed)
                { GlobalConnection.Open(); }

                DataSet schemaTable = new DataSet();
                IDbDataAdapter ida = WzdUtils.AllocateDataAdapter(FServerData.DatabaseType);
                ida.SelectCommand = cmd;
                ida.MissingSchemaAction = MissingSchemaAction.AddWithKey;
                ida.Fill(schemaTable);

                lvSelectedFields.Items.Clear();
                TDatasetItem tdsItem = null;
                foreach (TDatasetItem item in FServerData.Datasets)
                {
                    if (item.TableName == Node.Text)
                    {
                        tdsItem = item;
                        break;
                    }
                }

                foreach (DataColumn DR in schemaTable.Tables[0].Columns)
                {
                    lvSelectedFields.Items.Add(DR.ColumnName);
                    TFieldAttrItem Item = new TFieldAttrItem();
                    tdsItem.FieldAttrItems.Add(Item);
                    Item.DataField = lvSelectedFields.Items[lvSelectedFields.Items.Count - 1].Text;
                    if (lvSelectedFields.Items[lvSelectedFields.Items.Count - 1].SubItems.Count > 1)
                    {
                        if (tdsItem.FieldCaptionList.Count > 0)
                        {
                            Item.Description = tdsItem.FieldCaptionList.Values(Item.DataField);
                        }
                        else
                        {
                            Item.Description = lvSelectedFields.Items[lvSelectedFields.Items.Count - 1].SubItems[1].Text;
                        }
                    }
                    else
                    {
                        if (tdsItem.FieldCaptionList.Count > 0)
                        {
                            Item.Description = tdsItem.FieldCaptionList.Values(Item.DataField);
                            //lvSelectedFields.Items[lvSelectedFields.Items.Count - 1].SubItems.Add(tdsItem.FieldCaptionList.Values(Item.DataField));
                        }
                    }
                    if (!String.IsNullOrEmpty(Item.Description))
                        lvSelectedFields.Items[lvSelectedFields.Items.Count - 1].SubItems.Add(Item.Description);
                    lvSelectedFields.Items[lvSelectedFields.Items.Count - 1].Tag = Item;
                }

                foreach (DataColumn DR in schemaTable.Tables[0].PrimaryKey)
                {
                    for (int I = 0; I < lvSelectedFields.Items.Count; I++)
                    {
                        if (lvSelectedFields.Items[I].Text == DR.ColumnName)
                        {
                            TFieldAttrItem fi = (TFieldAttrItem)lvSelectedFields.Items[I].Tag;
                            fi.IsKey = true;
                        }
                    }
                }

                Node.Tag = tdsItem;
                if (lvSelectedFields.Items.Count > 0)
                {
                    lvSelectedFields.Items[0].Selected = true;
                }

                btnDeleteField.Enabled = lvSelectedFields.Items.Count > 0;
            }
        }
Ejemplo n.º 4
0
        private void btnNewField_Click(object sender, EventArgs e)
        {
            if (radioButtonEntity.Checked)
            {
                System.Windows.Forms.TreeNode Node = tvRelation.SelectedNode;
                if (Node != null)
                {
                    TWCFDetailItem DetailItem = (TWCFDetailItem)Node.Tag;
                    MWizard.fmSelWCFTableField F = new fmSelWCFTableField();
                    //COLDEF
                    List<COLDEFInfo> colDefObjects = null;

                    colDefObjects = WzdUtils.GetColumnDefination(FClientData.AssemblyName, FClientData.CommandName, DetailItem.EntityName, cbEEPAlias.Text);

                    if (F.ShowSelTableFieldForm(DetailItem, lvSelectedFields, RearrangeRefValButton, btnRefVal_Click, colDefObjects, FClientData.AssemblyName, FClientData.CommandName))
                    {
                        btnDeleteField.Enabled = lvSelectedFields.Items.Count > 0;
                    }
                }
            }
            else if (radioButtonInfoCommand.Checked)
            {
                System.Windows.Forms.TreeNode Node = tvRelation.SelectedNode;
                if (Node != null)
                {
                    TDetailItem DetailItem = (TDetailItem)Node.Tag;
                    MWizard.fmSelTableField F = new fmSelTableField();
                    if (F.ShowSelTableFieldForm(DetailItem, GetFieldNames, lvSelectedFields, InternalConnection, RearrangeRefValButton, btnRefVal_Click, FClientData.DatabaseType))
                    {
                        btnDeleteField.Enabled = lvSelectedFields.Items.Count > 0;
                    }
                }
            }
        }
Ejemplo n.º 5
0
        private void btnAddField_Click(object sender, EventArgs e)
        {
            TreeNode Node = tvTables.SelectedNode;
            if (Node != null)
            {
                TDatasetItem DatasetItem = (TDatasetItem)Node.Tag;
                MWizard.fmSelTableField F = new fmSelTableField();
                if (F.ShowSelTableFieldForm(DatasetItem, GetFieldNamesEx, lvSelectedFields, InternalConnection, FServerData.DatabaseType))
                {
                    btnDeleteField.Enabled = lvSelectedFields.Items.Count > 0;

                    String sQL = "select * from " + WzdUtils.Quote(DatasetItem.TableName, GlobalConnection) + " where 1=0";
                    IDbCommand cmd = GlobalConnection.CreateCommand();
                    cmd.CommandText = sQL;
                    if (GlobalConnection.State == ConnectionState.Closed)
                    { GlobalConnection.Open(); }

                    DataSet schemaTable = new DataSet();
                    IDbDataAdapter ida = WzdUtils.AllocateDataAdapter(DatasetItem.DatabaseType);
                    ida.SelectCommand = cmd;
                    ida.MissingSchemaAction = MissingSchemaAction.AddWithKey;
                    ida.Fill(schemaTable);

                    foreach (DataColumn DR in schemaTable.Tables[0].PrimaryKey)
                    {
                        for (int I = 0; I < lvSelectedFields.Items.Count; I++)
                        {
                            if (lvSelectedFields.Items[I].Text == DR.ColumnName)
                            {
                                TFieldAttrItem fi = (TFieldAttrItem)lvSelectedFields.Items[I].Tag;
                                fi.IsKey = true;
                                break;
                            }
                        }
                    }
                }
            }
        }