/// <summary>
        /// 获取记录
        /// </summary>
        /// <returns></returns>
        public List <OpLogModel> Get()
        {
            List <OpLogModel> Oplogs = new List <OpLogModel>();
            DataTable         dt     = GetAll();

            if (dt == null)
            {
                return(Oplogs);
            }

            foreach (DataRow row in dt.Rows)
            {
                OpLogModel oplog = new OpLogModel();
                oplog.ID       = Tools.TryConvertToInt32(row["ID"]);
                oplog.User     = row["User"].ToString();
                oplog.Operator = row["Operator"].ToString();
                oplog.DeviceID = row["DeviceID"].ToString();
                oplog.OpTime   = Convert.ToDateTime(row["OpTime"].ToString());
                oplog.OpType   = row["OpType"].ToString();
                oplog.Obj1     = row["Obj1"].ToString();
                oplog.Obj2     = row["Obj2"].ToString();
                oplog.Obj3     = row["Obj3"].ToString();
                oplog.Obj4     = row["Obj4"].ToString();

                Oplogs.Add(oplog);
            }

            return(Oplogs);
        }
示例#2
0
 //OpLog copy to Database
 private void listenClient_OnNewOpLog(OpLogModel oplog)
 {
     if (OpLogBll.Add(oplog) > 0)
     {
         //add oplog
         if (_currentPageId == (int)PageIdEnum.DeviceOperationLog && m_lastfrm != null)
         {
             UCOperateLog uCOperateLog = (UCOperateLog)m_lastfrm;
             uCOperateLog.RefreshData();
         }
     }
 }
        /// <summary>
        /// 新增
        /// </summary>
        /// <param name="oplog"></param>
        /// <returns></returns>
        public int Add(OpLogModel oplog)
        {
            string sql = string.Format(@"
insert into OpLog(
         Operator,OpTime,OpType,User,Obj1,Obj2,Obj3,Obj4,DeviceID
) values (
         @Operator,@OpTime,@OpType,@User,@Obj1,@Obj2,@Obj3,@Obj4,@DeviceID
);");

            SQLiteParameter[] parameters =
            {
                new SQLiteParameter("@Operator", oplog.Operator),
                new SQLiteParameter("@OpTime",   oplog.OpTime),
                new SQLiteParameter("@OpType",   oplog.OpType),
                new SQLiteParameter("@User",     oplog.User),
                new SQLiteParameter("@Obj1",     oplog.Obj1),
                new SQLiteParameter("@Obj2",     oplog.Obj2),
                new SQLiteParameter("@Obj3",     oplog.Obj3),
                new SQLiteParameter("@Obj4",     oplog.Obj4),
                new SQLiteParameter("@DeviceID", oplog.DeviceID)
            };

            return(SqliteHelper.ExecuteNonQuery(sql, parameters));
        }
示例#4
0
 /// <summary>
 /// 新增
 /// </summary>
 /// <param name="oplog"></param>
 /// <returns></returns>
 public int Add(OpLogModel oplog)
 {
     return(_dal.Add(oplog));
 }