using Longbow.Web.Mvc;
using PetaPoco;
using System;
namespace Bootstrap.DataAccess
{
///
///
///
[TableName("LoginLogs")]
public class LoginUser
{
///
///
///
public string Id { get; set; }
///
///
///
public string UserName { get; set; }
///
///
///
public DateTime LoginTime { get; set; }
///
///
///
public string Ip { get; set; }
///
///
///
public string Browser { get; set; }
///
///
///
public string OS { get; set; }
///
///
///
public string City { get; set; }
///
///
///
public string Result { get; set; }
///
///
///
public string UserAgent { get; set; }
///
///
///
///
///
public virtual bool Log(LoginUser user)
{
var db = DbManager.Create();
db.Save(user);
return true;
}
///
///
///
///
///
///
public virtual Page Retrieves(PaginationOption po, string ip)
{
var sql = new Sql("select UserName, LoginTime, Ip, Browser, OS, City, Result from LoginLogs");
if (!string.IsNullOrEmpty(ip)) sql.Where("ip = @0", ip);
sql.OrderBy("LoginTime desc");
return DbManager.Create().Page(po.PageIndex, po.Limit, sql);
}
}
}