Example #1
0
 public bool ShowSelTableFieldForm(String pPath, String pName, String sName, ListView DestListView, TWCFDatasetItem DatasetItem)
 {
     FDatasetItem = DatasetItem;
     FDatasetItem.AddAll = false;
     FProjectPath = pPath;
     FProjectName = pName;
     FTableName = sName;
     FDestListView = DestListView;
     Init();
     return ShowDialog() == DialogResult.OK;
 }
Example #2
0
        private void CreateUpdateComponent(EFServerTools.EFCommand EFC, TWCFDatasetItem DatasetItem, int Index)
        {
            string TempName = DatasetItem.TableName;
            string ComponentName = CreateUniqueComponentName(FDataModule, "uc" + TempName);
            if (ComponentName.Contains("."))
            {
                ComponentName = ComponentName.Remove(0, ComponentName.IndexOf('.') + 1);
                ComponentName = "uc" + ComponentName;
            }
            EFServerTools.EFUpdateComponent UC = FDesignerHost.CreateComponent(typeof(EFServerTools.EFUpdateComponent), ComponentName) as EFServerTools.EFUpdateComponent;
            UC.Command = EFC;
            UC.Site.Name = "AA";
            int I;

            TFieldAttrItem FAI;
            EFServerTools.FieldItem FI;
            for (I = 0; I < DatasetItem.FieldAttrItems.Count; I++)
            {
                FAI = (TFieldAttrItem)DatasetItem.FieldAttrItems[I];
                FI = new EFServerTools.FieldItem();
                FI.FieldName = FAI.DataField;
                FI.CheckNull = FAI.CheckNull;
                UC.Fields.Add(FI);
            }
            UC.Site.Name = ComponentName;
        }
Example #3
0
        private Component CreateDataset(TWCFDatasetItem DatasetItem, int Index)
        {
            string TempName = WzdUtils.RemoveSpace(DatasetItem.TableName);
            string ComponentName = CreateUniqueComponentName(FDataModule, TempName);
            if (ComponentName.Contains("."))
                ComponentName = ComponentName.Remove(0, ComponentName.IndexOf('.') + 1);
            EFServerTools.EFCommand IC = FDesignerHost.CreateComponent(typeof(EFServerTools.EFCommand), ComponentName) as EFServerTools.EFCommand;

            EFServerTools.Design.MetadataProvider aMetadataProvider = new EFServerTools.Design.MetadataProvider(System.IO.Path.GetDirectoryName(GlobalProject.FullName), GlobalProject.Name);
            String strEntityTypeName = aMetadataProvider.GetEntitySetType(DatasetItem.ContainerName, DatasetItem.TableName);
            if (DatasetItem.ChildItem != null)
            {
                List<string> lNavgationPropertyNames = aMetadataProvider.GetNavgationPropertyNames(DatasetItem.ContainerName, strEntityTypeName);
                for (int i = 0; i < lNavgationPropertyNames.Count; i++)
                {
                    IncludeObject aFKey = new IncludeObject();
                    aFKey.ObjectName = lNavgationPropertyNames[i];
                    IC.ForeignKeyRelations.Add(aFKey);
                }
            }
            IC.CommandText = String.Format("Select value {0} from {1}.{2} as {0}",
                                            DatasetItem.TableName[0].ToString().ToLower(),
                                            DatasetItem.ContainerName,
                                            DatasetItem.TableName);
            IC.MetadataFile = GlobalProject.Name;
            DatasetItem.Command = IC;
            return IC;
        }
Example #4
0
 private void AddDatasetNode(TreeNode Node)
 {
     TWCFDatasetItem Item = new TWCFDatasetItem();
     Item.GenerateEntity = cbGenerateEntity.Text;
     FServerData.Datasets.Add(Item);
     Item.DatabaseName = FServerData.DatabaseName;
     Item.TableName = Node.Text;
     EFServerTools.Design.MetadataProvider aMetadataProvider = new EFServerTools.Design.MetadataProvider(System.IO.Path.GetDirectoryName(GlobalProject.FullName), GlobalProject.Name);
     List<String> lsContainerNames = aMetadataProvider.GetEntityContainerNames();
     if (lsContainerNames.Count > 0)
     {
         Item.ContainerName = lsContainerNames[0];
     }
     Node.Tag = Item;
     if (Node.Parent != null)
     {
         TWCFDatasetItem ParentItem = (TWCFDatasetItem)Node.Parent.Tag;
         ParentItem.ChildItem = Item;
         Item.ParentItem = ParentItem;
     }
 }
Example #5
0
 private void UpdatelvSelectedFields(TWCFDatasetItem DatasetItem)
 {
     //cbIsRelationKey.Checked = false;
     lvSelectedFields.Items.Clear();
     if (DatasetItem != null)
     {
         lvSelectedFields.BeginUpdate();
         for (int num1 = 0; num1 < DatasetItem.FieldAttrItems.Count; num1++)
         {
             TFieldAttrItem item1 = DatasetItem.FieldAttrItems[num1] as TFieldAttrItem;
             ListViewItem item2 = lvSelectedFields.Items.Add(item1.DataField);
             item2.SubItems.Add(item1.Description);
             item2.Tag = item1;
         }
         lvSelectedFields.EndUpdate();
         btnDeleteField.Enabled = lvSelectedFields.Items.Count > 0;
         cbGenerateEntity.Text = DatasetItem.GenerateEntity;
     }
 }