// load mySQL and create XML private void button2_Click(object sender, EventArgs e) { metaData.Clear(); getMySqlTables("freebim"); dataGridView1.DataSource = metaData.Tables["Properties"]; dataGridView2.DataSource = metaData.Tables["Measures"]; dataGridView3.DataSource = metaData.Tables["Values"]; dataGridView7.DataSource = metaData.Tables["Subjects"]; dataGridView8.DataSource = metaData.Tables["Assigns_Properties"]; metaData.WriteXml(metaDataName); }
protected void ResetVerifier() { SessionId = ""; Codec = WaveFormatEncoding.Unknown; Profiles.Clear(); VerifyResults.Clear(); VerifyRawResult = SpeechVerifier.Result.NeedMore; MetaData.Clear(); ExtraData.Clear(); Content.Clear(); CookieContainer = new CookieContainer(); TotalSnippetsSent = 0; TotalAudioBytesSent = 0; TotalProcessCalls = 0; SpeechRequired = 0; SpeechExtracted = 0; VerifyScore = 0; IsSessionOpen = false; IsSessionClosing = false; IsAuthorized = false; IsOverridable = false; IsLivenessRequired = false; LivenessResult = SpeechVerifier.AliveResult.Untested; IsTooSoft = false; IsTooLoud = false; }
public override bool ClearPropertyData(string key) { lock (_MutexObj) { if (!string.IsNullOrEmpty(key)) { if (MetaData.ContainsKey(key)) { MetaData.Remove(key); } } else { MetaData.Clear(); } } return(true); }
protected void ResetEnroller() { SessionId = ""; Codec = WaveFormatEncoding.Unknown; Profiles.Clear(); EnrollResults.Clear(); EnrollResult = SpeechEnroller.Result.NeedMore; MetaData.Clear(); ExtraData.Clear(); Content.Clear(); CookieContainer = new CookieContainer(); TotalSnippetsSent = 0; TotalAudioBytesSent = 0; TotalProcessCalls = 0; SpeechRequired = 0; SpeechExtracted = 0; IsSessionOpen = false; IsSessionClosing = false; IsTooSoft = false; IsTooLoud = false; }
private void button5_Click(object sender, EventArgs e) { metaData.Clear(); metaData.ReadXml(metaDataName); rvt_parameter_mapping.Clear(); rvt_parameter_mapping.ReadXml(mappingDataName); Subjects = metaData.Tables["Subjects"]; Properties = metaData.Tables["Properties"]; prop_par_mapping = rvt_parameter_mapping.Tables["prop_par_mapping"]; parameters = rvt_parameter_mapping.Tables["Parameters"]; int category_int = -2000011; // First find the Properties relevant for the subjects, the list is a result from the category and the inheritance chain List <string> parents = new List <string> { "E1", "E81" }; Assigns_Properties = metaData.Tables["Assigns_Properties"]; DataTable element_props = new DataTable(); string[] cols2 = { "Property_ID", "bSDD_Guid", "Name_Loc", "Description", "bIsInIFC_PSet" }; Type[] dataTypes = { typeof(string), typeof(string), typeof(string), typeof(string), typeof(bool) }; for (int i = 0; i < cols2.Count(); i++) { element_props.Columns.Add(cols2[i], dataTypes[i]); } var result = from p in Properties.AsEnumerable() join r in Assigns_Properties.AsEnumerable() on p.Field <string>("freeBIM_Guid") equals r.Field <string>("Guid_Property") where parents.Contains(r.Field <string>("Guid_Subject")) select new { Property_ID = (string)p["freeBIM_Guid"], bSDD_Guid = p["bSDD_Guid"] == null ? "" : p["bSDD_Guid"].ToString(), Name_Loc = p["Name_Loc"] == null ? "" : p["Name_Loc"].ToString(), bIsInIFC_PSet = p["bIsInIFC_PSet"] == null || p["bIsInIFC_PSet"].ToString().Length == 0 ? false : Convert.ToBoolean(p["bIsInIFC_PSet"]), Description = p["Description_Loc"] == null ? "" : p["Description_Loc"].ToString() }; foreach (var item in result) { DataRow newRow = element_props.NewRow(); newRow["Property_ID"] = item.Property_ID; newRow["bsDD_Guid"] = item.bSDD_Guid; newRow["Name_Loc"] = item.Name_Loc; newRow["bIsInIFC_PSet"] = item.bIsInIFC_PSet; newRow["Description"] = item.Description; element_props.Rows.Add(newRow); } var pars_mapped_query = from m in prop_par_mapping.AsEnumerable() join p in Properties.AsEnumerable() on m.Field <string>("Prop_ID") equals p.Field <string>("freeBIM_Guid") join par in parameters.AsEnumerable() on m.Field <Int32>("Parameter_ID") equals par.Field <Int32>("ID") where m.Field <Int32>("Category_int") == category_int select new { Prop_ID = p["freeBIM_Guid"].ToString(), ParName = par["name_deu"] == null ? "" : par["name_deu"].ToString(), Type_Code = par["Type_Code"] == null ? "" : par["Type_Code"].ToString(), Parameter_ID = m["Parameter_ID"], bIsType = par["bIsType"] == null || par["bIsType"].ToString().Length == 0 ? false : par["bIsType"] }; string[] cols = { "Prop_ID", "ParName", "bIsType", "Type_Code", "Parameter_ID" }; Type[] types = { typeof(string), typeof(string), typeof(bool), typeof(string), typeof(Int32) }; DataTable pars_mapped = new DataTable(); for (int i = 0; i < cols.Count(); i++) { pars_mapped.Columns.Add(cols[i], types[i]); } foreach (var item in pars_mapped_query) { DataRow newRow = pars_mapped.NewRow(); newRow["Prop_ID"] = item.Prop_ID; newRow["ParName"] = item.ParName; newRow["Type_Code"] = item.Type_Code; newRow["Parameter_ID"] = item.Parameter_ID; newRow["bIsType"] = item.bIsType; pars_mapped.Rows.Add(newRow); } var query = from prop in element_props.AsEnumerable() join mapped in pars_mapped.AsEnumerable() on prop.Field <string>("Property_ID") equals mapped.Field <string>("Prop_ID") into j from mapped in j.DefaultIfEmpty() select new { Prop_ID = prop.Field <string>("Property_ID"), PropName = prop.Field <string>("Name_Loc") == null ? "" : prop.Field <string>("Name_Loc").ToString(), Description = prop.Field <string>("Description") == null ? "" : prop.Field <string>("Description").ToString(), bSDD_Guid = prop.Field <string>("bSDD_Guid") == null ? "" : prop.Field <string>("bSDD_Guid").ToString(), bIsInIFC_PSet = prop["bIsInIFC_PSet"] == null || prop["bIsInIFC_PSet"].ToString().Length == 0 ? false : Convert.ToBoolean(prop["bIsInIFC_PSet"]), Type_Code = mapped == null ? "" : mapped.Field <string>("Type_Code").ToString(), ParName = mapped == null ? "" : mapped.Field <string>("ParName").ToString(), bIsType = mapped == null ? false : mapped.Field <bool>("bIsType"), Parameter_ID = mapped == null ? 0 : mapped.Field <Int32>("Parameter_ID") }; // sql = "select parameters.ID as ID, Code, Name, parameters.Description as Description, `Order`, data_types.Description as Data_Type, unit_types.Unit as Unit, parameters.GUID as GUID, parameters.bIsType as bIsType, "; // sql += "bHide, rvt_parameters.Type_Code as Type_Code, rvt_parameters.name_deu as ParName, rvt_Parameter_ID "; string[] cols3 = { "Prop_ID", "PropName", "Description", "bIsType", "Type_Code", "ParName", "bIsInIFC_PSet", "bSDD_Guid", "Parameter_ID" }; Type[] types3 = { typeof(string), typeof(string), typeof(string), typeof(bool), typeof(string), typeof(string), typeof(bool), typeof(string), typeof(Int32) }; DataTable dt_par_element = new DataTable(); for (int i = 0; i < cols3.Count(); i++) { dt_par_element.Columns.Add(cols3[i], types3[i]); } foreach (var item in query) { DataRow newRow = dt_par_element.NewRow(); newRow["Prop_ID"] = item.Prop_ID; newRow["PropName"] = item.PropName; newRow["Description"] = item.Description; newRow["bIsType"] = item.bIsType; newRow["Type_Code"] = item.Type_Code; newRow["ParName"] = item.ParName; newRow["bIsInIFC_PSet"] = item.bIsInIFC_PSet; newRow["bSDD_Guid"] = item.bSDD_Guid; newRow["Parameter_ID"] = item.Parameter_ID; dt_par_element.Rows.Add(newRow); } }
private HttpRequestMessage BuildRequest(CallMode mode, Uri uri) { HttpRequestMessage request = null; switch (mode) { case CallMode.Profile: request = new HttpRequestMessage(HttpMethod.Post, uri); request.Headers.Add("Developer-Key", Configuration.DeveloperKey); request.Headers.Add("Application-Key", Configuration.ApplicationKey); if (!string.IsNullOrEmpty(InteractionId)) { request.Headers.Add(SpeechApi.INTERACTION_ID, InteractionId); } if (!string.IsNullOrEmpty(InteractionTag)) { request.Headers.Add(SpeechApi.INTERACTION_TAG, InteractionTag); } if (!string.IsNullOrEmpty(Configuration.ApplicationSource)) { request.Headers.Add(SpeechApi.INTERACTION_SOURCE, Configuration.ApplicationSource); request.Headers.Add(SpeechApi.APP_VERSION_ID, Configuration.ApplicationSource); } if (!string.IsNullOrEmpty(Configuration.ApplicationUserAgent)) { request.Headers.Add(SpeechApi.INTERACTION_AGENT, Configuration.ApplicationUserAgent); } break; case CallMode.Start: request = new HttpRequestMessage(HttpMethod.Post, uri); request.Headers.Add("Developer-Key", Configuration.DeveloperKey); request.Headers.Add("Application-Key", Configuration.ApplicationKey); if (!string.IsNullOrEmpty(InteractionId)) { Logger?.LogDebug("{0}: {1}", SpeechApi.INTERACTION_ID, InteractionId); request.Headers.Add(SpeechApi.INTERACTION_ID, InteractionId); } if (!string.IsNullOrEmpty(InteractionTag)) { Logger?.LogDebug("{0}: {1}", SpeechApi.INTERACTION_TAG, InteractionTag); request.Headers.Add(SpeechApi.INTERACTION_TAG, InteractionTag); } if (!string.IsNullOrEmpty(Configuration.ApplicationSource)) { Logger?.LogDebug("{0}: {1}", SpeechApi.INTERACTION_SOURCE, Configuration.ApplicationSource); Logger?.LogDebug("{0}: {1}", SpeechApi.APP_VERSION_ID, Configuration.ApplicationSource); request.Headers.Add(SpeechApi.INTERACTION_SOURCE, Configuration.ApplicationSource); request.Headers.Add(SpeechApi.APP_VERSION_ID, Configuration.ApplicationSource); } if (!string.IsNullOrEmpty(Configuration.ApplicationUserAgent)) { Logger?.LogDebug("{0}: {1}", SpeechApi.INTERACTION_AGENT, Configuration.ApplicationUserAgent); request.Headers.Add(SpeechApi.INTERACTION_AGENT, Configuration.ApplicationUserAgent); } if (MetaData.Count > 0) { foreach (var item in MetaData) { Logger?.LogDebug("{0}: {1}", item.Key, item.Value); request.Headers.Add(item.Key, item.Value); } MetaData.Clear(); } break; case CallMode.Process: request = new HttpRequestMessage(HttpMethod.Post, uri); Logger?.LogDebug("{0}: {1}", SpeechApi.SESSION_ID, SessionId); request.Headers.Add(SpeechApi.SESSION_ID, SessionId); if (MetaData.Count > 0) { foreach (var item in MetaData) { Logger?.LogDebug("{0}: {1}", item.Key, item.Value); request.Headers.Add(item.Key, item.Value); } MetaData.Clear(); } request.Content = BuildContent(); break; case CallMode.Summarize: request = new HttpRequestMessage(HttpMethod.Delete, uri); Logger?.LogDebug("{0}: {1}", SpeechApi.SESSION_ID, SessionId); request.Headers.Add(SpeechApi.SESSION_ID, SessionId); if (MetaData.Count > 0) { foreach (var item in MetaData) { Logger?.LogDebug("{0}: {1}", item.Key, item.Value); request.Headers.Add(item.Key, item.Value); } MetaData.Clear(); } break; case CallMode.Cancel: request = new HttpRequestMessage(HttpMethod.Delete, uri); Logger?.LogDebug("{0}: {1}", SpeechApi.SESSION_ID, SessionId); request.Headers.Add(SpeechApi.SESSION_ID, SessionId); break; } request.Version = new Version(1, 1); request.Headers.ConnectionClose = false; string cookies = CookieContainer.GetCookieHeader(request.RequestUri); if (!string.IsNullOrEmpty(cookies)) { Logger?.LogDebug("{0}: {1}", SpeechApi.COOKIE, cookies); request.Headers.Add(SpeechApi.COOKIE, cookies); } return(request); }
private void MyTree_BeforeSelect(object sender, System.Windows.Forms.TreeViewCancelEventArgs e) { try { if (null == this.MetaData) { return; } NodeData data = (NodeData)e.Node.Tag; MetaObject obj = null; if (data.Type != NodeType.MYMETA) { obj = data.Meta as MetaObject; } if (null != data) { switch (data.Type) { case NodeType.COLUMNS: UserData.EditNiceNames(data.Meta as Columns); break; case NodeType.DATABASES: UserData.EditNiceNames(data.Meta as Databases); break; case NodeType.TABLES: case NodeType.SUBTABLES: UserData.EditNiceNames(data.Meta as Tables); break; case NodeType.VIEWS: case NodeType.SUBVIEWS: UserData.EditNiceNames(data.Meta as Views); break; case NodeType.FOREIGNKEYS: case NodeType.INDIRECTFOREIGNKEYS: UserData.EditNiceNames(data.Meta as ForeignKeys); break; case NodeType.PARAMETERS: UserData.EditNiceNames(data.Meta as MyMeta.Parameters); break; case NodeType.RESULTCOLUMNS: UserData.EditNiceNames(data.Meta as ResultColumns); break; case NodeType.INDEXES: UserData.EditNiceNames(data.Meta as Indexes); break; case NodeType.PROCEDURES: UserData.EditNiceNames(data.Meta as Procedures); break; case NodeType.DOMAINS: UserData.EditNiceNames(data.Meta as Domains); break; default: UserData.Clear(); break; } switch (data.Type) { case NodeType.DATABASE: { Database o = obj as Database; MetaData.DisplayDatabaseProperties(o, e.Node); UserData.EditSingle(o, o.Alias); //GlobalUserData.Edit(o); } break; case NodeType.COLUMN: { Column o = obj as Column; MetaData.DisplayColumnProperties(o, e.Node); UserData.EditSingle(o, o.Alias); GlobalUserData.Edit(o); } break; case NodeType.TABLE: { Table o = obj as Table; MetaData.DisplayTableProperties(o, e.Node); UserData.EditSingle(o, o.Alias); GlobalUserData.Edit(o); } break; case NodeType.VIEW: { MyMeta.View o = obj as MyMeta.View; MetaData.DisplayViewProperties(o, e.Node); UserData.EditSingle(o, o.Alias); GlobalUserData.Edit(o); } break; case NodeType.PARAMETER: { MyMeta.Parameter o = obj as MyMeta.Parameter; MetaData.DisplayParameterProperties(o, e.Node); UserData.EditSingle(o, o.Alias); GlobalUserData.Edit(o); } break; case NodeType.RESULTCOLUMN: { ResultColumn o = obj as ResultColumn; MetaData.DisplayResultColumnProperties(o, e.Node); UserData.EditSingle(o, o.Alias); GlobalUserData.Edit(o); } break; case NodeType.FOREIGNKEY: { ForeignKey o = obj as ForeignKey; MetaData.DisplayForeignKeyProperties(o, e.Node); UserData.EditSingle(o, o.Alias); GlobalUserData.Edit(o); } break; case NodeType.INDEX: { Index o = obj as Index; MetaData.DisplayIndexProperties(o, e.Node); UserData.EditSingle(o, o.Alias); GlobalUserData.Edit(o); } break; case NodeType.PROCEDURE: { Procedure o = obj as Procedure; MetaData.DisplayProcedureProperties(o, e.Node); UserData.EditSingle(o, o.Alias); GlobalUserData.Edit(o); } break; case NodeType.DOMAIN: { Domain o = obj as Domain; MetaData.DisplayDomainProperties(o, e.Node); UserData.EditSingle(o, o.Alias); GlobalUserData.Edit(o); } break; // // case NodeType.PROVIDERTYPE: // MetaData.DisplayProviderTypeProperties(obj as IProviderType, e.Node); // break; default: MetaData.Clear(); GlobalUserData.Clear(); break; } } } #if DEBUG catch (Exception ex) { throw new Exception(ex.Message, ex); } #else catch {} #endif }