/// <summary> /// 根据用户名、密码查询用户数据 /// </summary> /// <param name="loginName"></param> /// <param name="strPwd"></param> /// <returns></returns> public WX_ZZSCUserInfo AdminLoginOpe(string loginName, string strPwd) { //DAL WX_ZZSCUserDAL userDal = new WX_ZZSCUserDAL(); //Query WX_ZZSCUserInfo userInfo = userDal.Query<WX_ZZSCUserInfo>(" LoginName = @LoginName AND Password = @Password ", new { LoginName = loginName, Password = strPwd }).FirstOrDefault(); return userInfo; }
/// <summary> /// 当该用户信息不存在,则存到表中 /// </summary> /// <param name="model"></param> public void UserInfoOpe(WX_ZZSCUserInfo model) { WX_ZZSCUserDAL userDal = new WX_ZZSCUserDAL(); //1.该用户是否已经存在于表中 WX_ZZSCUserInfo queryMod = userDal.Query<WX_ZZSCUserInfo>("OpenID = @OpenID", model).FirstOrDefault(); //2.判断 if (queryMod == null) { model.Flag = 1; model.Type = 1; model.OpeDate = DateTime.Now; userDal.Add(model); LogFileHelper.WriteLogByTxt("UserService:新加入一位用户:" + model.Name); } }
/// <summary> /// 数据查询 - User表,根据openid /// </summary> /// <param name="openid"></param> /// <returns></returns> public WX_ZZSCUserInfo RequestUserInfo(string openid) { //Init string strWhere = " OPENID = @OPENID "; //Query IEnumerable<WX_ZZSCUserInfo> list = new WX_ZZSCUserDAL().Query<WX_ZZSCUserInfo>(strWhere, new { OPENID = openid }); return list.FirstOrDefault(); }