Ejemplo n.º 1
0
        public void WriteFieldChanged(long refMessage)
        {
            var openConnection = false;

            try
            {
                if (_cmdLogFields.Connection.State != ConnectionState.Open)
                {
                    openConnection = true;
                    _cmdLogFields.Connection.Open();
                }

                var data  = new DS.LogFieldChangedDataTable();
                var table = new DataTable(data.TableName);
                using (var stream = new MemoryStream())
                {
                    data.WriteXmlSchema(stream);
                    stream.Flush();
                    stream.Position = 0;
                    table.ReadXmlSchema(stream);
                }

                foreach (var row in ChangedFieldList)
                {
                    data.AddLogFieldChangedRow(refMessage, row.RowEntity, row.FieldName, (string)GetValue(row.OldValue), (string)GetValue(row.NewValue));
                }

                foreach (var row in data)
                {
                    table.Rows.Add(row.ItemArray);
                }

                using (var command = _cmdLogFields.Connection.CreateCommand())
                {
                    var parameter = command.CreateParameter();
                    parameter.ParameterName = "@data";
                    parameter.Value         = table;
                    command.Parameters.Add(parameter);
                    command.CommandText = "LOG_P_BulkInsertLogFieldChanged";
                    command.CommandType = CommandType.StoredProcedure;
                    command.ExecuteNonQuery();
                }

                ChangedFieldList.Clear();
            }
            finally
            {
                if (openConnection)
                {
                    _cmdLogFields.Connection.Close();
                }
            }
        }
Ejemplo n.º 2
0
        public void FieldChanged(string rowEntity, string fieldName, object oldValue, object newValue)
        {
            if (oldValue is Binary || newValue is Binary)
            {
                return;
            }

            var logChangedFieldEntry = new LogChangedFieldEntry(
                null, rowEntity, fieldName, oldValue, newValue);

            ChangedFieldList.Add(logChangedFieldEntry);
        }
Ejemplo n.º 3
0
        public void FieldChanged(string tableName, string tableNameKz, string rowEntity, string fieldName, string fieldNameKz, bool isDetailsViewVisible, object oldValue, object newValue)
        {
            if (oldValue is Binary || newValue is Binary)
            {
                return;
            }

            var logChangedFieldEntry = new LogChangedFieldEntry(
                tableName, tableNameKz, rowEntity, fieldName, fieldNameKz, isDetailsViewVisible, oldValue, newValue);

            ChangedFieldList.Add(logChangedFieldEntry);
        }
Ejemplo n.º 4
0
        public long?WriteLog(ILogMessageEntry logMessageEntry)
        {
            long?refMessage = null;

            if (EnabledLogTable.EnabledLog(logMessageEntry.MessageCodeAsLong, Transaction))
            {
                refMessage = WriteToDataBase(logMessageEntry);
            }
            ChangedFieldList.Clear();

            return(refMessage);
        }
Ejemplo n.º 5
0
        public long?WriteLog(LogMessageType messageCode, Func <ILogMessageEntry> log)
        {
            long?refMessage = null;

            if (EnabledLogTable.EnabledLog((long)messageCode, Transaction))
            {
                var logMessageEntry = log();
                if (logMessageEntry.MessageCodeAsLong == 0)
                {
                    logMessageEntry.MessageCodeAsLong = (long)messageCode;
                }
                refMessage = WriteToDataBase(logMessageEntry);
            }

            ChangedFieldList.Clear();

            return(refMessage);
        }
Ejemplo n.º 6
0
 public void ClearChangedFieldList()
 {
     ChangedFieldList.Clear();
 }