private void Start() { Time.timeScale = 1; TimeLimit = 180f; dataInserter = GameObject.FindObjectOfType <DataInserter>(); playerHealth = GameObject.FindObjectOfType <PlayerHealth>(); uiController = GameObject.FindObjectOfType <UIController>(); levelmanager = GameObject.FindObjectOfType <LevelManager>(); }
public void Connect() { OConnection = new OracleConnection { ConnectionString = ConString }; OConnection.Open(); this.DataLoader = new DataLoader(OConnection); DataInserter = new DataInserter(OConnection); Console.WriteLine("Connected to Oracle " + OConnection.ServerVersion); }
private void saveOrderAndOrderDetailButton_Click(object sender, RoutedEventArgs e) { if (albumComboBox.SelectedIndex == -1) { MessageBox.Show("Please select an album"); } CalculateTotalPrice(); if (DataInserter.UpdateOrderAndOrderDetail(_newOrder, _newOrderDetail) > 0) { this.Close(); } else { MessageBox.Show("Something went wrong, please try again"); } }
private void signup() { // Validate inputs Regex regex = new Regex(@"^([\w\.\-]+)@([\w\-]+)((\.(\w){2,3})+)$"); Match match = regex.Match(m_EmailInputField.text); if (m_UsernameInputField.text.Length <= 0 || m_PasswordInputField.text.Length <= 0 || m_EmailInputField.text.Length <= 0) { m_ErrorMessage.text = "please fill out all fields"; return; } else if (!match.Success) { m_ErrorMessage.text = "please provide a valid email"; return; } else { m_ErrorMessage.text = ""; } m_LoadingImage.gameObject.SetActive(true); // Create new user DataInserter dataInserter = GameMaster.Instance.m_DatabaseManager.m_DataInserter; if (dataInserter != null) { dataInserter.StartCoroutine(dataInserter.CreateUser( m_UsernameInputField.text, m_PasswordInputField.text, m_EmailInputField.text, signupSuccess, signupFailed, signupEmailAlreadyExists )); } else { Debug.LogError("DataInserter script can't be found by SignUpPanel"); } }
public void Run() { if (_workspace.Settings.SkipDataPopulation) { AstoriaTestLog.WriteLineIgnore("Skipping GraphBasedDataGenerator.SendData() due to workspace settings"); return; } bool oldLoggingValue = _workspace.Settings.SuppressTrivialLogging; _workspace.Settings.SuppressTrivialLogging = true; List <ResourceContainer> containers = _workspace.ServiceContainer.ResourceContainers.Where(rc => !(rc is ServiceOperation)).ToList(); foreach (ResourceContainer container in containers) { if (!this.Skip(container)) { int addCount; int graphDepth = this.GraphDepth(container.BaseType); if (graphDepth > _maxEntitiesToInsert) { addCount = 1; } else { addCount = _maxEntitiesToInsert - graphDepth + 1; } System.Diagnostics.Debug.WriteLine(container.BaseType.Name + ": " + graphDepth.ToString(), ", " + addCount.ToString()); this.InsertData(container, addCount); } } DataInserter.Close(); Done = true; _workspace.Settings.SuppressTrivialLogging = oldLoggingValue; }
public DataMigrationUtilityScreen() { InitializeComponent(); m_fromSchema = new Schema(); m_toSchema = new Schema(); m_dataInserter = new DataInserter(); m_fromSchema.ConnectionString = ""; m_fromSchema.ImmediateClose = false; m_fromSchema.Tables = null; m_fromSchema.TableTypeRestriction = TableType.Table; m_fromSchema.AllowNumericNulls = true; m_fromSchema.AllowTextNulls = true; m_toSchema.ConnectionString = ""; m_toSchema.ImmediateClose = false; m_toSchema.Tables = null; m_toSchema.TableTypeRestriction = TableType.Table; m_toSchema.AllowNumericNulls = true; m_toSchema.AllowTextNulls = true; m_dataInserter.BulkInsertFilePath = "c:\\"; m_dataInserter.BulkInsertSettings = "FIELDTERMINATOR = \'\\t\', ROWTERMINATOR = \'\\n\', CODEPAGE = \'OEM\', FIRE_TRIGGERS, KEEPNULLS"; m_dataInserter.DelimiterReplacement = " - "; m_dataInserter.FromSchema = m_fromSchema; m_dataInserter.ToSchema = m_toSchema; m_dataInserter.RowReportInterval = 10; m_dataInserter.OverallProgress += DataInserter_OverallProgress; m_dataInserter.RowProgress += DataInserter_RowProgress; m_dataInserter.TableProgress += DataInserter_TableProgress; m_dataInserter.TableCleared += DataInserter_TableCleared; m_dataInserter.SQLFailure += DataInserter_SQLFailure; m_dataInserter.BulkInsertExecuting += DataInserter_BulkInsertExecuting; m_dataInserter.BulkInsertCompleted += DataInserter_BulkInsertCompleted; m_dataInserter.BulkInsertException += DataInserter_BulkInsertException; }
private void InsertData(ResourceContainer container, int count) { ResourceContainer currentContainer; ResourceType currentType; KeyExpression currentKey; KeyedResourceInstance currentEntity; KeyedResourceInstance parentEntity; Queue <object[]> queue = new Queue <object[]>(); foreach (ResourceType resourceType in container.ResourceTypes) { if (resourceType.Facets.AbstractType) { continue; } for (int i = 0; i < count; i++) { if (CreateKeyedResourceInstance(container, resourceType, out currentKey, out currentEntity)) { DataInserter.AddEntity(currentKey, currentEntity); queue.Enqueue(new object[] { currentKey, currentEntity, null }); } } } HashSet <ResourceType> typesAdded = new HashSet <ResourceType>(); while (queue.Count > 0) { object[] current = queue.Dequeue(); currentKey = current[0] as KeyExpression; currentEntity = current[1] as KeyedResourceInstance; parentEntity = current[2] as KeyedResourceInstance; currentContainer = currentKey.ResourceContainer; currentType = currentKey.ResourceType; typesAdded.Add(currentType); foreach (ResourceProperty property in currentType.Properties.OfType <ResourceProperty>().Where(p => p.IsNavigation)) { ResourceContainer propertyResourceContainer = container.FindDefaultRelatedContainer(property); ResourceType propertyResourceType = property.OtherAssociationEnd.ResourceType; List <ResourceType> possibleTypes = new List <ResourceType>() { propertyResourceType }; possibleTypes.AddRange(propertyResourceType.DerivedTypes); int typeOffset = AstoriaTestProperties.Random.Next(possibleTypes.Count); bool collection = (property.Type is CollectionType); int linked = 1; if (collection) { linked = Math.Max(possibleTypes.Count, 2); } if (!collection && parentEntity != null && parentEntity.TypeName == propertyResourceType.Name) { DataInserter.AddAssociation(currentEntity, property, parentEntity); continue; } for (int i = 0; i < linked; i++) { ResourceType typeToAdd = possibleTypes[(i + typeOffset) % possibleTypes.Count]; if (!typesAdded.Contains(typeToAdd)) { // add and link new entity KeyedResourceInstance childEntity; KeyExpression childKey; if (CreateKeyedResourceInstance(propertyResourceContainer, typeToAdd, out childKey, out childEntity)) { // add new entity DataInserter.AddEntity(childKey, childEntity); // add it to the queue queue.Enqueue(new object[] { childKey, childEntity, currentEntity }); // add to collection DataInserter.AddAssociation(currentEntity, property, childEntity); } } else if (property.OtherAssociationEnd.Multiplicity == Multiplicity.Many) { // link existing entity ResourceContainer otherContainer = container.FindDefaultRelatedContainer(property); KeyExpression otherKey = this.GetRandomGeneratedKey(otherContainer, typeToAdd); if (otherKey != null) { KeyedResourceInstance otherEntity; if (_existingEntityMap.TryGetValue(otherKey, out otherEntity)) { DataInserter.AddAssociation(currentEntity, property, otherEntity); } } } } // end of this property } // end of this entity } DataInserter.Flush(); }
void LateUpdate() { StartCoroutine(DataInserter.CreateUser(DataInserter.url, score)); }