/// <summary> /// Retrieves process published copy. /// </summary> /// <param name="processGuid">The process GUID.</param> /// <param name="fetchHistory">The fetch history.</param> /// <returns>The <see cref="ProcessEditDto" />.</returns> public ProcessEditDto FetchProcessPublishedCopy(Guid processGuid, IProcessFetchHistory fetchHistory) { var process = new ProcessEditDto(); using (var ctx = ConnectionManager<SqlConnection>.GetManager(Database.VeyronMeta, false)) { var cn = ctx.Connection; const string CommandText = @" SELECT [p].[Id] ,[p].[Name] ,[p].[Description] ,[p].[Documentation] ,[p].[SystemName] ,[p].[IconId] FROM [dbo].[Processes] p WHERE p.Guid = @guid AND IsPublishedCopy = 1 AND IsRemoved = 0"; using (var cmd = new SqlCommand(CommandText, cn)) { cmd.Parameters.AddWithValue("@guid", processGuid); return ReadPublishedProcess(process, cmd, processGuid) ? null : this.FetchProcess(process.Id, fetchHistory); } } }
/// <summary> /// Retrieves process published copy. /// </summary> /// <param name="assemblyName">The assembly name.</param> /// <param name="fetchHistory">The fetch history.</param> /// <returns>The <see cref="ProcessEditDto" />.</returns> public ProcessEditDto FetchProcessPublishedCopy(string assemblyName, IProcessFetchHistory fetchHistory) { var process = new ProcessEditDto(); using (var ctx = ConnectionManager<SqlConnection>.GetManager(Database.VeyronMeta, false)) { var cn = ctx.Connection; const string CommandText = @" SELECT [p].[Id], [p].[Name], [p].[Description], [p].[Documentation], [p].[SystemName], [p].[IconId], [pp].ProcessGuid as Guid FROM [dbo].[Processes] p LEFT OUTER JOIN PublishedProcesses pp ON pp.ProcessId = p.Id WHERE pp.AssemblyName = @assemblyName AND IsPublishedCopy = 1 AND isRemoved = 0"; using (var cmd = new SqlCommand(CommandText, cn)) { cmd.Parameters.AddWithValue("@assemblyName", assemblyName); return ReadPublishedProcess(process, cmd) ? null : this.FetchProcess(process.Id, fetchHistory); } } }
/// <summary> /// Retrieves the process. /// </summary> /// <param name="id">The process id.</param> /// <param name="fetchHistory">The fetch history.</param> /// <param name="locId">The localization/language id.</param> /// <returns>The processEdit DTO object <see cref="ProcessEditDto" />.</returns> public ProcessEditDto FetchProcess(int id, IProcessFetchHistory fetchHistory = null, int locId = 0) { var process = new ProcessEditDto(); const string commandText = "GetProcessWithLoc"; if (fetchHistory != null) fetchHistory.BeginLogExecuteSP(); Database.GetDataReader( commandText, 600, r => { if (r == null || !r.Read()) { return; } var sr = new SafeDataReader(r); process.Id = sr.GetInt("Id"); process.Name = sr.GetString("Name").Trim(); process.Description = sr.GetString("Description"); process.Documentation = sr.GetString("Documentation"); process.SystemName = sr.GetString("SystemName"); process.IconId = sr.GetNullableInt("IconId"); process.Guid = sr.GetGuid("Guid"); process.IsPublishedCopy = sr.GetBool("IsPublishedCopy"); process.BaseProcessId = sr.GetNullableInt("BaseProcessId"); process.BaseProcessProcessId = sr.GetNullableInt("BaseProcessProcessId"); process.ProcessOption = sr.GetString("ProcessOption"); process.IsStateEnabled = sr.GetBool("IsStateEnabled", true); process.DefaultStateId = sr.GetInt32("DefaultStateId"); process.AllowPaperclips = sr.GetBool("AllowPaperclips", true); process.ColorId = sr.GetNullableInt("ColorId"); process.InheritanceContext = sr.GetString("InheritanceContext"); process.ShowDerivedProcess = sr.GetBool(Constants.ShowDerivedProcess); process.PublishedProcessId = sr.GetInt("PublishedProcessId"); process.PublishedId = sr.GetInt("PublishedId"); process.IsSystem = sr.GetBool("IsSystem"); process.SimpleProcess = sr.GetBool("SimpleProcess"); process.IsInactive = sr.GetBool("IsInactive"); process.IsTabbedUI = sr.GetBool("IsTabbedUI"); process.IsTrackable = sr.GetBool("IsTrackable"); process.ShowSummaryPage = sr.GetBool("ShowSummaryPage"); process.AllowBatchProcessing = sr.GetBool("AllowBatchProcessing"); process.LastUpdated = sr.GetDateTime("LastUpdated"); process.IdentifierField = sr.GetString("IdentifierField"); var processVersionId = sr.GetInt("ProcessVersionId"); if (fetchHistory != null) fetchHistory.LogExecuteSP(); if (processVersionId > 0) { process.Version = new VersionDto { ProcessId = processVersionId, VersioningStyle = sr.GetEnum("VersioningStyle", VersioningStyles.Char), StartingVersion = sr.GetString("StartingVersion"), NextVersionStateGuid = sr.GetGuid("NextVersionStateGuid"), PreviousVersionStateGuid = sr.GetGuid("PreviousVersionStateGuid"), IncludeVersionNumberInList = sr.GetBool("IncludeVersionNumberInList"), IncludeVersionDateInList = sr.GetBool("IncludeVersionDateInList"), StateFilterGuid = sr.GetGuid("StateFilterGuid") }; } if (fetchHistory != null) fetchHistory.ProcessHistoryDTO.FetchSectionsTime = Profiler.Profile(() => ReadSections(process, sr)); else ReadSections(process, sr); ReadRequiredRuleConfigs(process, sr); if (fetchHistory != null) fetchHistory.ProcessHistoryDTO.FetchSecurityConfigurationsTime = fetchHistory.Profile( () => { ReadProcessSecurityConfigurations(process, sr); ReadProcessSecurityConfigs(process, sr); }); else { ReadProcessSecurityConfigurations(process, sr); ReadProcessSecurityConfigs(process, sr); } ReadStates(process, sr); ReadEscalationActionOptions(process, sr); ReadAssignmentActionOptions(process, sr); ReadApprovalActionOptions(process, sr); ReadActionRules(process, sr); ReadFilters(process, sr); ReadMetrics(process, sr); ReadKpis(process, sr); ReadCommands(process, sr); ReadESyncProcesses(process, sr); ReadReports(process, sr); ReadProcessViews(process, sr); ReadDataTriggers(process, sr); ReadIntegrationServices(process, sr); ReadSearchDisplayFields(process, sr); ReadLayouts(process, sr); ReadProcessDataIndexes(process, sr); ReadExternalData(process, sr); }, CommandType.StoredProcedure, new SqlParameter("p_id", id), new SqlParameter("localizationId", locId)); // run after GetProcessNew this.ReadDependencies(process); return process; }