private void SetExistComponent() { TZ.CompExtention.ComponentBuilder cb = new CompExtention.ComponentBuilder(connection); cm = new CompExtention.ComponentManager(ClientID, SelectedTable, new TZ.CompExtention.DataAccess.ComponentDataHandler(connection)); cm.LoadAttributes(); if (cm.Component.Attributes.Count == 0) { cm.Component.Attributes = cb.GetTableFields(SelectedTable, ClientID); } else if (cm.Component.Attributes.Count > 0) { var TableAtt = cb.GetTableFields(SelectedTable, ClientID); foreach (CompExtention.Attribute a in TableAtt) { var tAtt = cm.Component.Attributes.Where(x => x.Name == a.Name).FirstOrDefault(); if (tAtt == null) { cm.Component.Attributes.Add(a); } } } cmbType.SelectedItem = CompType.Where(x => x.Key == (int)cm.Component.Type).FirstOrDefault(); component = (CompExtention.Component)cm.Component; bindAttributeList(); }
public void Render() { CompType = new Dictionary <int, string>(); int index = 0; foreach (string i in componentType) { CompType.Add(index, i); index = index + 1; } //component = new CompExtention.Component(); // TZ.CompExtention.Shared.ExecuteSetup(" Server=183.82.34.174;Initial Catalog=talentozdev;Uid=admin;Pwd=admin312"); TZ.CompExtention.ComponentBuilder cb = new CompExtention.ComponentBuilder(connection); CompWithTableList = cb.GetTableAsComponent(); bindList(CompWithTableList); // bindClients(); bindAttributeType(); //bindLookup(); bindComponentList(); cmbLookUp.Enabled = false; bindComponentCombo(); bindComponentType(); gbField.Enabled = true; gbAttributes.Enabled = true; }
private void SetComponentAndAttribute() { var ecomp = CompWithTableList.Where(x => x.TableName == SelectedTable).FirstOrDefault(); TZ.CompExtention.ComponentBuilder cb = new CompExtention.ComponentBuilder(connection); if (ecomp.Type != CompExtention.ComponentType.none) { txtComponentName.Text = ecomp.Name; txtEntityKey.Text = ecomp.EntityKey; lblMsg.Text = "This table already created as component"; // Get Existing Component For that table SetExistComponent(); } else { cm = new CompExtention.ComponentManager(); cm.Set(new TZ.CompExtention.DataAccess.ComponentDataHandler(connection)); cm.NewComponent(ClientID, lstTableList.SelectedItems[0].Text, (CompExtention.ComponentType)((KeyValuePair <int, string>)cmbType.SelectedItem).Key); component = (CompExtention.Component)cm.Component; component.TableName = lstTableList.SelectedItems[0].Text; txtComponentName.Text = lstTableList.SelectedItems[0].Text; txtEntityKey.Text = ""; lblMsg.Text = ""; component.Attributes = cb.GetTableFields(SelectedTable, ClientID); bindAttributeList(); } }