Пример #1
0
 void importWorker_DoWork(object sender, DoWorkEventArgs e)
 {
     var settings = (ImportFileSettings) ((object[])e.Argument)[0];
     var filePath = ((object[])e.Argument)[1].ToString();
     var ie = new ImportEngine(filePath, service, settings);
     ie.RaiseError += ie_RaiseError;
     ie.RaiseSuccess += ie_RaiseSuccess;
     ie.Import();
 }
Пример #2
0
        private void tsbImportNN_Click(object sender, EventArgs e)
        {
            if (txtFilePath.Text.Length == 0)
                return;

            listLog.Items.Clear();

            var settings = new ImportFileSettings
            {
                FirstEntity = ((EntityInfo)cbbFirstEntity.SelectedItem).Metadata.LogicalName,
                FirstAttributeIsGuid = rdbFirstGuid.Checked,
                FirstAttributeName = ((AttributeInfo)cbbFirstEntityAttribute.SelectedItem).Metadata.LogicalName,
                Relationship = ((RelationshipInfo)cbbRelationship.SelectedItem).Metadata.SchemaName,
                SecondEntity = ((EntityInfo)cbbSecondEntity.SelectedItem).Metadata.LogicalName,
                SecondAttributeIsGuid = rdbSecondGuid.Checked,
                SecondAttributeName = ((AttributeInfo)cbbSecondEntityAttribute.SelectedItem).Metadata.LogicalName,
            };

            WorkAsync(new WorkAsyncInfo
            {
                Message = "Importing many to many relationship records...",
                AsyncArgument = new object[] { settings, txtFilePath.Text },
                Work = (bw, evt) =>
                {
                    var innerSettings = (ImportFileSettings)((object[])evt.Argument)[0];
                    var filePath = ((object[])evt.Argument)[1].ToString();
                    var ie = new ImportEngine(filePath, this.Service, innerSettings);
                    ie.RaiseError += ie_RaiseError;
                    ie.RaiseSuccess += ie_RaiseSuccess;
                    ie.Import();
                },
                PostWorkCallBack = evt => { }
            });
        }
Пример #3
0
        private void tsbImportNN_Click(object sender, EventArgs e)
        {
            listLog.Items.Clear();

            var settings = new ImportFileSettings
            {
                FirstEntity = ((EntityInfo)cbbFirstEntity.SelectedItem).Metadata.LogicalName,
                FirstAttributeIsGuid = rdbFirstGuid.Checked,
                FirstAttributeName = ((AttributeInfo)cbbFirstEntityAttribute.SelectedItem).Metadata.LogicalName,
                Relationship = ((RelationshipInfo)cbbRelationship.SelectedItem).Metadata.SchemaName,
                SecondEntity = ((EntityInfo)cbbSecondEntity.SelectedItem).Metadata.LogicalName,
                SecondAttributeIsGuid = rdbSecondGuid.Checked,
                SecondAttributeName = ((AttributeInfo)cbbSecondEntityAttribute.SelectedItem).Metadata.LogicalName,
            };

            WorkAsync("Importing many to many relationships...",
                evt =>
                {
                    var innerSettings = (ImportFileSettings)((object[])evt.Argument)[0];
                    var filePath = ((object[])evt.Argument)[1].ToString();
                    var ie = new ImportEngine(filePath, service, innerSettings);
                    ie.RaiseError += ie_RaiseError;
                    ie.RaiseSuccess += ie_RaiseSuccess;
                    ie.Import();
                },
                evt =>{},
                new object[] { settings, txtFilePath.Text });
        }