public ActionResult GetAgentRelation(string ageId) { ListResult result = new ListResult(); try { var list = AgentRelationLogic.GetList().Where(f => f.c_parent_id == ageId).Select(f => f.c_child_id).ToList(); var aList = AgentLogic.GetList().Where(f => list.Contains(f.c_id)).ToList(); var viewList = AgentHelper.getJsonListFromEntityList(aList); int firstGen = 1; foreach (var item in viewList) { item.gender = "1 - " + firstGen.ToString(); firstGen++; } result.fistList = viewList; result.state = ResultType.success.ToString(); return(Content(result.ToJson())); } catch (Exception ex) { result.state = ResultType.error.ToString(); result.message = string.Format("提交失败({0})", ex.Message); return(Content(result.ToJson())); throw; } }
private async Task WriteQueueRecordsAsync(ImportManagerQueueRecord managerQueueRecord, Dictionary <long, String> queueRecordToPopulate, List <ImportJobError> violations, DateTime timeOfInsert) { try { var dt = new DataTable(); dt.Columns.Add(Constant.Sql.ColumnsNames.ImportWorkerQueue.JobID, typeof(Int32)); dt.Columns.Add(Constant.Sql.ColumnsNames.ImportWorkerQueue.WorkspaceArtifactID, typeof(Int32)); dt.Columns.Add(Constant.Sql.ColumnsNames.ImportWorkerQueue.ObjectType, typeof(String)); dt.Columns.Add(Constant.Sql.ColumnsNames.ImportWorkerQueue.JobType, typeof(String)); dt.Columns.Add(Constant.Sql.ColumnsNames.ImportWorkerQueue.MetaData, typeof(String)); dt.Columns.Add(Constant.Sql.ColumnsNames.ImportWorkerQueue.ImportRowID, typeof(Int32)); dt.Columns.Add(Constant.Sql.ColumnsNames.ImportWorkerQueue.QueueStatus, typeof(Int32)); dt.Columns.Add(Constant.Sql.ColumnsNames.ImportWorkerQueue.Priority, typeof(Int32)); dt.Columns.Add(Constant.Sql.ColumnsNames.ImportWorkerQueue.ResourceGroupID, typeof(Int32)); dt.Columns.Add(Constant.Sql.ColumnsNames.ImportWorkerQueue.TimeStampUTC, typeof(DateTime)); foreach (var record in queueRecordToPopulate) { dt.Rows.Add(managerQueueRecord.JobId, managerQueueRecord.WorkspaceArtifactId, managerQueueRecord.ObjectType, managerQueueRecord.JobType, record.Value, record.Key, Constant.Status.Queue.NOT_STARTED, managerQueueRecord.Priority, managerQueueRecord.ResourceGroupId, timeOfInsert); } await SqlQueryHelper.BulkInsertIntoTableAsync(AgentHelper.GetDBContext(-1), dt, Constant.Tables.ImportWorkerQueue, Constant.BatchSizes.ImportManagerIntoWorkerQueue); } catch (Exception ex) { var beginErrorLine = queueRecordToPopulate.Keys.Min(); var endErrorLine = queueRecordToPopulate.Keys.Max(); violations.Add(new ImportJobError() { Message = String.Format(Constant.ErrorMessages.ImportQueueManagerPopulatingImportWorkerQueueError, beginErrorLine, endErrorLine), LineNumber = null, Type = Constant.ImportUtilityJob.ErrorType.DataLevel, Details = ex.ToString() }); } }
public object GetValue() { if (textBox is PDatePicker) { if (valueIsString && stringDateIsMiladi == false) { return((textBox as PDatePicker).SelectedPersianDate); } else { return((textBox as PDatePicker).SelectedDate?.ToString()); } } else { if ((textBox as DatePicker).SelectedDate != null && valueIsString && stringDateIsMiladi == false) { return(AgentHelper.GetShamsiDateFromMiladi((textBox as DatePicker).SelectedDate.Value)); } else { return((textBox as DatePicker).SelectedDate?.ToString()); } } }
public bool SetValue(object value) { if (textBox is PDatePicker) { if (valueIsString && stringDateIsMiladi == false) { (textBox as PDatePicker).SelectedPersianDate = value?.ToString(); } else { (textBox as PDatePicker).SelectedDate = value?.ToString(); } } else { if (value != null && valueIsString && stringDateIsMiladi == false) { var date = AgentHelper.GetMiladiDateFromShamsi(value.ToString()); } else { (textBox as DatePicker).Text = value?.ToString(); } } return(true); }
private void DeleteAgents() { try { using (IAgentManager agentManager = _serviceFactory.CreateProxy <IAgentManager>()) { AgentUtilities.IAgentHelper agentHelper = new AgentHelper( agentManager: agentManager, sqlDatabaseServerName: TestConstants.InstanceDetails.SQL_SERVER_NAME, sqlDatabaseName: TestConstants.InstanceDetails.SQL_DATABASE_NAME, sqlUsername: TestConstants.InstanceDetails.SQL_USERNAME, sqlPassword: TestConstants.InstanceDetails.SQL_PASSWORD); // Check if Agent exists in the instance List <Agent> agentsList = agentHelper.GetAgentByNameAsync(Helpers.Constants.Names.AGENT_INSTANCE_METRICS_CALCULATOR).Result; if (agentsList.Count > 0) { //Delete Agent(s) Console.WriteLine("Deleting Agent."); List <int> agentArtifactIds = agentsList.Select(x => x.ArtifactID).ToList(); agentHelper.DeleteMultipleAgentsAsync(agentArtifactIds).Wait(); Console.WriteLine($"Agent(s) Deleted. Count = {agentsList.Count}"); } else { Console.WriteLine("Agent(s) doesn't exists in the Instance. Skipped deletion."); } } } catch (Exception ex) { throw new Exception("An error encountered while deleting Agents.", ex); } }
public void ProcessAccount(ForEachAccountData data) { var dispatcher = AgentHelper.GetDispatcherClient(); while (true) { data.CancellationToken.ThrowIfCancellationRequested(); const int maxCount = 100; var response = dispatcher.RecalcUnitTestsResults(data.Account.Id, maxCount); if (response.Success) { var updateCount = response.Data.UpdateCount; Interlocked.Add(ref Count, updateCount); if (updateCount == 0) { data.Logger.Trace("Обновлено статусов проверок: " + updateCount); return; } data.Logger.Debug("Обновлено статусов проверок: " + updateCount); if (updateCount < maxCount) { return; } } else { data.Logger.Error("Ошибка: " + response.ErrorMessage); return; } } }
private async Task CreateExportWorkerHoldingTableAsync() { RaiseMessage($"Creating Export Worker holding table for export job [ExportWorkerHoldingTable = {ExportWorkerHoldingTable}]. {_errorContext}"); await QueryHelper.CreateExportWorkerHoldingTableAsync(AgentHelper.GetDBContext(-1), ExportWorkerHoldingTable); RaiseMessage($"Created Export Worker holding table for export job [ExportWorkerHoldingTable = {ExportWorkerHoldingTable}]. {_errorContext}"); }
private async Task AddRecordsToExportResultsAsync(string holdingTableName) { RaiseMessage($"Creating Export Worker Results from holding table for export job [ExportWorkerHoldingTable = {ExportWorkerHoldingTable}]. {_errorContext}"); await QueryHelper.CopyRecordsToExportResultsAsync(AgentHelper.GetDBContext(-1), holdingTableName); RaiseMessage($"Created Export Worker Results from holding table for export job [ExportWorkerHoldingTable = {ExportWorkerHoldingTable}]. {_errorContext}"); }
protected void InitMonitoring() { var client = SystemAccountHelper.GetInternalSystemClient(); // Создадим компонент // Если запускаемся в отладке, то компонент будет не в корне, а в папке DEBUG var folder = !DebugHelper.IsDebugMode ? client.GetRootComponentControl() : client.GetRootComponentControl().GetOrCreateChildFolderControl("DEBUG"); var componentType = client.GetOrCreateComponentTypeControl(!DebugHelper.IsDebugMode ? "Agent" : DebugHelper.DebugComponentType); ComponentControl = folder .GetOrCreateChildComponentControl(new GetOrCreateComponentData("Agent", componentType) { DisplayName = "Агент", Version = AgentHelper.GetVersion() }); // Присвоим Id компонента по умолчанию, чтобы адаптер NLog мог его использовать Client.Instance = client; Client.Instance.Config.DefaultComponent.Id = ComponentControl.Info?.Id; Logger = LogManager.GetLogger("Agent"); Logger.Info("Запуск, IsFake={0}", ComponentControl.IsFake()); AppDomain.CurrentDomain.UnhandledException += CurrentDomainOnUnhandledException; }
private void CommandManager_Clicked(object sender, EventArgs e) { int relationID = 0; DP_DataRepository RelationData = null; //if (EditArea.AreaInitializer.SourceRelationColumnControl != null) //{ // relationID = EditArea.AreaInitializer.SourceRelationColumnControl.Relationship.ID; // RelationData = EditArea.AreaInitializer.SourceRelationColumnControl.RelatedData; // //if (RelationData != null) // // RelationData.ValueChanged = true; //} DP_DataRepository newData = AgentHelper.CreateAreaInitializerNewData(EditArea); //var list = AgentHelper.CreateListFromSingleObject<DP_DataRepository>(newData); //if (EditArea.AreaInitializer.SourceRelationColumnControl == null) //{ // EditArea.AreaInitializer.Datas.Add(newData); //} //else //{ // EditArea.ChildRelationshipInfo.RelatedData.Add(newData); //} EditArea.AddData(newData, true); //EditArea.ShowDataInDataView(list, false); }
private void llblCollectorType_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { if (MessageBox.Show("Are you sure you want to change the Collector type?\r\n\r\nIf you continue this will reset any existing configuration.", "Collector type", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation) == System.Windows.Forms.DialogResult.Yes) { List <ConfigVariable> configVars = new List <ConfigVariable>(); foreach (ConfigVariable cv in currentEditingEntry.ConfigVariables) { configVars.Add(cv.Clone()); } CollectorEntry newCollector = AgentHelper.CreateNewCollector((from c in monitorPack.Collectors where c.UniqueId == currentEditingEntry.ParentCollectorId select c).FirstOrDefault()); if (newCollector != null) { currentEditingEntry = null; currentEditingEntry = newCollector; currentEditingEntry.ConfigVariables = configVars; llblCollectorType.Text = currentEditingEntry.CollectorRegistrationDisplayName; ApplyConfigToControls(); if (AgentHelper.LastShowRawEditOnStartOption) { llblRawEdit_LinkClicked(sender, e); } } } }
public async Task InsertUserArtifactIDBatchIntoExportWorkerQueueTableAsync(ExportManagerQueueRecord exportManagerQueueRecord, String exportResultsTableName, QueryResultSet <kCura.Relativity.Client.DTOs.User> users) { var currentTime = DateTime.UtcNow; var dt = new DataTable(); dt.Columns.Add(Constant.Sql.ColumnsNames.ExportWorkerQueue.WorkspaceArtifactId, typeof(Int32)); dt.Columns.Add(Constant.Sql.ColumnsNames.ExportWorkerQueue.ExportJobArtifactId, typeof(Int32)); dt.Columns.Add(Constant.Sql.ColumnsNames.ExportWorkerQueue.ObjectType, typeof(String)); dt.Columns.Add(Constant.Sql.ColumnsNames.ExportWorkerQueue.Priority, typeof(Int32)); dt.Columns.Add(Constant.Sql.ColumnsNames.ExportWorkerQueue.WorkspaceResourceGroupArtifactId, typeof(Int32)); dt.Columns.Add(Constant.Sql.ColumnsNames.ExportWorkerQueue.QueueStatus, typeof(Int32)); dt.Columns.Add(Constant.Sql.ColumnsNames.ExportWorkerQueue.ArtifactId, typeof(Int32)); dt.Columns.Add(Constant.Sql.ColumnsNames.ExportWorkerQueue.ResultsTableName, typeof(String)); dt.Columns.Add(Constant.Sql.ColumnsNames.ExportWorkerQueue.MetaData, typeof(String)); dt.Columns.Add(Constant.Sql.ColumnsNames.ExportWorkerQueue.TimeStampUtc, typeof(DateTime)); try { foreach (var user in users.Results) { dt.Rows.Add(exportManagerQueueRecord.WorkspaceArtifactId, exportManagerQueueRecord.ExportJobArtifactId, exportManagerQueueRecord.ObjectType, exportManagerQueueRecord.Priority, exportManagerQueueRecord.WorkspaceResourceGroupArtifactId, Constant.Status.Queue.NOT_STARTED, user.Artifact.ArtifactID, exportResultsTableName, String.Empty, currentTime); } await SqlQueryHelper.BulkInsertIntoTableAsync(AgentHelper.GetDBContext(-1), dt, Constant.Tables.ExportWorkerQueue, Constant.BatchSizes.ExportManagerIntoWorkerQueue); } catch (Exception ex) { throw new AdminMigrationUtilityException(Constant.ErrorMessages.UnableToInsertUserArtifactIDsIntoWorkerQueue, ex); } }
public async Task AttachFileToExportJobAsync(ExportManagerQueueRecord exportManagerQueueRecord, String fileLocation) { try { Int32 fileFieldArtifactId = await ArtifactQueries.RetrieveFieldArtifactIdByGuid( rsapiApiOptions : RsapiApiOptions, workspaceArtifactId : exportManagerQueueRecord.WorkspaceArtifactId, fieldRepository : RsapiRepositoryGroup.FieldRepository, fieldGuid : Constant.Guids.Field.ExportUtilityJob.ExportFile ); await ArtifactQueries.AttachFileToExportJob( rsapiClient : AgentHelper.GetServicesManager().CreateProxy <IRSAPIClient>(ExecutionIdentity.CurrentUser), rsapiApiOptions : RsapiApiOptions, workspaceArtifactId : exportManagerQueueRecord.WorkspaceArtifactId, exportJobArtifactId : exportManagerQueueRecord.ExportJobArtifactId, fileFieldArtifactId : fileFieldArtifactId, fileLocation : fileLocation ); } catch (Exception ex) { throw new AdminMigrationUtilityException(Constant.ErrorMessages.AttachFileToExportJobError, ex); } }
public async Task <List <ExportWorkerResultsTableRecord> > QueryBatchFromExportResultsTableAsync(ExportManagerQueueRecord exportManagerQueueRecord) { try { DataTable dataTable = await SqlQueryHelper.RetrieveBatchFromExportWorkerResultsTableAsync( eddsDbContext : AgentHelper.GetDBContext(-1), agentId : exportManagerQueueRecord.AgentId.GetValueOrDefault(), batchSize : Constant.BatchSizes.ExportManagerCSVQuery, exportResultsTableName : exportManagerQueueRecord.ResultsTableName); List <ExportWorkerResultsTableRecord> exportWorkerResultsTableRecords = new List <ExportWorkerResultsTableRecord>(); if (dataTable?.Rows != null && dataTable.Rows.Count > 0) { foreach (DataRow currentDataRow in dataTable.Rows) { ExportWorkerResultsTableRecord newExportWorkerResultsTableRecord = new ExportWorkerResultsTableRecord(currentDataRow); exportWorkerResultsTableRecords.Add(newExportWorkerResultsTableRecord); } } return(exportWorkerResultsTableRecords); } catch (Exception ex) { throw new AdminMigrationUtilityException(Constant.ErrorMessages.QueryBatchFromExportWorkerResultsTableError, ex); } }
public void Execute(I_SearchViewEntityArea packageArea) { var list = new List <DP_DataRepository>(); Random rnd = new Random(); var nItem = AgentHelper.CreateEditTemplateNewData(packageArea.ViewTemplate); foreach (var item in nItem.DataInstance.Properties) { item.Value = "i" + rnd.Next(1, 13); } var nItem1 = AgentHelper.CreateEditTemplateNewData(packageArea.ViewTemplate); foreach (var item in nItem1.DataInstance.Properties) { item.Value = "i" + rnd.Next(4, 22); } var nItem2 = AgentHelper.CreateEditTemplateNewData(packageArea.ViewTemplate); foreach (var item in nItem2.DataInstance.Properties) { item.Value = "i" + rnd.Next(3, 7); } list.Add(nItem); list.Add(nItem1); list.Add(nItem2); packageArea.AddData(list, true); }
protected override void Process([NotNull] InstallArgs args) { Assert.ArgumentNotNull(args, "args"); Assert.IsNotNull(args.Instance, "Instance"); AgentHelper.DeleteAgentFiles(args.Instance); }
private async Task <Boolean> AfterProcessingAllLinesAsync() { string errorContext = $"An error occured when updating total redaction count on the import job. [ImportJobArtifactId: {_importJobArtifactId}]"; try { //update import file redaction count field on import job await ArtifactQueries.UpdateImportJobRedactionCountFieldValueAsync( AgentHelper.GetServicesManager(), ExecutionIdentity.CurrentUser, WorkspaceArtifactId, _importJobArtifactId, Constant.Guids.Field.MarkupUtilityImportJob.ImportFileRedactionCount, _importFileRedactionCount); RaiseMessage($"Updated import file redaction count ({_importFileRedactionCount})"); //update expected redaction count field on import job await ArtifactQueries.UpdateImportJobRedactionCountFieldValueAsync( AgentHelper.GetServicesManager(), ExecutionIdentity.CurrentUser, WorkspaceArtifactId, _importJobArtifactId, Constant.Guids.Field.MarkupUtilityImportJob.ExpectedRedactionCount, _expectedRedactionCount); RaiseMessage($"Updated expected redaction count ({_expectedRedactionCount})"); } catch (Exception ex) { throw new MarkupUtilityException(errorContext, ex); } return(true); }
/// <summary> /// This method is used to get the new LiveSpyPage based on Context and Agent /// </summary> /// <returns></returns> private void LoadLiveSpyPage(Context context) { this.Dispatcher.Invoke(() => { bool isLoaded = false; if (mLiveSpyPageDictonary != null && mLiveSpyPageDictonary.Count > 0 && context.Agent != null) { AgentPageMappingHelper objHelper = mLiveSpyPageDictonary.Find(x => x.ObjectAgent.DriverType == context.Agent.DriverType && x.ObjectAgent.ItemName == context.Agent.ItemName); if (objHelper != null && objHelper.ObjectWindowPage != null) { mCurrentLoadedPage = (LiveSpyPage)objHelper.ObjectWindowPage; isLoaded = true; } } if (!isLoaded) { ApplicationAgent appAgent = AgentHelper.GetAppAgent(mContext.BusinessFlow.CurrentActivity, mContext.Runner, mContext); if (appAgent != null) { mCurrentLoadedPage = new LiveSpyPage(mContext, mDriver); if (mLiveSpyPageDictonary == null) { mLiveSpyPageDictonary = new List <AgentPageMappingHelper>(); } mLiveSpyPageDictonary.Add(new AgentPageMappingHelper(context.Agent, mCurrentLoadedPage)); } } xSelectedItemFrame.Content = mCurrentLoadedPage; }); }
/// <summary> /// This method is used to get the new WindowExplorerPage based on Context and Agent /// </summary> /// <returns></returns> private void LoadWindowExplorerPage() { this.Dispatcher.Invoke(() => { bool isLoaded = false; if (mWinExplorerPageList != null && mWinExplorerPageList.Count > 0) { AgentPageMappingHelper objHelper = mWinExplorerPageList.Where(x => x.ObjectAgent.DriverType == mContext.Agent.DriverType && x.ObjectAgent.ItemName == mContext.Agent.ItemName).FirstOrDefault(); if (objHelper != null && objHelper.ObjectWindowPage != null) { mCurrentLoadedPage = (WindowExplorerPage)objHelper.ObjectWindowPage; isLoaded = true; } } if (!isLoaded) { ApplicationAgent appAgent = AgentHelper.GetAppAgent(mContext.BusinessFlow.CurrentActivity, (GingerExecutionEngine)mContext.Runner, mContext); if (appAgent != null) { mCurrentLoadedPage = new WindowExplorerPage(appAgent, mContext); mCurrentLoadedPage.SetDriver(WindowExplorerDriver); if (mWinExplorerPageList == null) { mWinExplorerPageList = new List <AgentPageMappingHelper>(); } mWinExplorerPageList.Add(new AgentPageMappingHelper(mContext.Agent, mCurrentLoadedPage)); } } xSelectedItemFrame.Content = mCurrentLoadedPage; }); }
public void ProcessAccount(Guid accountId, AccountDbContext accountDbContext, ILogger logger) { var dispatcher = AgentHelper.GetDispatcherClient(); var repository = accountDbContext.GetComponentRepository(); var components = repository.QueryAll() .Select(t => new { t.Id, t.SystemName }) .ToArray(); logger.Debug("Найдено компонентов: " + components.Length); foreach (var component in components) { DbProcessor.CancellationToken.ThrowIfCancellationRequested(); var response = dispatcher.UpdateComponentState(accountId, component.Id); if (response.Success) { Interlocked.Increment(ref UpdateStatesCount); logger.Debug("ComponentId: {0} name {1}; Обновлен успешно.", component.Id, component.SystemName); } else { DbProcessor.SetException(new Exception(response.ErrorMessage)); logger.Error("ComponentId: {0} name {1}; Ошибка проверки: {2}", component.Id, component.SystemName, response.ErrorMessage); } } }
private async Task GetOffHoursTimesAsync() { try { RaiseAndLogDebugMessage("Retrieving off hours."); DataTable dataTable = await SqlQueryHelper.RetrieveOffHoursAsync(AgentHelper.GetDBContext(-1)); if (dataTable?.Rows == null || dataTable.Rows.Count == 0 || String.IsNullOrEmpty(dataTable.Rows[0]["AgentOffHourStartTime"].ToString()) || String.IsNullOrEmpty(dataTable.Rows[0]["AgentOffHourEndTime"].ToString()) || dataTable.Rows[0]["AgentOffHourStartTime"] == null || dataTable.Rows[0]["AgentOffHourEndTime"] == null) { throw new AdminMigrationUtilityException(Constant.Messages.Agent.AGENT_OFF_HOURS_NOT_FOUND); } OffHoursStartTime = dataTable.Rows[0]["AgentOffHourStartTime"].ToString(); OffHoursEndTime = dataTable.Rows[0]["AgentOffHourEndTime"].ToString(); RaiseAndLogDebugMessage("Retrieved off hours."); } catch (Exception ex) { throw new AdminMigrationUtilityException(Constant.ErrorMessages.RetrieveOffHoursError, ex); } }
public async Task FinishAsync() { RaiseMessage($"Removing record(s) from the queue. [Table = {QueueTable}, ID = {RecordId}, Workspace Artifact ID = {WorkspaceArtifactId}]"); await QueryHelper.RemoveRecordFromTableByIdAsync(AgentHelper.GetDBContext(-1), QueueTable, RecordId); RaiseMessage($"Removed record(s) from the queue. [Table = {QueueTable}, ID = {RecordId}, Workspace Artifact ID = {WorkspaceArtifactId}]"); }
public async Task DeleteRecordFromReproduceWorkerQueueAsync(int id) { RaiseMessage($"Deleting record from ReproduceWorkerQueue. [ID = {id}, Workspace Artifact ID = {WorkspaceArtifactId}, Agent ID = {AgentId}]"); await QueryHelper.RemoveRecordFromReproduceWorkerQueueAsync(AgentHelper.GetDBContext(-1), id); RaiseMessage($"Deleted record from ReproduceWorkerQueue. [ID = {id}, Workspace Artifact ID = {WorkspaceArtifactId}, Agent ID = {AgentId}]"); }
private async Task RemoveRecordsFromImportWorkerQueueTableAsync() { RaiseMessage($"Removing record(s) from the queue. [Table = {QueueTable}, ID = {RecordId}, Workspace Artifact ID = {WorkspaceArtifactId}]"); await QueryHelper.RemoveBatchFromImportWorkerQueueAsync(AgentHelper.GetDBContext(-1), BatchTableName); RaiseMessage($"Removed record(s) from the queue. [Table = {QueueTable}, ID = {RecordId}, Workspace Artifact ID = {WorkspaceArtifactId}]"); }
private async Task UpdateMarkupSetMultipleChoiceFieldValueAsync(int documentArtifactId, int markupType) { const string errorContext = "An error occured when updating markup set multiple choice field value."; try { int choiceArtifactId; switch (markupType) { case Constant.MarkupType.Redaction.VALUE: choiceArtifactId = _hasRedactionsChoiceModel.ArtifactId; break; case Constant.MarkupType.Highlight.VALUE: choiceArtifactId = _hasHighlightsChoiceModel.ArtifactId; break; default: throw new MarkupUtilityException($"Invalid Markup Type. [MarkupType = {markupType}]. {errorContext}"); } await QueryHelper.UpdateMarkupSetMultipleChoiceFieldAsync( AgentHelper.GetDBContext(WorkspaceArtifactId), documentArtifactId, _markupSetMultiplechoiceFieldChoiceTypeId, choiceArtifactId); } catch (Exception ex) { throw new MarkupUtilityException($"{errorContext}", ex); } }
public async Task FinishAsync() { RaiseMessage($"Dropping batch table. [BatchTableName = {BatchTableName}]"); await QueryHelper.DropTableAsync(AgentHelper.GetDBContext(-1), BatchTableName); RaiseMessage($"Dropped batch table. [BatchTableName = {BatchTableName}]"); }
private async Task UpdateRedactionCountFieldValueAsync(Guid countFieldGuid) { var countFieldName = await GetCountFieldNameAsync(countFieldGuid); var countFieldValue = await GetCountFieldValueAsync(countFieldGuid); RaiseMessage($"Retrieving current {countFieldName}"); //retrieve imported redaction count field on import job var currentRedactionCount = await ArtifactQueries.RetrieveImportJobRedactionCountFieldValueAsync( AgentHelper.GetServicesManager(), _executionIdentity, WorkspaceArtifactId, _importJobArtifactId, countFieldGuid); RaiseMessage($"Current {countFieldName} = {currentRedactionCount}"); var newRedactionCount = currentRedactionCount + countFieldValue; RaiseMessage($"New {countFieldName} = {newRedactionCount}"); RaiseMessage($"Updating current {countFieldName}"); //update imported redaction count field on import job await ArtifactQueries.UpdateImportJobRedactionCountFieldValueAsync( AgentHelper.GetServicesManager(), _executionIdentity, WorkspaceArtifactId, _importJobArtifactId, countFieldGuid, newRedactionCount); RaiseMessage($"Updated {countFieldName}"); }
private void CalculateFilterValues() { FilterCalculationError = null; CurrentValues.Clear(); try { if (AreaInitializer.SourceEditArea.ChildRelationshipInfo != null) { if (RelationshipFilters != null && RelationshipFilters.Any()) { foreach (var filter in RelationshipFilters) { var value = AgentHelper.GetValueSomeHow(AreaInitializer.SourceEditArea.ChildRelationshipInfo.ParentData, filter.ValueRelationshipTail, filter.ValueColumnID); if (!string.IsNullOrEmpty(value)) { CurrentValues.Add(new Tuple <int, string>(filter.ID, value)); } } } } } catch (Exception ex) { FilterCalculationError = ex; } }
protected override void Process([NotNull] InstallArgs args) { Assert.ArgumentNotNull(args, nameof(args)); Assert.IsNotNull(args.Instance, "Instance"); AgentHelper.CopyPackages(args.Instance, args.Modules); }
public LogicPhraseDTO GetQuickSearchLogicPhrase(string text, EntitySearchDTO entitySearch) { LogicPhraseDTO quickSearchLogic = new LogicPhraseDTO(); quickSearchLogic.AndOrType = AndOREqualType.Or; foreach (var item in entitySearch.EntitySearchAllColumns) { if (item.ColumnID != 0) { SearchProperty searchProperty = new SearchProperty(); searchProperty.SearchColumnID = item.ID; searchProperty.ColumnID = item.ColumnID; searchProperty.IsKey = item.Column.PrimaryKey; searchProperty.Value = text; LogicPhraseDTO logic = null; if (item.RelationshipTail == null) { logic = quickSearchLogic; } else { logic = AgentHelper.GetOrCreateSearchRepositoryFromRelationshipTail(quickSearchLogic, item.RelationshipTail, null); logic.AndOrType = AndOREqualType.Or; } int n; var isNumeric = int.TryParse(text, out n); DateTime a; var isDateTime = DateTime.TryParse(text, out a); if (item.Column.ColumnType == Enum_ColumnType.Numeric) { if (!isNumeric) { continue; } searchProperty.Operator = CommonOperator.Equals; } else if (item.Column.ColumnType == Enum_ColumnType.Date) { continue; } else if (item.Column.ColumnType == Enum_ColumnType.Boolean) { continue; } else if (item.Column.ColumnType == Enum_ColumnType.String) { searchProperty.Operator = CommonOperator.Contains; } else { continue; } logic.Phrases.Add(searchProperty); } } return(quickSearchLogic); }