/// <summary> /// 获取账户信息 /// </summary> /// <param name="username"></param> /// <returns></returns> public AccountInfoModel GetAccount(string username) { string sql = "SELECT * FROM tbl_account WHERE user_name=@uname LIMIT 1;"; DataSet ds = db.ExecuteQueryDataSet(sql, username); if (ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0) { return(SiMay.Common.ModelHelper <AccountInfoModel> .ConvertToModelEntity(ds.Tables[0])); } else { return(null); } }
/// <summary> /// 登陆 /// </summary> /// <param name="login"></param> /// <returns></returns> public LoginResultModel Login(string username, string password) { string sql = "SELECT account_id, user_name , islock , lockdescribe FROM tbl_account WHERE user_name=@uname AND password=@pwd LIMIT 1;"; DataSet ds = db.ExecuteQueryDataSet(sql, username, password); if (ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0) { DataTable dt = ds.Tables[0]; return(SiMay.Common.ModelHelper <LoginResultModel> .ConvertToModelEntity(dt)); } else { return(new LoginResultModel()); } }
public List <DynamicallyModel> GetDynamicallys(int accountId, int lastarticle, int count) { string sql = "SELECT * FROM (SELECT * FROM tbl_blog_dynamically WHERE acc_id=@accid ORDER BY id DESC) AS data" + (lastarticle == -1 ? "" : " WHERE id < " + lastarticle) + " LIMIT @count;"; DataSet ds = db.ExecuteQueryDataSet(sql, accountId, count); if (ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0) { DataTable dt = ds.Tables[0]; List <DynamicallyModel> dynamicallyModels = SiMay.Common.ModelHelper <DynamicallyModel> .ConvertToModelEntitys(dt); return(dynamicallyModels); } else { return(new List <DynamicallyModel>()); } }