protected override void DoNew <Root>(SchemaList <Constraint, Root> CamposOrigen, Constraint node) { Constraint newNode = (Constraint)node.Clone(CamposOrigen.Parent); newNode.Status = Enums.ObjectStatusType.CreateStatus; CamposOrigen.Add(newNode); }
protected override void DoNew <Root>(SchemaList <FileGroup, Root> originFields, FileGroup node) { FileGroup newNode = (FileGroup)node.Clone(originFields.Parent); newNode.Status = Enums.ObjectStatusType.CreateStatus; /*If the Logical File Name exists in another filegroup, * we must change the new Logical File Name. */ originFields.ForEach(file => { if (file.Status != Enums.ObjectStatusType.DropStatus) { file.Files.ForEach(group => { newNode.Files.ForEach(ngroup => { if (group.CompareFullNameTo(group.FullName, ngroup.FullName) == 0) { newNode.Files[ngroup.FullName].Name = group.Name + "_2"; } }); }); } }); originFields.Add(newNode); }
protected override void DoNew <Root>(SchemaList <TableOption, Root> originFields, TableOption node) { TableOption newNode = (TableOption)node.Clone(originFields.Parent); newNode.Status = ObjectStatus.Create; originFields.Add(newNode); }
protected override void DoNew <Root>(SchemaList <Trigger, Root> CamposOrigen, Trigger node) { Trigger newNode = (Trigger)node.Clone(CamposOrigen.Parent); newNode.Status = Enums.ObjectStatusType.CreateStatus; CamposOrigen.Add(newNode); }
protected override void DoNew <Root>(SchemaList <Trigger, Root> originFields, Trigger node) { Trigger newNode = (Trigger)node.Clone(originFields.Parent); newNode.Status = ObjectStatus.Create; originFields.Add(newNode); }
protected override void DoNew <Root>(SchemaList <Index, Root> CamposOrigen, Index node) { Index newNode = (Index)node.Clone(CamposOrigen.Parent); newNode.Status = Enums.ObjectStatusType.CreateStatus; CamposOrigen.Add(newNode); }
protected virtual void DoNew <Root>(SchemaList <T, Root> originFields, T node) where Root : ISchemaBase { T newNode = node;//.Clone(originFields.Parent); newNode.Parent = originFields.Parent; newNode.Status = ObjectStatus.Create; originFields.Add(newNode); }
protected virtual void DoNew <Root>(SchemaList <T, Root> CamposOrigen, T node) where Root : ISchemaBase { T newNode = node;//.Clone(CamposOrigen.Parent); newNode.Parent = CamposOrigen.Parent; newNode.Status = Enums.ObjectStatusType.CreateStatus; CamposOrigen.Add(newNode); }
private static void BuildFields(DataSourceSchema schema) { DsAdapterCustomer dsa = new DsAdapterCustomer(schema); DataSet ds = dsa.getDataSet(); DataTable netTable = ds.Tables[0]; // schema.Fields.Clear(); SchemaList <FieldSchema> tmpFieldSchema = new SchemaList <FieldSchema>(); //da.FillSchema(netTable, SchemaType.Source); // schema.PrimaryKeys = new List<string>(); // foreach (DataColumn col in netTable.PrimaryKey) // { // schema.PrimaryKeys.Add(col.ColumnName); // } foreach (DataColumn col in netTable.Columns) { FieldSchema field = new FieldSchema(); field.Id = col.ColumnName; field.Title = col.Caption; if (col.ExtendedProperties.ContainsKey(DataSourceConst.ExProDescription)) { if (col.ExtendedProperties[DataSourceConst.ExProDescription] != null) { field.Description = col.ExtendedProperties[DataSourceConst.ExProDescription].ToString(); } } field.ReadOnly = col.ReadOnly; field.ReadOnly = col.AutoIncrement; if (netTable.PrimaryKey.Contains(col)) { field.IsKey = true; } if (col.ExtendedProperties.ContainsKey(DataSourceConst.ExProDbType)) { field.DataType = (DbType)col.ExtendedProperties[DataSourceConst.ExProDbType]; } else { field.DataType = DatabaseAdmin.getInstance().getDbType(col.DataType); } // schema.Fields.Add(field); if (schema.Fields.FindItem(field.Id) == null) { schema.Fields.Add(field); } if (tmpFieldSchema.FindItem(field.Id) == null) { tmpFieldSchema.Add(field); } } }
public override void InitUIVar() { f2 = new F2Window(this); GC_Main.DataSource = pOSXHBindingSource; MainControls.Add(XH001); MainControls.Add(XH002); MainControls.Add(XH003); MainControls.Add(XH004); KeyFieldMain = "XH001,XH002"; OrderFieldMain = "XH001,XH002"; NumberFieldMain.Fields = "XH004"; VisibleListMain.Add("XH001", 0); VisibleListMain.Add("XH002", 1); VisibleListMain.Add("XH003", 2); VisibleListMain.Add("XH004", 3); FieldWidthMain.Add("XH001", 80); FieldWidthMain.Add("XH002", 111); FieldWidthMain.Add("XH003", 178); FieldWidthMain.Add("XH004", 75); DS_RESAI07.POSXHDataTable dataTable = pOSXHTableAdapter.GetDataBy(""); if (dataTable != null) { for (int i = 0; i < dataTable.Columns.Count - 1; i++) { if (!dataTable.Columns[i].ColumnName.StartsWith("X")) { continue; } SchemaList.Add(dataTable.Columns[i].ColumnName + " " + dataTable.Columns[i].Caption); } } RepositoryItemTextEdit edit = new RepositoryItemTextEdit(); GV_Main.Columns["XH001"].ColumnEdit = edit; edit.DisplayFormat.FormatType = FormatType.Custom; edit.DisplayFormat.FormatString = "XH001"; edit.DisplayFormat.Format = new AI07Formatter(); XH001.Properties.DisplayMember = "Text"; XH001.Properties.ValueMember = "Value"; var items = new[] { new { Text = "1.口味", Value = "1" }, new { Text = "2.加料", Value = "2" } }; XH001.Properties.DataSource = items; base.InitUIVar(); }
protected override void DoNew <Root>(SchemaList <UserDataType, Root> CamposOrigen, UserDataType node) { UserDataType newNode = (UserDataType)node.Clone(CamposOrigen.Parent); newNode.Status = Enums.ObjectStatusType.CreateStatus; Boolean HasAssembly = CamposOrigen.Exists(item => item.AssemblyFullName.Equals(node.AssemblyFullName) && item.IsAssembly); if (HasAssembly) { newNode.Status += (int)Enums.ObjectStatusType.DropOlderStatus; } CamposOrigen.Add(newNode); }
protected override void DoNew <Root>(SchemaList <UserDataType, Root> originFields, UserDataType node) { UserDataType newNode = (UserDataType)node.Clone(originFields.Parent); newNode.Status = ObjectStatus.Create; Boolean HasAssembly = originFields.Exists(item => item.AssemblyFullName.Equals(node.AssemblyFullName) && item.IsAssembly); if (HasAssembly) { newNode.Status += (int)ObjectStatus.DropOlder; } originFields.Add(newNode); }
protected override void DoNew <Root>(SchemaList <Assembly, Root> CamposOrigen, Assembly node) { bool pass = true; Assembly newNode = (Assembly)node.Clone(CamposOrigen.Parent); if ((((Database)newNode.RootParent).Info.Version == DatabaseInfo.VersionNumber.SQLServer2005) && (((Database)node.RootParent).Info.Version == DatabaseInfo.VersionNumber.SQLServer2008)) { pass = node.FullName.Equals("Microsoft.SqlServer.Types"); } if (pass) { newNode.Status = Enums.ObjectStatusType.CreateStatus; CamposOrigen.Add(newNode); } }
public static void BuildSchemaDict() { _logger.Debug("Building an Schema List"); var rightsResult = Searcher.GetResultEntries(new LDAPSearchString { DN = Searcher.LdapInfo.SchemaDN, Filter = "(schemaIDGUID=*)", ReturnAttributes = new string[] { "schemaIDGUID", "cn" }, Scope = SearchScope.OneLevel, //UseGlobalCatalog = true }).ToList(); foreach (var rights in rightsResult) { string schemaGUID = Helper.GetStringFromByte((byte[])rights.Attributes["schemaIDGUID"][0]).ToLower(); SchemaList.Add(schemaGUID, rights.Attributes["cn"][0].ToString()); } SchemaList.Add("00000000-0000-0000-0000-000000000000", "All properties"); // Active Directory includes predefined property sets: // https://docs.microsoft.com/en-us/windows/desktop/adschema/property-sets var predefinedProp = new Dictionary <string, string>(); predefinedProp.Add("72e39547-7b18-11d1-adef-00c04fd8d5cd", "DNS Host Name Attributes"); predefinedProp.Add("b8119fd0-04f6-4762-ab7a-4986c76b3f9a", "Other Domain Parameters"); predefinedProp.Add("c7407360-20bf-11d0-a768-00aa006e0529", "Domain Password and Lockout Policies"); predefinedProp.Add("e45795b2-9455-11d1-aebd-0000f80367c1", "Phone and Mail Options"); predefinedProp.Add("59ba2f42-79a2-11d0-9020-00c04fc2d3cf", "General Information"); predefinedProp.Add("bc0ac240-79a9-11d0-9020-00c04fc2d4cf", "Group Membership"); predefinedProp.Add("ffa6f046-ca4b-4feb-b40d-04dfee722543", "MS-TS-GatewayAccess"); predefinedProp.Add("77b5b886-944a-11d1-aebd-0000f80367c1", "Personal Information"); predefinedProp.Add("91e647de-d96f-4b70-9557-d63ff4f3ccd8", "Private Information"); predefinedProp.Add("e48d0154-bcf8-11d1-8702-00c04fb96050", "Public Information"); predefinedProp.Add("5805bc62-bdc9-4428-a5e2-856a0f4c185e", "Terminal Server License Server"); predefinedProp.Add("4c164200-20c0-11d0-a768-00aa006e0529", "Account Restrictions"); predefinedProp.Add("5f202010-79a5-11d0-9020-00c04fc2d4cf", "Logon Information"); predefinedProp.Add("e45795b3-9455-11d1-aebd-0000f80367c1", "Web Information"); predefinedProp.Add("9b026da6-0d3c-465c-8bee-5199d7165cba", "DS-Validated-Write-Computer"); predefinedProp.Add("037088f8-0ae1-11d2-b422-00a0c968f939", "RAS-Information"); foreach (var prop in predefinedProp) { if (!SchemaList.ContainsKey(prop.Key)) { SchemaList.Add(prop.Key, prop.Value); } } }
protected override void DoNew <Root>(SchemaList <Assembly, Root> originFields, Assembly node) { bool pass = true; Assembly newNode = (Assembly)node.Clone(originFields.Parent); if ((((Database)newNode.RootParent).Info.Version == DatabaseInfo.VersionTypeEnum.SQLServer2005) && (((Database)node.RootParent).Info.Version == DatabaseInfo.VersionTypeEnum.SQLServer2008)) { pass = node.FullName.Equals("Microsoft.SqlServer.Types"); } if (pass) { newNode.Status = ObjectStatus.Create; originFields.Add(newNode); } }
/// <summary> /// Adds a schema to the schema collection. /// </summary> /// <remarks> /// The supplied schema will not be added if its target namespace is already in the list. This will help /// with some of the XBRL instance documents in the XBRL Conformance Suite which uses both the "schemaLocation" /// attribute as well as a "schemaRef" node to specify the same schema. The "301-01-IdScopeValid.xml" /// instance document in the XBRL-CONF-CR5-2012-01-24 suite is one such example. /// </remarks> /// <param name="schemaToAdd"> /// The schema to be added. /// </param> internal void Add(XbrlSchema schemaToAdd) { var targetNamespaceAlreadyInList = false; foreach (var currentSchema in SchemaList) { if (schemaToAdd.TargetNamespace.Equals(currentSchema.TargetNamespace) == true) { targetNamespaceAlreadyInList = true; } } if (targetNamespaceAlreadyInList == false) { SchemaList.Add(schemaToAdd); } }
public override void InitUIVar() { f2 = new F2Window(this); GC_Main.DataSource = qUEXABindingSource; MainControls.Add(XA001); MainControls.Add(XA002); MainControls.Add(XA003); MainControls.Add(XA006); MainControls.Add(XA004); MainControls.Add(XA005); KeyFieldMain = "XA001,XA002"; RequiredFieldMain = "XA003,XA004"; OrderFieldMain = "XA001,XA002"; CheckFieldMain.Fields = "XA006"; DateFieldMain.Fields = "XA003"; VisibleListMain.Add("XA001", 0); VisibleListMain.Add("XA001C", 1); VisibleListMain.Add("XA002", 2); VisibleListMain.Add("XA003", 3); VisibleListMain.Add("XA006", 4); VisibleListMain.Add("XA004", 5); VisibleListMain.Add("XA005", 6); DS_RESAQ01.QUEXADataTable dataTable = qUEXATableAdapter.GetDataBy(""); if (dataTable != null) { for (int i = 0; i < dataTable.Columns.Count - 1; i++) { if (!dataTable.Columns[i].ColumnName.StartsWith("X")) { continue; } SchemaList.Add(dataTable.Columns[i].ColumnName + " " + dataTable.Columns[i].Caption); } } XA001C.Text = ""; base.InitUIVar(); }
protected override void DoNew <Root>(SchemaList <Function, Root> originFields, Function node) { Function newNode = (Function)node.Clone(originFields.Parent); newNode.Status = Enums.ObjectStatusType.CreateStatus; originFields.Add(newNode); newNode.DependenciesIn.ForEach(dep => { ISchemaBase item = ((Database)((ISchemaBase)originFields.Parent)).Find(dep); if (item != null) { if (item.IsCodeType) { ((ICode)item).DependenciesOut.Add(newNode.FullName); } } } ); }
protected override void DoNew <Root>(SchemaList <View, Root> CamposOrigen, View node) { View newNode = (View)node.Clone(CamposOrigen.Parent); newNode.Status = Enums.ObjectStatusType.CreateStatus; CamposOrigen.Add(newNode); newNode.DependenciesIn.ForEach(dep => { ISchemaBase item = ((Database)((ISchemaBase)CamposOrigen.Parent)).Find(dep); if (item != null) { if (item.IsCodeType) { ((ICode)item).DependenciesOut.Add(newNode.FullName); } } } ); }
protected override void DoNew <Root>(SchemaList <View, Root> originFields, View node) { View newNode = (View)node.Clone(originFields.Parent); newNode.Status = ObjectStatus.Create; originFields.Add(newNode); newNode.DependenciesIn.ForEach(dep => { ISchemaBase item = ((Database)((ISchemaBase)originFields.Parent)).Find(dep); if (item != null) { if (item.IsCodeType) { ((ICode)item).DependenciesOut.Add(newNode.FullName); } } } ); }
public override void InitUIVar() { GC_Main.DataSource = pOSXMBindingSource; MainControls.Add(XM001); MainControls.Add(XM004); MainControls.Add(XM002); MainControls.Add(XM003); VisibleFieldMain = ""; KeyFieldMain = "XM001"; OrderFieldMain = "XM001"; RequiredFieldMain = "XM004,XM002,XM003"; PassWordFieldMain.Fields = "XM003"; VisibleListMain.Add("XM001", 0); VisibleListMain.Add("XM004", 1); VisibleListMain.Add("XM002", 2); VisibleListMain.Add("XM003", 3); FieldWidthMain.Add("XM001", 71); FieldWidthMain.Add("XM002", 341); FieldWidthMain.Add("XM003", 504); FieldWidthMain.Add("XM004", 87); DS_RESAI03.POSXMDataTable dataTable = pOSXMTableAdapter.GetDataBy(""); if (dataTable != null) { for (int i = 0; i < dataTable.Columns.Count - 1; i++) { if (!dataTable.Columns[i].ColumnName.StartsWith("XM")) { continue; } SchemaList.Add(dataTable.Columns[i].ColumnName + " " + dataTable.Columns[i].Caption); } } base.InitUIVar(); }
public override void InitUIVar() { TabControlMainHeight = 160; GC_Main.DataSource = pOSXIBindingSource; GC_Body.DataSource = pOSXLBindingSource; MainControls.Add(XI001); MainControls.Add(XI002); KeyFieldMain = "XI001"; KeyFieldBody = "XL002"; VisibleFieldBody = "XL001"; OrderFieldMain = "XI001"; OrderFieldBody = "XL001,XL002"; ReadOnlyFieldBody = "XL002"; RequiredFieldMain = "XI002"; FieldWidthMain.Add("XI001", 86); FieldWidthMain.Add("XI002", 255); FieldWidthBody.Add("XL001", 75); FieldWidthBody.Add("XL002", 86); FieldWidthBody.Add("XL003", 254); DS_RESAI05.POSXIDataTable dataTable = pOSXITableAdapter.GetDataBy(""); if (dataTable != null) { for (int i = 0; i < dataTable.Columns.Count; i++) { if (!dataTable.Columns[i].ColumnName.StartsWith("XI")) { continue; } SchemaList.Add(dataTable.Columns[i].ColumnName + " " + dataTable.Columns[i].Caption); } } SelectKeyMain = "XI001"; SelectKeyBody = "XL001"; base.InitUIVar(); }
/// <summary> /// processes the inbound message part /// </summary> /// <param name="pc"></param> /// <param name="inmsg"></param> /// <param name="outmsg"></param> /// <param name="part"></param> private void ProcessPart(IPipelineContext pc, IBaseMessage inmsg, IBaseMessage outmsg, IBaseMessagePart part) { IDocumentSpec docSpec = null; Stream dataStream = part.GetOriginalDataStream(); MarkableForwardOnlyEventingReadStream eventingDataStream = new MarkableForwardOnlyEventingReadStream(dataStream); XmlSchemaCollection schemaCollection = new XmlSchemaCollection(new NameTable()); schemaCollection.ValidationEventHandler += new ValidationEventHandler(this.ValidationCallBack); // retrieve the assigned document schemas to validate against SchemaList docSchemas = this.DocumentSchemas; // retrieve the namespace this document adheres to string contextProperty = (string)outmsg.Context.Read(XmlCompleteValidator._documentSpecNameProperty.Name.Name, XmlCompleteValidator._documentSpecNameProperty.Name.Namespace); // if the inbound message has a namespace, if (contextProperty != null && contextProperty.Length > 0) { // clear the original schemas to validate against docSchemas.Clear(); string[] contextSchemas = contextProperty.Split(new char[] { '|' }); // set it's schemas foreach (string schemaName in contextSchemas) { docSchemas.Add(new Schema(schemaName)); } } #region retrieve validation schemas, shamelessly copied from the original XmlValidator pipeline component bool validateSchemas = this.DocumentSchemas != null && this.DocumentSchemas.Count > 0; if (validateSchemas && this.DocumentSchemas.Count == 1 && this.DocumentSchemas[0].SchemaName.Length == 0) { validateSchemas = false; } if (validateSchemas) { foreach (Schema s in docSchemas) { try { docSpec = pc.GetDocumentSpecByName(s.SchemaName); } catch (COMException e) { throw new XmlCompleteValidatorException( ExceptionType.CANNOT_GET_DOCSPEC_BY_NAME, e.ErrorCode.ToString("X") + ": " + e.Message, new string[] { s.SchemaName }); } if (docSpec == null) { throw new XmlCompleteValidatorException( ExceptionType.CANNOT_GET_DOCSPEC_BY_NAME, string.Empty, new string[] { s.SchemaName }); } XmlSchemaCollection coll = docSpec.GetSchemaCollection(); schemaCollection.Add(coll); } } else { try { docSpec = pc.GetDocumentSpecByType(Utils.GetDocType(eventingDataStream)); } catch (COMException e) { throw new XmlCompleteValidatorException( ExceptionType.CANNOT_GET_DOCSPEC_BY_TYPE, e.ErrorCode.ToString("X") + ": " + e.Message, new string[] { Utils.GetDocType(eventingDataStream) }); } if (docSpec == null) { throw new XmlCompleteValidatorException( ExceptionType.CANNOT_GET_DOCSPEC_BY_TYPE, string.Empty, new string[] { Utils.GetDocType(eventingDataStream) }); } schemaCollection = docSpec.GetSchemaCollection(); } #endregion // the most critical line within this component, assign an // XmlEventingValidationStream to ensure the inbound messagestream is validated // and events can be assigned which allow us to capture any erros that might occur XmlEventingValidationStream validatingStream = new XmlEventingValidationStream(eventingDataStream); // add the schemas we'd like to validate the inbound message against validatingStream.Schemas.Add(schemaCollection); // assign a validation event which will accumulate any errors within the inbound message validatingStream.ValidatingReader.ValidationEventHandler += new ValidationEventHandler(XmlMessageValidationCallBack); // and assign the AfterLastReadEvent, which fires upon reading the last piece of information // from the inbound message stream and pushes all accumulated error information out into // the eventviewer and onto the HAT context by throwing an exception which contains the errors validatingStream.AfterLastReadEvent += new AfterLastReadEventHandler(validatingStream_AfterLastReadEvent); // duplicate the inbound message part by creating a new one and copying it's properties IBaseMessageFactory messageFactory = pc.GetMessageFactory(); IBaseMessagePart messagePart = messageFactory.CreateMessagePart(); // if the inbound message exists and has a body part, copy the part properties // into the outbound messagepart if (inmsg != null && inmsg.BodyPart != null) { messagePart.PartProperties = PipelineUtil.CopyPropertyBag(inmsg.BodyPart.PartProperties, messageFactory); } // set the outbound charset messagePart.Charset = "UTF-8"; // set the outbound content type messagePart.ContentType = "text/xml"; // and assign the outbound datastream messagePart.Data = validatingStream; // finally, copy existing message parts CopyMessageParts(pc, inmsg, outmsg, messagePart, false); }
protected override void DoNew<Root>(SchemaList<FullTextIndex, Root> originFields, FullTextIndex node) { FullTextIndex newNode = (FullTextIndex)node.Clone(originFields.Parent); newNode.Status = ObjectStatus.Create; originFields.Add(newNode); }
public override void InitUIVar() { f2 = new F2Window(this); GC_Main.DataSource = pOSXRBindingSource; SBtnList.Add(btnStar1); SBtnList.Add(btnStar2); SBtnList.Add(btnStar3); SBtnList.Add(btnStar4); SBtnList.Add(btnStar5); MainControls.Add(XR001); MainControls.Add(XR002); MainControls.Add(XR003); MainControls.Add(XR004); //MainControls.Add(XR005); MainControls.Add(XR006); KeyFieldMain = "XR001,XR002,XR003"; ReadOnlyFieldMain = "XR001"; RequiredFieldMain = "XR004"; OrderFieldMain = "XR001,XR002,XR003"; NumberFieldMain.Fields = "XR005"; ButtonFieldListMain.Add(XR002); ButtonFieldListMain.Add(XR003); ButtonFieldListMain.Add(XR004); VisibleListMain.Add("XR001", 0); VisibleListMain.Add("XR002", 1); VisibleListMain.Add("XR002C", 2); VisibleListMain.Add("XR003", 3); VisibleListMain.Add("XR003C", 4); VisibleListMain.Add("XR004", 5); VisibleListMain.Add("XR004C", 6); VisibleListMain.Add("XR005", 7); VisibleListMain.Add("XR006", 8); FieldWidthMain.Add("XR001", 133); FieldWidthMain.Add("XR002", 86); FieldWidthMain.Add("XR003", 86); FieldWidthMain.Add("XR004", 70); FieldWidthMain.Add("XR005", 163); FieldWidthMain.Add("XR006", 622); FieldWidthMain.Add("XR002C", 183); FieldWidthMain.Add("XR003C", 204); FieldWidthMain.Add("XR004C", 102); GV_Main.Columns["XR005"].MinWidth = 163; GV_Main.Columns["XR005"].MaxWidth = 163; GV_Main.RowHeight = 32; DS_RESAI09.POSXRDataTable dataTable = pOSXRTableAdapter.GetDataBy(""); if (dataTable != null) { for (int i = 0; i < dataTable.Columns.Count - 1; i++) { if (!dataTable.Columns[i].ColumnName.StartsWith("X")) { continue; } SchemaList.Add(dataTable.Columns[i].ColumnName + " " + dataTable.Columns[i].Caption); } } /*RepositoryItemTextEdit edit = new RepositoryItemTextEdit(); * GV_Main.Columns["XC009"].ColumnEdit = edit; * edit.DisplayFormat.FormatType = FormatType.Custom; * edit.DisplayFormat.FormatString = "XC009"; * edit.DisplayFormat.Format = new AI02Formatter();*/ XR002C.Text = ""; XR003C.Text = ""; XR004C.Text = ""; LBGrade.Text = ""; base.InitUIVar(); }
public override void InitUIVar() { f2 = new F2Window(this); TabControlMainHeight = 250; GC_Main.DataSource = pOSXABindingSource; GC_Body.DataSource = pOSXBBindingSource; MainControls.Add(XA001); MainControls.Add(XA002); MainControls.Add(XA003); MainControls.Add(XA004); MainControls.Add(XA005); MainControls.Add(XA006); MainControls.Add(XA007); MainControls.Add(XA008); MainControls.Add(XA009); KeyFieldMain = "XA001"; KeyFieldBody = "XB001,XB002"; VisibleFieldMain = "XA010,XA011"; VisibleFieldBody = "XB001,XB006,XB008,XB009,XB010"; OrderFieldMain = "XA001"; OrderFieldBody = "XB001,XB002"; ReadOnlyFieldBody = "XB002,XB007C"; RequiredFieldMain = "XA002"; TimeFieldMain.Fields = "XA007"; CheckFieldMain.Fields = "XA009"; NumberFieldBody.NumFields.Add("XB004", "n1"); ButtonFieldListMain.Add(XA002); ButtonFieldListBody.Add(new ButtonFieldFormat(GCNum.GCN_Body, "", "XB007", this.XB002ButtonEdit_ButtonClick)); VisibleListMain.Add("XA001", 0); VisibleListMain.Add("XA002", 1); VisibleListMain.Add("XA002C", 2); VisibleListMain.Add("XA003", 3); VisibleListMain.Add("XA009", 4); VisibleListMain.Add("XA007", 5); VisibleListMain.Add("XA004", 6); VisibleListMain.Add("XA005", 7); VisibleListMain.Add("XA006", 8); VisibleListMain.Add("XA008", 9); VisibleListBody.Add("XB002", 0); VisibleListBody.Add("XB007", 1); VisibleListBody.Add("XB007C", 2); VisibleListBody.Add("XB003", 4); VisibleListBody.Add("XB004", 5); VisibleListBody.Add("XB005", 6); FieldWidthMain.Add("XA001", 86); FieldWidthMain.Add("XA002", 86); FieldWidthMain.Add("XA003", 257); FieldWidthMain.Add("XA004", 111); FieldWidthMain.Add("XA005", 111); FieldWidthMain.Add("XA006", 500); FieldWidthMain.Add("XA007", 86); FieldWidthMain.Add("XA008", 500); FieldWidthMain.Add("XA009", 54); FieldWidthMain.Add("XA011", 75); FieldWidthMain.Add("XA002C", 87); FieldWidthMain.Add("XA010", 75); FieldWidthBody.Add("XB001", 75); FieldWidthBody.Add("XB002", 86); FieldWidthBody.Add("XB003", 237); FieldWidthBody.Add("XB004", 67); FieldWidthBody.Add("XB005", 588); FieldWidthBody.Add("XB006", 75); FieldWidthBody.Add("XB007", 86); FieldWidthBody.Add("XB008", 75); FieldWidthBody.Add("XB009", 75); FieldWidthBody.Add("XB010", 75); FieldWidthBody.Add("XB007C", 86); DS_RESAI01.POSXADataTable dataTable = pOSXATableAdapter.GetDataBy(""); if (dataTable != null) { for (int i = 0; i < dataTable.Columns.Count - 1; i++) { if (!dataTable.Columns[i].ColumnName.StartsWith("XA")) { continue; } SchemaList.Add(dataTable.Columns[i].ColumnName + " " + dataTable.Columns[i].Caption); } } SelectKeyMain = "XA001"; SelectKeyBody = "XB001"; XA002C.Text = ""; base.InitUIVar(); }
private static void BuildFields1(XTableSchema schema) { string connectionName = schema.ConnectionName; string selectSql = schema.SelectCommand; // XDataBase xdb = XDatabaseFactory.Instance.GetDataBase(connectionName); DatabaseAdmin XSql xSql = new XSql(selectSql); string tableName = xSql.GetFrom(); // schema.Fields.Clear(); SchemaList <FieldSchema> tmpfs = new SchemaList <FieldSchema>(); if (xSql.IsFromSourceTable(tableName)) { string keyfield = xdb.GetPrimaryKey(tableName); if (!string.IsNullOrEmpty(keyfield)) { schema.KeyField = keyfield; } List <FieldDef> fieldDefs = xdb.GetFieldInfos(tableName); for (int i = 0; i < fieldDefs.Count; i++) { FieldSchema field = new FieldSchema(); FieldDef fieldDef = fieldDefs[i]; field.Id = fieldDef.Name; field.DisplayName = fieldDef.Alias;//未用 if (string.IsNullOrEmpty(field.Title)) { field.Title = fieldDef.Alias; } if (schema.Fields.FindItem(field.Id) == null) { schema.Fields.Add(field); } if (tmpfs.FindItem(field.Id) == null) { tmpfs.Add(field); } } } else { DbConnection con = xdb.GetConnection(); DataTable netTable = new DataTable(); DbDataAdapter da = xdb.GetAdapter(); DbCommand cmd = con.CreateCommand(); xSql.ParamGetter = delegate(string name) { if (!name.StartsWith("@")) { name = "@" + name; } if (schema.QueryParams.FindItem(name) != null) { XQueryParameterSchema paramSch = schema.QueryParams.GetItem(name); return(paramSch.DefaultValue); } else { return(null); } }; cmd.CommandText = xSql.RelaceParamValue(); da.SelectCommand = cmd; da.Fill(netTable); foreach (DataColumn col in netTable.Columns) { FieldSchema field = new FieldSchema(); field.Id = col.ColumnName; field.DisplayName = col.Caption; // schema.Fields.Add(field); if (schema.Fields.FindItem(field.Id) == null) { schema.Fields.Add(field); } if (tmpfs.FindItem(field.Id) == null) { tmpfs.Add(field); } } } for (int i = schema.Fields.Count - 1; i >= 0; i--) { FieldSchema fld = schema.Fields[i]; FieldSchema newFld = tmpfs.FindItem(fld.Id); if (newFld == null) { schema.Fields.Remove(fld); } } xdb.Close(); }
private static void BuildFields(XTableSchema schema) { string connectionName = schema.ConnectionName; string selectSql = schema.SelectCommand; XDataBase xdb = XDatabaseFactory.Instance.GetDataBase(connectionName); XSql xSql = new XSql(selectSql); string tableName = xSql.GetFrom(); // schema.Fields.Clear(); SchemaList <FieldSchema> tmpfs = new SchemaList <FieldSchema>(); DbConnection con = xdb.GetConnection(); DataTable netTable = new DataTable(); DbDataAdapter da = xdb.GetAdapter(); DbCommand cmd = con.CreateCommand(); cmd.CommandText = selectSql; string[] paramNames = xSql.GetParamNames(); for (int i = 0; i < paramNames.Count(); i++) { string pName = paramNames[i]; if (!string.IsNullOrEmpty(pName)) { pName = pName.Trim(); } SqlParameter p = new SqlParameter(); p.ParameterName = "@" + pName; //p.SourceColumn = pName; p.Value = ""; cmd.Parameters.Add(p); } da.SelectCommand = cmd; da.Fill(netTable); //da.FillSchema(netTable, SchemaType.Source); foreach (DataColumn col in netTable.Columns) { FieldSchema field = new FieldSchema(); field.Id = col.ColumnName; field.DisplayName = col.Caption; // schema.Fields.Add(field); if (schema.Fields.FindItem(field.Id) == null) { schema.Fields.Add(field); } if (tmpfs.FindItem(field.Id) == null) { tmpfs.Add(field); } } //从原是表中获取,字段标题等信息; if (xSql.IsFromSourceTable(tableName)) { string keyfield = xdb.GetPrimaryKey(tableName); if (!string.IsNullOrEmpty(keyfield)) { schema.KeyField = keyfield; } List <FieldDef> fieldDefs = xdb.GetFieldInfos(tableName); for (int i = 0; i < fieldDefs.Count; i++) { FieldDef fieldDef = fieldDefs[i]; FieldSchema field = schema.Fields.FindItem(fieldDef.Name); // field.Id =; if (field != null) { field.DisplayName = fieldDef.Alias;//未用 if (string.IsNullOrEmpty(field.Title)) { field.Title = fieldDef.Alias; } if (fieldDef.IsIdentity) { field.IsAutoInc = true; } } // if (field == null) // schema.Fields.Add(field); // if (tmpfs.FindItem(field.Id) == null) // tmpfs.Add(field); } } //删除不存在的字段 for (int i = schema.Fields.Count - 1; i >= 0; i--) { FieldSchema fld = schema.Fields[i]; FieldSchema newFld = tmpfs.FindItem(fld.Id); if (newFld == null) { schema.Fields.Remove(fld); } } xdb.Close(); }
public override void InitUIVar() { f2 = new F2Window(this); GC_Main.DataSource = pOSXCBindingSource; MainControls.Add(XC001); MainControls.Add(XC010); MainControls.Add(XC009); MainControls.Add(XC004); MainControls.Add(XC002); MainControls.Add(XC002C); MainControls.Add(XC003); MainControls.Add(XC008); MainControls.Add(XC007); MainControls.Add(XC006); VisibleFieldMain = "XC005"; KeyFieldMain = "XC001"; RequiredFieldMain = "XC009,XC004,XC002,XC003,XC008,XC007,XC006"; OrderFieldMain = "XC001"; DateFieldMain.Fields = "XC002,XC008"; TimeFieldMain.Fields = "XC003,XC007"; ButtonFieldListMain.Add(XC004); ButtonFieldListMain.Add(XC006); VisibleListMain.Add("XC001", 0); VisibleListMain.Add("XC010", 1); VisibleListMain.Add("XC009", 2); VisibleListMain.Add("XC004", 3); VisibleListMain.Add("XC004C", 4); VisibleListMain.Add("XC002", 5); VisibleListMain.Add("XC003", 6); VisibleListMain.Add("XC008", 7); VisibleListMain.Add("XC007", 8); VisibleListMain.Add("XC006", 9); VisibleListMain.Add("XC006C", 10); FieldWidthMain.Add("XC001", 114); FieldWidthMain.Add("XC002", 93); FieldWidthMain.Add("XC003", 86); FieldWidthMain.Add("XC004", 86); FieldWidthMain.Add("XC005", 75); FieldWidthMain.Add("XC006", 70); FieldWidthMain.Add("XC007", 86); FieldWidthMain.Add("XC008", 93); FieldWidthMain.Add("XC009", 86); FieldWidthMain.Add("XC010", 251); FieldWidthMain.Add("XC004C", 119); FieldWidthMain.Add("XC006C", 102); DS_RESAI02.POSXCDataTable dataTable = pOSXCTableAdapter.GetDataBy(""); if (dataTable != null) { for (int i = 0; i < dataTable.Columns.Count - 1; i++) { if (!dataTable.Columns[i].ColumnName.StartsWith("X")) { continue; } SchemaList.Add(dataTable.Columns[i].ColumnName + " " + dataTable.Columns[i].Caption); } } RepositoryItemTextEdit edit = new RepositoryItemTextEdit(); GV_Main.Columns["XC009"].ColumnEdit = edit; edit.DisplayFormat.FormatType = FormatType.Custom; edit.DisplayFormat.FormatString = "XC009"; edit.DisplayFormat.Format = new AI02Formatter(); XC004C.Text = ""; XC006C.Text = ""; XC009.Properties.DisplayMember = "Text"; XC009.Properties.ValueMember = "Value"; var items = new[] { new { Text = "1.早餐", Value = "1" }, new { Text = "2.午餐", Value = "2" }, new { Text = "3.下午茶", Value = "3" }, new { Text = "4.晚餐", Value = "4" } }; XC009.Properties.DataSource = items; base.InitUIVar(); }
private static void BuildFields(DataSourceSchema schema) { string connectionName = schema.ConnectionName; string selectSql = schema.SelectCommand.CommandText; DatabaseAdmin dbAdmin = DatabaseAdmin.getInstance(connectionName); XSql xSql = new XSql(selectSql); string tableName = xSql.GetFrom(); // schema.Fields.Clear(); SchemaList <FieldSchema> tmpfs = new SchemaList <FieldSchema>(); DbConnection con = dbAdmin.Database.CreateConnection(); try { DataTable netTable = new DataTable(); DbDataAdapter da = dbAdmin.Database.GetDataAdapter(); DbCommand cmd = con.CreateCommand(); cmd.CommandText = selectSql; string[] paramNames = xSql.GetParamNames(); for (int i = 0; i < paramNames.Count(); i++) { string pName = paramNames[i]; if (!string.IsNullOrEmpty(pName)) { pName = pName.Trim(); } SqlParameter p = new SqlParameter(); p.ParameterName = "@" + pName; //p.SourceColumn = pName; p.Value = ""; cmd.Parameters.Add(p); } da.SelectCommand = cmd; da.Fill(netTable); //da.FillSchema(netTable, SchemaType.Source); foreach (DataColumn col in netTable.Columns) { FieldSchema field = new FieldSchema(); field.Id = col.ColumnName; field.DisplayName = col.Caption; // schema.Fields.Add(field); if (schema.Fields.FindItem(field.Id) == null) { schema.Fields.Add(field); } if (tmpfs.FindItem(field.Id) == null) { tmpfs.Add(field); } } //从原是表中获取,字段标题等信息; if (xSql.IsFromSourceTable(tableName)) { List <string> pks = dbAdmin.GetPrimaryKeys(tableName); schema.KeyField = JsonConvert.SerializeObject(pks); //if (pks.Count > 0) // keyfield = pks[0]; //if (!string.IsNullOrEmpty(keyfield)) // schema.KeyField = keyfield; var tbName = tableName.Trim('[', ']'); List <FieldDef> fieldDefs = dbAdmin.getTableDef(tbName).FieldDefs; for (int i = 0; i < fieldDefs.Count; i++) { FieldDef fieldDef = fieldDefs[i]; FieldSchema field = schema.Fields.FindItem(fieldDef.Name); // field.Id =; if (field != null) { field.IsKey = pks.Contains(field.Id); field.DisplayName = fieldDef.Alias;//未用 if (string.IsNullOrEmpty(field.Title)) { field.Title = fieldDef.Alias; } if (fieldDef.IsIdentity) { field.IsAutoInc = true; } } // if (field == null) // schema.Fields.Add(field); // if (tmpfs.FindItem(field.Id) == null) // tmpfs.Add(field); } } //删除不存在的字段 for (int i = schema.Fields.Count - 1; i >= 0; i--) { FieldSchema fld = schema.Fields[i]; FieldSchema newFld = tmpfs.FindItem(fld.Id); if (newFld == null) { schema.Fields.Remove(fld); } } } finally { con.Close(); } }