Пример #1
0
        // Add record
        // e.g. AddRecord("Fee", 40219, "my data before update", Image.Before)
        public void AddRecord(JournalModel journalModel)
        {
            switch (journalModel.Operation.ToString())
            {
            case "Insert":
            case "Update":
            case "Delete":
                if (journalModel.Image.ToString() != "Before")
                {
                    if (journalModel.Result.ToString() == "OK")
                    {
                        _count_OK += 1;
                    }
                    else
                    {
                        _count_ER += 1;
                    }
                }
                break;

            default:
                ResetCounters();
                break;
            }

            // User name
            if (string.IsNullOrEmpty(journalModel.UserName))
            {
                journalModel.UserName = Environment.UserName;
            }

            _journalId += 1;
            _journal.Rows.Add(journalModel.UserName, _journalId, DateTime.UtcNow.ToLocalTime().ToString("yyyy-MM-dd HH:mm:ss.fff "), journalModel.Source.ToString(), journalModel.Entity, journalModel.Key, journalModel.Image.ToString(), journalModel.Operation.ToString(), journalModel.Result.ToString(), _count_OK.ToString(), _count_ER.ToString(), journalModel.Data, journalModel.UserParameter, journalModel.SpareKey1, journalModel.SpareKey2);
            //_journal.Rows.Add(_journalId, DateTime.UtcNow.ToLocalTime().ToString("yyyy-MM-dd HH:mm:ss.fff "), source.ToString(), entity, key, image.ToString(), oper.ToString(), result.ToString(), _count_OK.ToString(), _count_ER.ToString(), data, userparm, sparekey1, sparekey2);
        }
Пример #2
0
 public void AddRecord(JournalModel journalModel, bool result)
 {
     journalModel.Result = result ? JournalResult.OK : JournalResult.ER;
     AddRecord(journalModel);
 }
Пример #3
0
 public void AddRecord(JournalModel journalModel, int result)
 {
     journalModel.Result = result < -1 ? JournalResult.ER : JournalResult.OK;
     AddRecord(journalModel);
 }