/// <summary> /// Updates process data index. /// </summary> /// <param name="dto">The DTO object.</param> /// <param name="locDto">The localization DTO object.</param> /// <exception cref="System.ArgumentException"></exception> /// <exception cref="System.Data.DBConcurrencyException"></exception> /// <exception cref="DBConcurrencyException">Indicates stale data.</exception> public void UpdateProcessDataIndexWithLocalization(ProcessDataIndexDto dto, ProcessDataIndexLocalizationDto locDto) { if (dto == null) throw new ArgumentException(string.Format(CultureInfo.InvariantCulture, Resources.NullArguementException, "dto")); const string CommandText = @" UPDATE [dbo].[ProcessDataIndex] SET [IsUnique] = @p_IsUnique ,[ExcludeRemovedItems] = @p_ExcludeRemovedItems ,[GuidId] = @p_GuidId WHERE [Id] = @p_Id; "; using (var ctx = ConnectionManager<SqlConnection>.GetManager(Database.VeyronMeta, false)) { var connection = ctx.Connection; using (var command = new SqlCommand(CommandText, connection)) { command.Parameters.AddWithValue("@p_Id", dto.Id); command.Parameters.AddWithValue("@p_IsUnique", dto.IsUniqueIndex); command.Parameters.AddWithValue("@p_ExcludeRemovedItems", dto.ExcludeRemovedItems); command.Parameters.AddWithValue("@p_GuidId", dto.GuidId); if (command.ExecuteNonQuery() == 0) { throw new DBConcurrencyException(Resources.StaleDataException); } } } UpdateProcessDataIndexLocalization(locDto); }
/* #region ProcessBuilber - Tab Search #region Search - Insert /// <summary> /// Inserts process search. /// </summary> /// <param name="dto">The DTO object.</param> /// <exception cref="System.ArgumentNullException">The input DTO is null.</exception> public void InsertProcessSearch(ProcessSearchEditDto dto) { if (dto == null) throw new ArgumentNullException(string.Format(CultureInfo.InvariantCulture, Resources.NullArguementException, "dto")); const string CommandText = @" INSERT INTO [dbo].[ProcessSearchFields] ( [ProcessId] ,[GuidId] ,[FieldSystemName] ,[Position] ,[Width] ,[ShowInList] ) VALUES ( @p_ProcessId ,@p_GuidId ,@p_FieldSystemName ,@p_Position ,@p_Width ,@p_ShowInList ); SELECT [Id] FROM [dbo].[ProcessSearchFields] WHERE [Id] = SCOPE_IDENTITY()"; using (var ctx = ConnectionManager<SqlConnection>.GetManager(Database.VeyronMeta, false)) { var connection = ctx.Connection; using (var command = new SqlCommand(CommandText, connection)) { command.Parameters.AddWithValue("@p_ProcessId", dto.ProcessId); command.Parameters.AddWithValue("@p_GuidId", dto.GuidId); command.Parameters.AddWithValue("@p_FieldSystemName", dto.FieldSystemName); command.Parameters.AddWithValue("@p_Position", dto.Position); command.Parameters.AddWithValue("@p_Width", dto.Width); command.Parameters.AddWithValue("@p_ShowInList", dto.ShowInList); dto.Id = (int)command.ExecuteScalar(); } } } #endregion Search - Insert #region Search - Update /// <summary> /// The update process search. /// </summary> /// <param name="dto">The DTO object.</param> /// <exception cref="System.ArgumentNullException">The input DTO is null.</exception> /// <exception cref="System.Data.DBConcurrencyException">Indicates stale data.</exception> public void UpdateProcessSearch(ProcessSearchEditDto dto) { if (dto == null) throw new ArgumentNullException(string.Format(CultureInfo.InvariantCulture, Resources.NullArguementException, "dto")); const string CommandText = @" UPDATE [dbo].[ProcessSearchFields] SET [GuidId] = @p_GuidId ,[FieldSystemName] = @p_FieldSystemName ,[Position] = @p_Position ,[Width] = @p_Width ,[ShowInList] = @p_ShowInList WHERE [Id] = @p_Id; "; using (var ctx = ConnectionManager<SqlConnection>.GetManager(Database.VeyronMeta, false)) { var connection = ctx.Connection; using (var command = new SqlCommand(CommandText, connection)) { command.Parameters.AddWithValue("@p_Id", dto.Id); command.Parameters.AddWithValue("@p_ProcessId", dto.ProcessId); command.Parameters.AddWithValue("@p_GuidId", dto.GuidId); command.Parameters.AddWithValue("@p_FieldSystemName", dto.FieldSystemName); command.Parameters.AddWithValue("@p_Position", dto.Position); command.Parameters.AddWithValue("@p_Width", dto.Width); command.Parameters.AddWithValue("@p_ShowInList", dto.ShowInList); if (command.ExecuteNonQuery() == 0) { throw new DBConcurrencyException(Resources.StaleDataException); } } } } #endregion Search - Update #region Saerch - Delete /// <summary> /// Deletes process search. /// </summary> /// <param name="id">The Process Search id.</param> /// <exception cref="System.Data.DBConcurrencyException">Indicates stale data.</exception> public void DeleteProcessSearch(int id) { var commandText = @"DELETE FROM [dbo].[ProcessSearchFields] WHERE [Id] = " + id; using (var ctx = ConnectionManager<SqlConnection>.GetManager(Database.VeyronMeta, false)) { var connection = ctx.Connection; using (var command = new SqlCommand(commandText, connection)) { if (command.ExecuteNonQuery() == 0) { throw new DBConcurrencyException(Resources.StaleDataException); } } } } #endregion Search - Delete #endregion ProcessBuilber - Tab Search */ #region ProcessBuilder - Tab Data Index /// <summary> /// Inserts process data index. /// </summary> /// <param name="dto">The DTO object.</param> /// <exception cref="System.ArgumentNullException"></exception> /// <exception cref="System.ArgumentException">The input DTO is null.</exception> public void InsertProcessDataIndex(ProcessDataIndexDto dto) { if (dto == null) throw new ArgumentNullException(string.Format(CultureInfo.InvariantCulture, Resources.NullArguementException, "dto")); const string CommandText = @" INSERT INTO [dbo].[ProcessDataIndex] ( [ProcessId] ,[Name] ,[Notes] ,[ExcludeRemovedItems] ,[IsUnique] ,[ValidationMessage] ,[GuidId] ) VALUES ( @p_ProcessId ,@p_Name ,@p_Notes ,@p_ExcludeRemovedItems ,@p_IsUnique ,@p_ValidationMessage ,@p_GuidId ); SELECT [Id] FROM [dbo].[ProcessDataIndex] WHERE [Id] = SCOPE_IDENTITY()"; using (var ctx = ConnectionManager<SqlConnection>.GetManager(Database.VeyronMeta, false)) { var connection = ctx.Connection; using (var command = new SqlCommand(CommandText, connection)) { command.Parameters.AddWithValue("@p_ProcessId", dto.ProcessId); command.Parameters.AddWithValue("@p_Name", dto.Name); command.Parameters.AddWithValue("@p_Notes", dto.Notes); command.Parameters.AddWithValue("@p_ExcludeRemovedItems", dto.ExcludeRemovedItems); command.Parameters.AddWithValue("@p_IsUnique", dto.IsUniqueIndex); command.Parameters.AddWithValue("@p_ValidationMessage", dto.ViolationMessage); command.Parameters.AddWithValue("@p_GuidId", dto.GuidId); dto.Id = (int)command.ExecuteScalar(); } } }