Beispiel #1
0
        private static Logger logger         = NLog.LogManager.GetCurrentClassLogger(); //使用NLog功能

        /// <summary>
        /// 取得 Member Access Sys Log
        /// </summary>
        public static Log_MemberAccessSysModel GetLogMemberAccessSys(String strCookieID)
        {
            Log_MemberAccessSysModel accessLog = new Log_MemberAccessSysModel();
            List <SqlParameter>      param     = new List <SqlParameter>();
            DataAccess da = new DataAccess(sqlXmlFileName, true);

            param.Add(new SqlParameter("@strCookieID", strCookieID));

            try
            {
                DataTable dt = da.RunQuery("GetLogMemberAccessSys", param.ToArray());
                if (dt.Rows.Count > 0)
                {
                    accessLog = (from p in dt.Select()
                                 select new Log_MemberAccessSysModel()
                    {
                        strMemberID = p["strMemberID"].ToString(),
                        strCookieID = p["strCookieID"].ToString(),
                        dtmLogin = DateTime.Parse(p["dtmLogin"].ToString()),
                        strType = p["strType"].ToString(),
                        strIP = p["strIP"].ToString(),
                        ysnSuccess = Convert.ToBoolean(p["ysnSuccess"].ToString())
                    }).First();
                } // if has data
            }     // try
            catch (Exception e)
            {
                logger.Error("GetLogMemberAccessSys " + e.Message);  // Error log
            } // catch: all exception

            return(accessLog);
        }//End GetLogMemberAccessSys
Beispiel #2
0
        }//End GetLogMemberAccessSys

        /// <summary>
        /// 新增 Member Access Sys Log
        /// </summary>
        public static Boolean InsertLogMemberAccessSys(Log_MemberAccessSysModel accessLog)
        {
            int insert_checker        = 0;
            List <SqlParameter> param = new List <SqlParameter>();
            DataAccess          da    = new DataAccess(sqlXmlFileName, true);

            param.Add(new SqlParameter("@strMemberID", accessLog.strMemberID));
            param.Add(new SqlParameter("@strType", accessLog.strType));
            param.Add(new SqlParameter("@ysnSuccess", accessLog.ysnSuccess));
            param.Add(new SqlParameter("@strIP", accessLog.strIP));
            param.Add(new SqlParameter("@strCookieID", accessLog.strCookieID));

            try
            {
                insert_checker = da.RunNonQuery("InsertLogMemberAccessSys", param.ToArray());
            }
            catch (Exception e)
            {
                logger.Error("InsertLogMemberAccessSys " + e.Message);  // Error log
            } // catch: all exception

            return(insert_checker > 0);
        }//End InsertLogMemberAccessSys