public Instance[] AnalyseInstance(JArray objs, JObject inherited, string path) { List <IntegrationInstance> instances = new List <IntegrationInstance>(); foreach (JObject obj in objs) { IntegrationTable[][] tables = AnalyseTable($"{path}\\{GetJValue(obj, inherited, "tables")}", out string parms); IntegrationTask[][] tasks = new IntegrationTask[tables.Length][]; List <IntegrationTask> taskList = new List <IntegrationTask>(); for (int i = 0; i < tasks.Length; i++) { if (tables[i].Length > 0) { tasks[i] = new IntegrationTask[tables[i].Length]; for (int j = 0; j < tasks[i].Length; j++) { IntegrationTask task = new IntegrationTask() { Name = tables[i][j].DestName, Progress = 0, Total = 0, Status = DataStates.Idle, StartTick = 0, Sources = AnalyseDatabases(obj["sources"] as JArray, inherited), Dest = AnalyseDatabase(obj["dest"] as JObject, inherited), Params = parms, Table = tables[i][j], ReadPages = uint.Parse(GetJValue(obj, inherited, "readPages")) }; taskList.Add(task); tasks[i][j] = task; } } } if (taskList.Count > 0) { IntegrationInstance ins = new IntegrationInstance() { Name = $"{taskList[0].Dest.Server}:{taskList[0].Dest.Port}/{taskList[0].Dest.DB}", Tasks = taskList.ToArray(), ActualTasks = tasks, Threads = uint.Parse(GetJValue(obj, inherited, "threads")) }; instances.Add(ins); } } return(instances.ToArray()); }
/// <summary> /// </summary> public static string GetClosedWonMappingField(int integrationInstanceId) { string cwTargetType = string.Empty, gpCWActualFieldName = "CW", gpCWType = "CW"; int integrationTypeId = 0; using (MRPEntities db = new MRPEntities()) { IntegrationInstance objInstance = new IntegrationInstance(); objInstance = db.IntegrationInstances.FirstOrDefault(instance => instance.IntegrationInstanceId == integrationInstanceId); integrationTypeId = objInstance.IntegrationTypeId; GameplanDataTypePull objGPTypePull = new GameplanDataTypePull(); objGPTypePull = db.GameplanDataTypePulls.FirstOrDefault(item => item.IntegrationTypeId == integrationTypeId && item.ActualFieldName == gpCWActualFieldName && item.Type == gpCWType && item.IsDeleted == false); int gpDataTypePullId = objGPTypePull != null ? objGPTypePull.GameplanDataTypePullId : 0; IntegrationInstanceDataTypeMappingPull objPUll = new IntegrationInstanceDataTypeMappingPull(); objPUll = db.IntegrationInstanceDataTypeMappingPulls.FirstOrDefault(item => item.IntegrationInstanceId == integrationInstanceId && item.GameplanDataTypePullId == gpDataTypePullId); cwTargetType = objPUll != null ? objPUll.TargetDataType : string.Empty; } return(cwTargetType); }