Пример #1
0
        public static OnLineUserLog ChangeObj(DataRow dr)
        {
            OnLineUserLog obj = new OnLineUserLog();

            obj.UserId   = dr["UserId"] == DBNull.Value ? 0 : Convert.ToInt32(dr["UserId"]);
            obj.UserName = dr["UserName"] == DBNull.Value ? "" : dr["UserName"].ToString();
            obj.WS_IP    = dr["WS_IP"] == DBNull.Value ? "" : dr["WS_IP"].ToString();
            obj.WS_MAC   = dr["WS_MAC"] == DBNull.Value ? "" : dr["WS_MAC"].ToString();
            obj.Created  = dr["Created"] == DBNull.Value ? DateTime.Now : Convert.ToDateTime(dr["Created"]);
            return(obj);
        }
Пример #2
0
        public static OnLineUserLog RetrieveObj(int nUserId)
        {
            OnLineUserLogDbo dbo = new OnLineUserLogDbo();
            DataTable        dt  = dbo.RetrieveOneItems(nUserId);

            if (dt == null || dt.Rows.Count <= 0)
            {
                return(null);
            }
            OnLineUserLog obj = ChangeObj(dt.Rows[0]);

            return(obj);
        }
Пример #3
0
        public static bool DeleteObj(OnLineUserLog ou)
        {
            OnLineUserLogDbo dbo = new OnLineUserLogDbo();
            OnLineUserLogPo  po  = new OnLineUserLogPo();

            po.USERID   = ou.UserId;
            po.USERNAME = ou.UserName;
            po.WS_IP    = ou.WS_IP;
            po.WS_MAC   = ou.WS_MAC;
            po.CREATED  = ou.Created;

            return(dbo.Delete(po));
        }
Пример #4
0
        public static bool UpdateObj(OnLineUserLog ou)
        {
            OnLineUserLogDbo dbo = new OnLineUserLogDbo();
            OnLineUserLogPo  po  = new OnLineUserLogPo();

            po.USERID   = ou.UserId;
            po.USERNAME = ou.UserName;
            po.WS_IP    = ou.WS_IP;
            po.WS_MAC   = ou.WS_MAC;
            po.CREATED  = DateTime.Now;

            return(dbo.Update(po));
        }
Пример #5
0
        public static List <OnLineUserLog> RetrieveObjList()
        {
            List <OnLineUserLog> list = new List <OnLineUserLog>();
            OnLineUserLogDbo     dbo  = new OnLineUserLogDbo();
            DataTable            dt   = dbo.RetrieveALLItems();

            if (dt == null || dt.Rows.Count <= 0)
            {
                return(list);
            }
            foreach (DataRow dr in dt.Rows)
            {
                OnLineUserLog obj = ChangeObj(dr);
                if (obj != null)
                {
                    list.Add(obj);
                }
            }
            return(list);
        }