/// <summary> /// 验证登陆信息 /// </summary> /// <param name="ToCheck">需要验证的信息</param> /// <param name="SaveCookie">是否保存在cookies中</param> /// <returns>验证结果</returns> public static LoginType CheckInfo(LoginInfo ToCheck, bool SaveCookie) { SysCom.Sql.sqlCheckInfo qu = new SysCom.Sql.sqlCheckInfo(ToCheck.Username); SysCom.Ops.OpLoginQuery op = new SysCom.Ops.OpLoginQuery("Account", qu); op.Do(); DataSet ds = op.Ds; if (ds.Tables[0].Rows.Count == 0) { return(LoginType.Nouser); } if (ds.Tables[0].Rows[0]["Password"].ToString() != ToCheck.Password) { return(LoginType.PsError); } if (ds.Tables[0].Rows[0]["AccountState"].ToString() == "1") { return(LoginType.Frozen); } if (ds.Tables[0].Rows[0]["EmailValidation"].ToString() == "False") { return(LoginType.NotSure); } SysCom.Sql.sqlAdminInfo ai = new SysCom.Sql.sqlAdminInfo(ToCheck.Username); SysCom.Ops.OpAdminQuery aq = new SysCom.Ops.OpAdminQuery("Account", ai); aq.Do(); DataSet ds2 = aq.Ds; return(LoginType.Succeed); }
/// <summary> /// 验证权限信息 /// </summary> /// <param name="ToCheck">需要验证的信息</param> /// <returns>验证结果</returns> public static Boolean CheckAuthority(LoginInfo ToCheck) { SysCom.Sql.sqlAdminInfo ai = new SysCom.Sql.sqlAdminInfo(ToCheck.Username); SysCom.Ops.OpAdminQuery aq = new SysCom.Ops.OpAdminQuery("Account", ai); aq.Do(); DataSet ds = aq.Ds; return(ds.Tables[0].Rows.Count != 0); }