Exemple #1
0
        private string AddDbOp(Article article, DbOpType opType)
        {
            string db_file_path = DbFilePath;

            article.Html = null;
            string opId = Guid.NewGuid().ToString();

            var op = new DbOp
            {
                Id = opId,
                Op = opType,
            };

            switch (opType)
            {
            case DbOpType.Add:
                op.Article = article;
                break;

            case DbOpType.Delete:
                op.ArticleId = article.Id;
                break;

            default:
                break;
            }

            using (TextWriter writer =
                       new StreamWriter(new FileStream(db_file_path, FileMode.Append, FileAccess.Write)))
            {
                writer.WriteLine(JsonConvert.SerializeObject(op));
            }

            return(op.Id);
        }
 protected void AddTraceRow(DbOpType type, string columnName, string tablename, string keyValue, object oleValue, object newValue, string description)
 {
     this.AddTraceRow(type, columnName, tablename, keyValue, oleValue, newValue)[TraceUtil.FLD_MEMO] = description;
 }
 protected void AddTraceRow(DbOpType type, string tablename, string keyValue, string description)
 {
     this.AddTraceRow(type, tablename, keyValue)[TraceUtil.FLD_MEMO] = description;
 }
 protected DataRow AddTraceRow(DbOpType type, string columnName, string tablename, string keyValue, object oleValue, object newValue)
 {
     DataRow row = this.AddTraceRow(type, tablename, keyValue);
     row[TraceUtil.FLD_FIELD] = columnName;
     row[TraceUtil.FLD_OLD] = oleValue;
     row[TraceUtil.FLD_NEW] = newValue;
     return row;
 }
 protected DataRow AddTraceRow(DbOpType type, string tablename, string keyValue)
 {
     DataRow row = this.TraceTable.NewRow();
     row[TraceUtil.FLD_TIMESTAMP] = this.traceTime;
     row[TraceUtil.FLD_STAFFFID] = this.OpStaffId;
     row[TraceUtil.FLD_STAFFNAME] = this.OpStaffName;
     row[TraceUtil.FLD_TYPE] = type;
     row[TraceUtil.FLD_TABLE] = tablename;
     row[TraceUtil.FLD_KEY] = keyValue;
     this.TraceTable.Rows.Add(row);
     return row;
 }